/* Component-specific Styles: assets/css/components.css */

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    width: 100%;
    transition: var(--transition);
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
    box-shadow: 0 4px 12px rgba(59, 175, 125, 0.2);
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 175, 125, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-submit-form {
    border-radius: 40px !important;
    padding: 16px 28px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
}

.btn-danger {
    background-color: var(--color-red);
    color: var(--color-white);
    box-shadow: 0 4px 12px rgba(229, 0, 0, 0.2);
}

.btn-danger:hover {
    background-color: #b30000;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(229, 0, 0, 0.3);
}

.btn-secondary {
    background-color: var(--color-light-gray);
    color: var(--color-black);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline:hover {
    background-color: var(--color-primary-light);
}

.btn-icon-only {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

/* --- BADGES / STATUS --- */
.badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
    text-align: center;
}

.badge-hadir {
    background-color: #E2F5EC;
    color: var(--color-primary-dark);
}

.badge-alfa {
    background-color: var(--color-red-light);
    color: var(--color-red);
}

.badge-izin {
    background-color: var(--color-light-gray);
    color: #4b5563;
}

.badge-dinas {
    background-color: var(--color-yellow-light);
    color: #b45309;
}

.badge-pending {
    background-color: #FEF3C7;
    color: #D97706;
}

/* --- FORMS & INPUTS --- */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-gray);
    margin-bottom: 6px;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper i {
    position: absolute;
    left: 16px;
    color: var(--color-primary);
    font-size: 18px;
    pointer-events: none;
}

.form-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border-radius: 12px;
    border: 1.5px solid var(--color-light-gray);
    background-color: var(--color-white);
    font-size: 14px;
    color: var(--color-black);
    outline: none;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-input-no-icon {
    padding-left: 16px;
}

.input-icon-right {
    position: absolute;
    right: 16px;
    left: auto !important;
    pointer-events: auto !important;
    cursor: pointer;
    color: var(--color-primary);
    font-size: 18px;
    z-index: 10;
}

/* --- ALERTS --- */
.alert {
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease-out;
}

.alert-danger {
    background-color: var(--color-red-light);
    color: var(--color-red);
    border: 1px solid rgba(229, 0, 0, 0.15);
}

.alert-success {
    background-color: #D1FAE5;
    color: #065F46;
    border: 1px solid rgba(6, 95, 70, 0.15);
}

/* --- MODAL DIALOGS --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 20px 10px;
    box-sizing: border-box;
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    margin: auto;
    background-color: var(--color-white);
    border-radius: 24px;
    width: 90%;
    max-width: 380px;
    padding: 30px 24px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-sizing: border-box;
}

.modal-backdrop.show .modal-content {
    transform: scale(1);
}

.modal-icon-success {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #E2F5EC;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin: 0 auto 20px auto;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-black);
    margin-bottom: 10px;
}

.modal-desc {
    font-size: 13px;
    color: var(--color-gray);
    line-height: 1.5;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

@media (max-width: 480px) {
    .modal-actions {
        flex-direction: column;
        gap: 8px;
    }

    .modal-actions>* {
        width: 100% !important;
        flex: 1 1 100% !important;
    }
}

/* --- SPINNER & PROCESS ANIMATION --- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 5px solid var(--color-light-gray);
    border-top: 5px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- RESPONSIVE FORM ROW GRID --- */
.form-row-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
}

.form-row-grid>.form-group {
    flex: 1 1 calc(50% - 8px);
    min-width: 200px;
}

.form-group-flex-1 {
    flex: 1 1 calc(50% - 8px) !important;
}

.form-group-flex-1-2 {
    flex: 1.2 1 calc(60% - 8px) !important;
}

.form-group-flex-0-8 {
    flex: 0.8 1 calc(40% - 8px) !important;
}

@media (max-width: 600px) {
    .form-row-grid>.form-group {
        flex: 1 1 100% !important;
    }
}

/* --- ADMIN PANEL TABLES & ACTIONS --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th {
    padding: 12px 14px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    border-bottom: 1.5px solid #f1f5f9;
    background-color: #f8fafc;
    white-space: nowrap;
}

.admin-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    color: #334155;
    vertical-align: middle;
    white-space: nowrap;
}

.admin-table td[data-label="Detail"],
.admin-table td[data-label="Keterangan / Tujuan"] {
    white-space: normal !important;
    min-width: 220px;
}

.admin-table tr:hover {
    background-color: #f8fafc;
}

.sub-text {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 500;
}

.date-text {
    font-weight: 600;
    color: #334155;
}

.pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
    background-color: var(--color-primary-light);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    transition: var(--transition);
}

.pdf-link:hover {
    background-color: rgba(59, 175, 125, 0.2);
}

.action-buttons-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-action {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-green-action {
    background-color: #D1FAE5;
    color: #065F46;
}

.btn-green-action:hover {
    background-color: #A7F3D0;
    transform: translateY(-1px);
}

.btn-red-action {
    background-color: #FEE2E2;
    color: #B91C1C;
}

.btn-red-action:hover {
    background-color: #FCA5A5;
    transform: translateY(-1px);
}

.btn-view-log-photo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-view-log-photo:hover {
    background-color: rgba(59, 175, 125, 0.2);
    transform: translateY(-1px);
}

/* --- RESPONSIVE DROPDOWNS & FILTER BAR --- */
.table-filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
}

.search-input-wrapper,
.filter-select-wrapper,
.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper {
    flex: 1;
    min-width: 240px;
}

.filter-select-wrapper {
    flex: 0 1 auto;
    min-width: 130px;
}

/* Unified premium style for selects */
.filter-select-wrapper select,
.select-wrapper select,
select.filter-select {
    width: 100%;
    background-color: var(--color-white);
    border: 1.5px solid var(--color-light-gray);
    padding: 10px 14px 10px 38px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    color: var(--color-black);
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2364748b'%3e%3cpath d='M7 10l5 5 5-5H7z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 32px !important;
}

/* No icon for year */
.select-wrapper select.select-year,
.filter-select-no-icon {
    padding-left: 14px !important;
}

.filter-select-wrapper select:focus,
.select-wrapper select:focus,
select.filter-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.filter-select-wrapper i,
.select-wrapper i {
    position: absolute;
    left: 12px;
    color: var(--color-primary);
    font-size: 18px;
    pointer-events: none;
}

/* Align heights and icons inside the filter row */
.table-filter-row {
    align-items: stretch !important;
}

.table-filter-row .form-input,
.table-filter-row select {
    height: 46px !important;
    font-size: 13px !important;
    border-radius: 10px !important;
}

.table-filter-row .search-input-wrapper i,
.table-filter-row .filter-select-wrapper i {
    position: absolute;
    left: 14px;
    color: var(--color-primary);
    font-size: 20px;
    pointer-events: none;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
}

.table-filter-row .form-input {
    padding-left: 48px !important;
}

.table-filter-row select {
    padding-left: 44px !important;
}



/* Stacking dropdown filters and search elements vertically on tablet and mobile screens */
@media (max-width: 768px) {
    .table-filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .search-input-wrapper,
    .filter-select-wrapper {
        width: 100% !important;
        flex: 1 1 100% !important;
    }
}