/* ================================
   LAPORAN PEMERHATI STYLES
   ================================ */

/* Hide body until auth check is complete */
body {
    opacity: 0;
    transition: opacity 0.2s ease;
}

body.auth-ready {
    opacity: 1;
}

/* Hero Compact */
.hero-compact {
    padding: 40px 24px 60px;
}

/* Tab Section */
.tab-section {
    max-width: 1200px;
    margin: -30px auto 0;
    padding: 0 24px;
    position: relative;
    z-index: 10;
}

.tab-container {
    display: flex;
    gap: 8px;
    background: var(--white);
    padding: 8px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--gray-600);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 40px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Container */
.form-container {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.laporan-form {
    padding: 0;
}

/* Form Section */
.form-section {
    padding: 32px;
    border-bottom: 1px solid var(--gray-200);
}

.form-section:last-of-type {
    border-bottom: none;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.section-icon {
    font-size: 24px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.label-icon {
    font-size: 16px;
}

.required {
    color: var(--danger);
}

/* Form Inputs */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group select,
.form-group textarea {
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
    color: var(--gray-800);
    background: var(--white);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(6, 110, 102, 0.1);
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* Searchable Select (Combobox) */
.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select .search-input {
    width: 100%;
    padding: 14px 40px 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
    color: var(--gray-800);
    background: var(--white);
    transition: var(--transition);
    cursor: pointer;
}

.searchable-select .search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(6, 110, 102, 0.1);
}

.searchable-select .search-input::placeholder {
    color: var(--gray-500);
}

.searchable-select::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--gray-500);
    pointer-events: none;
    transition: transform 0.2s ease;
}

.searchable-select.open::after {
    transform: translateY(-50%) rotate(180deg);
}

.searchable-select .select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.searchable-select.open .select-dropdown {
    display: block;
    animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.searchable-select .dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--gray-100);
}

.searchable-select .dropdown-item:last-child {
    border-bottom: none;
}

.searchable-select .dropdown-item:hover,
.searchable-select .dropdown-item.highlighted {
    background: var(--gray-100);
}

.searchable-select .dropdown-item.selected {
    background: rgba(6, 110, 102, 0.1);
    color: var(--primary-dark);
    font-weight: 600;
}

.searchable-select .dropdown-item .item-cawangan {
    font-weight: 600;
    color: var(--gray-800);
}

.searchable-select .dropdown-item .item-dun {
    font-size: 13px;
    color: var(--gray-500);
    margin-left: 8px;
}

.searchable-select .dropdown-empty {
    padding: 16px;
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
}

.searchable-select .search-input.has-value {
    font-weight: 600;
    color: var(--primary-dark);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-hint {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Input Prefix */
.input-prefix {
    display: flex;
    align-items: stretch;
}

.input-prefix .prefix {
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-weight: 600;
    color: var(--gray-600);
}

.input-prefix input {
    border-radius: 0 var(--radius) var(--radius) 0 !important;
    flex: 1;
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 24px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px 20px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    transition: var(--transition);
}

.radio-label:hover {
    border-color: var(--primary);
    background: rgba(6, 110, 102, 0.05);
}

.radio-label input {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    position: relative;
    transition: var(--transition);
}

.radio-label input:checked + .radio-custom {
    border-color: var(--primary);
    background: var(--primary);
}

.radio-label input:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--white);
    border-radius: 50%;
}

.radio-label input:checked ~ .radio-text {
    color: var(--primary);
    font-weight: 600;
}

/* Rating Group */
.rating-group {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.rating-label-left,
.rating-label-right {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    min-width: 50px;
}

.rating-label-right {
    text-align: right;
}

.rating-options {
    display: flex;
    gap: 12px;
    flex: 1;
    justify-content: center;
}

.rating-option {
    cursor: pointer;
}

.rating-option input {
    display: none;
}

.rating-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-500);
    transition: var(--transition);
}

.rating-option:hover .rating-circle {
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.1);
}

.rating-option input:checked + .rating-circle {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
    color: var(--white);
    box-shadow: var(--shadow-md);
    transform: scale(1.1);
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    padding: 24px 32px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 2px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

/* List Container */
.list-container {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid var(--gray-200);
    flex-wrap: wrap;
    gap: 16px;
}

.list-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
}

.list-filters {
    display: flex;
    gap: 12px;
}

.search-input,
.filter-select {
    padding: 10px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    min-width: 200px;
}

.search-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Stats Cards */
.list-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding: 24px 32px;
    background: var(--gray-50);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    font-size: 32px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
}

/* Table */
.laporan-table-container {
    overflow-x: auto;
}

.laporan-table {
    width: 100%;
    border-collapse: collapse;
}

.laporan-table th,
.laporan-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.laporan-table th {
    background: var(--gray-50);
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.laporan-table td {
    font-size: 14px;
    color: var(--gray-700);
}

.laporan-table tbody tr:hover {
    background: rgba(6, 110, 102, 0.03);
}

.loading-cell {
    text-align: center;
    padding: 60px 20px !important;
}

.loading-cell p {
    margin-top: 12px;
    color: var(--gray-500);
}

/* Prestasi Badge */
.prestasi-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.prestasi-badge.low {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.prestasi-badge.medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.prestasi-badge.high {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

/* Action Buttons */
.action-btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.action-btn.view {
    background: rgba(6, 110, 102, 0.1);
    color: var(--primary);
}

.action-btn.view:hover {
    background: var(--primary);
    color: var(--white);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-600);
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.modal-body .detail-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}

.modal-body .detail-label {
    flex: 0 0 40%;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
}

.modal-body .detail-value {
    flex: 1;
    font-size: 14px;
    color: var(--gray-800);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: none;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--gray-800);
    color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    z-index: 3000;
    animation: toastIn 0.3s ease;
}

.toast.show {
    display: flex;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: #f59e0b;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .tab-container {
        flex-direction: row;
        gap: 6px;
        padding: 6px;
    }

    .tab-btn {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-group.full-width {
        grid-column: span 1;
    }
    
    .rating-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .rating-label-left,
    .rating-label-right {
        text-align: center;
    }
    
    .list-stats {
        grid-template-columns: 1fr;
    }
    
    .list-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .list-filters {
        flex-direction: column;
    }
    
    .search-input,
    .filter-select {
        min-width: 100%;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Button Laporan in Nav */
.btn-laporan {
    background: rgba(233, 69, 96, 0.3);
    border-color: rgba(233, 69, 96, 0.4);
    text-decoration: none;
}

.btn-laporan:hover {
    background: rgba(233, 69, 96, 0.5);
}

.btn-laporan.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}
