@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    
    /* Brand Color Palette */
    --primary: #3985c3;
    --primary-hover: #2e6ea5;
    --primary-light: rgba(57, 133, 195, 0.1);
    
    --success: #10b981;
    --success-hover: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-premium: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.021), 0 20px 25px -5px rgba(0, 0, 0, 0.05);
    --sidebar-bg: #1e293b; /* Premium Dark Sidebar for visual hierarchy */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Auth Page Layout */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    background-color: #f1f5f9;
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-premium);
    animation: fadeIn 0.4s ease-out;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    font-size: 1.8rem;
    font-weight: 850;
    color: var(--primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Form Styling */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(57, 133, 195, 0.25);
}

.form-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 0.4rem;
    display: block;
}

.btn-primary {
    display: block;
    width: 100%;
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    padding: 0.85rem;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(57, 133, 195, 0.25);
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    padding: 2.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    padding-left: 0.5rem;
}

.sidebar-logo-text {
    font-size: 1.3rem;
    font-weight: 800;
    color: #ffffff;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-grow: 1;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #94a3b8;
    text-decoration: none;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-item a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-item.active a {
    color: #ffffff;
    background: var(--primary);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(57, 133, 195, 0.2);
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-logout {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Main Content Area */
.main-content {
    margin-left: 280px;
    flex-grow: 1;
    padding: 2.25rem;
    min-height: 100vh;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 1.5rem;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02), 0 1px 2px rgba(0,0,0,0.03);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-premium);
    border-color: #cbd5e1;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.stat-icon.blue { background: rgba(57, 133, 195, 0.12); color: var(--primary); }
.stat-icon.gold { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.stat-icon.green { background: rgba(16, 185, 129, 0.12); color: #059669; }
.stat-icon.red { background: rgba(239, 68, 68, 0.12); color: #dc2626; }

.stat-number {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02), 0 1px 2px rgba(0,0,0,0.03);
}

.chart-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    border-left: 3px solid var(--primary);
    padding-left: 0.75rem;
}

/* Table Card / Lists */
.card-premium {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02), 0 1px 2px rgba(0,0,0,0.03);
    margin-bottom: 2rem;
}

.card-title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Premium Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

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

.table-premium th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.table-premium td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
    color: #334155;
}

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

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.pending { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.badge.active { background: rgba(16, 185, 129, 0.1); color: #059669; }
.badge.inactive { background: rgba(239, 68, 68, 0.1); color: #dc2626; }

/* Filter Container */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-input {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--text-primary);
    padding: 0.55rem 0.85rem;
    border-radius: 8px;
    font-size: 0.9rem;
    min-width: 180px;
    transition: var(--transition);
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(57, 133, 195, 0.2);
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-action.btn-view {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.btn-action.btn-view:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.btn-action.btn-add {
    background: var(--primary);
    color: #ffffff;
}

.btn-action.btn-add:hover {
    background: var(--primary-hover);
    box-shadow: 0 2px 8px rgba(57, 133, 195, 0.2);
}

.btn-action.btn-reject {
    background: #ffffff;
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-action.btn-reject:hover {
    background: rgba(239, 68, 68, 0.05);
    border-color: var(--danger);
}

/* Detail View Layout */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }
}

.profile-card-left {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02), 0 1px 2px rgba(0,0,0,0.03);
}

.profile-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: rgba(57, 133, 195, 0.05);
    color: var(--primary);
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.detail-table td {
    padding: 0.85rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
}

.detail-label {
    color: var(--text-secondary);
    font-weight: 600;
    width: 35%;
}

.ktp-preview-container {
    margin-top: 1.25rem;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 0.75rem;
    background: #f8fafc;
}

.ktp-preview {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 8px;
    cursor: pointer;
}

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

.fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

/* Pagination */
.pagination-wrapper {
    margin-top: 1.5rem;
}

.pagination-wrapper nav svg {
    width: 18px;
    height: 18px;
}
.pagination-wrapper nav span, .pagination-wrapper nav a {
    background-color: #ffffff !important;
    color: var(--text-primary) !important;
    border-color: var(--card-border) !important;
}
.pagination-wrapper nav a:hover {
    background-color: #f1f5f9 !important;
}

.alert {
    padding: 0.85rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    font-size: 0.95rem;
}
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* --- PWA & Mobile Responsive Dashboard --- */

/* Form grid classes (from edit.blade.php modifications) */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-grid-half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    margin-top: 2rem;
    border-top: 1px solid var(--card-border);
    padding-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Toggle Sidebar button styled for mobile navigation */
.sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* Overlay for when sidebar is opened on mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* Layout Overhaul */
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        width: 280px;
        left: -280px;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem 1rem;
        width: 100%;
    }

    /* Content Header */
    .content-header {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 1.25rem;
        padding-bottom: 1.25rem;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    /* Grids & Forms */
    .form-grid, .form-grid-half {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn-action {
        width: 100%;
        justify-content: center;
    }

    /* Table adjustments for card layouts on mobile */
    .card-title-container {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-input, .btn-action {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 2.25rem 1.5rem;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .detail-table td {
        display: block;
        width: 100%;
        border-bottom: none;
        padding: 0.4rem 0;
    }

    .detail-table tr {
        display: block;
        border-bottom: 1px solid #f1f5f9;
        padding: 0.6rem 0;
    }

    .detail-label {
        width: 100%;
        margin-bottom: 0.2rem;
    }
}
