/* ========================================
   Dashboard / Sidebar Layout
   ======================================== */

.app-body {
    min-height: 100vh;
    background: var(--bg);
    display: block;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand .logo-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-brand .logo-text {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.25;
}

.sidebar-brand .logo-text span {
    display: block;
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.8;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: rgba(0, 180, 216, 0.25);
    color: white;
}

.nav-icon {
    display: flex;
    flex-shrink: 0;
    opacity: 0.9;
}

.sidebar-footer {
    padding: 1rem 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-meta {
    min-width: 0;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    opacity: 0.7;
}

.logout-btn {
    color: rgba(255,255,255,0.7);
    padding: 6px;
    border-radius: 6px;
    display: flex;
    transition: var(--transition);
}

.logout-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    padding: 1.5rem 1.75rem 2.5rem;
    max-width: 100%;
}

.page-header {
    margin-bottom: 1.25rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.3px;
}

.page-body {
    /* content area */
}

/* Mobile topbar */
.mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 150;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 0.75rem 1rem;
    align-items: center;
    justify-content: space-between;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
}

.mobile-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.mobile-logout {
    color: white;
    display: flex;
    padding: 4px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 190;
}

/* Cards & panels */
.panel {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.panel-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.info-item .label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.info-item .value {
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}

/* Stats row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.15rem 1.25rem;
    text-align: center;
}

.stat-card .stat-num {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-resubmit {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-approved {
    background: #d1fae5;
    color: #065f46;
}

.badge-rejected {
    background: #fee2e2;
    color: #991b1b;
}

.badge-not_applicable {
    background: #e2e8f0;
    color: #475569;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 0.85rem;
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.85rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: #f8fafc;
}

/* Forms inside panel */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row .full {
    grid-column: 1 / -1;
}

.readonly-field {
    background: #f1f5f9 !important;
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Membership radio cards */
.membership-options {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.membership-option {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.15rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.membership-option:hover {
    border-color: var(--accent);
}

.membership-option.selected {
    border-color: var(--accent);
    background: rgba(0, 180, 216, 0.06);
}

.membership-option input {
    margin-top: 3px;
    accent-color: var(--accent);
}

.membership-option .opt-title {
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 0.2rem;
}

.membership-option .opt-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.payment-upload-box {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border);
}

.payment-upload-box.show {
    display: block;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

.empty-state p {
    margin-bottom: 1rem;
}

/* Action buttons small */
.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    width: auto;
    display: inline-flex;
}

.btn-danger {
    background: #fee2e2;
    color: #991b1b;
    border: none;
}

.btn-danger:hover {
    background: #fecaca;
}

.btn-success {
    background: #d1fae5;
    color: #065f46;
    border: none;
}

.btn-success:hover {
    background: #a7f3d0;
}

/* File input style */
.file-input-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.file-input-label:hover {
    border-color: var(--accent);
    color: var(--primary);
}

.file-input-label input[type="file"] {
    display: none;
}

.file-name {
    font-size: 0.82rem;
    color: var(--accent-hover);
    margin-top: 0.35rem;
    display: none;
}

.file-name.show {
    display: block;
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem 1rem 2rem;
    }

    .mobile-topbar {
        display: flex;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }
}
