/* ST Finance Group - Admin-specific Styles */

/* Sidebar */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 40;
    width: 16rem; /* w-64 = 256px */
}

/* Main content pushed right of fixed sidebar on desktop */
#admin-main {
    margin-left: 16rem;
}

@media (max-width: 1024px) {
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }

    #sidebar.active {
        transform: translateX(0);
    }

    #admin-main {
        margin-left: 0;
    }
}

/* Smooth transitions for nav */
.nav-item,
.nav-submenu {
    transition: all 0.2s ease;
}

.nav-chevron {
    transition: transform 0.2s ease;
}

/* Stat cards */
.stat-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.stat-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 0.5rem;
}

.stat-card-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1F2937;
}

.stat-card-label {
    font-size: 0.875rem;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Application/Loan cards */
.application-card,
.loan-card {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    padding: 1.25rem;
    transition: all 0.2s;
    cursor: pointer;
}

.application-card:hover,
.loan-card:hover {
    border-color: #1E5AFA;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #E5E7EB;
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-dot {
    position: absolute;
    left: -1.625rem;
    top: 0.25rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: #1E5AFA;
    border: 2px solid white;
    box-shadow: 0 0 0 2px #E5E7EB;
}

/* Document viewer */
.document-preview {
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #F9FAFB;
}

.document-preview img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Repayment schedule */
.schedule-row {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #E5E7EB;
}

.schedule-row:hover {
    background: #F9FAFB;
}

.schedule-row.overdue {
    background: #FEF2F2;
}

.schedule-row.paid {
    opacity: 0.6;
}

/* Action buttons grouped */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    color: #D1D5DB;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #F3F4F6 25%, #E5E7EB 50%, #F3F4F6 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 0.875rem;
    border-radius: 0.25rem;
}

.skeleton-title {
    height: 1.25rem;
    border-radius: 0.25rem;
    width: 60%;
}

/* Settings page specific */
.settings-section {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.settings-section-header {
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #E5E7EB;
}

.settings-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1F2937;
}

.settings-section-description {
    font-size: 0.875rem;
    color: #6B7280;
    margin-top: 0.25rem;
}

/* Permission matrix */
.permission-matrix {
    overflow-x: auto;
}

.permission-matrix table {
    min-width: 600px;
}

.permission-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

/* Report cards */
.report-card {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.report-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1F2937;
}

.report-label {
    font-size: 0.875rem;
    color: #6B7280;
    margin-top: 0.25rem;
}

.report-change {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.report-change.positive {
    color: #10B981;
}

.report-change.negative {
    color: #EF4444;
}

/* Print styles */
@media print {
    #sidebar,
    header,
    .no-print {
        display: none !important;
    }

    body {
        background: white;
    }

    .card {
        box-shadow: none;
        border: 1px solid #E5E7EB;
    }

    .page-break {
        page-break-after: always;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stat-card {
        padding: 1rem;
    }

    .stat-card-value {
        font-size: 1.5rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }
}

/* ========================================
   DARK MODE
   ======================================== */

[data-theme="dark"] {
    color-scheme: dark;
}

/* Base colors */
[data-theme="dark"] body {
    background-color: #0f172a;
    color: #e2e8f0;
}

[data-theme="dark"] #admin-main {
    background-color: #0f172a;
}

/* Sidebar */
[data-theme="dark"] #sidebar {
    background-color: #1e293b;
    border-right-color: #334155;
}

[data-theme="dark"] .nav-item {
    color: #cbd5e1;
}

[data-theme="dark"] .nav-item:hover {
    background-color: #334155;
    color: #f1f5f9;
}

[data-theme="dark"] .nav-item.active {
    background-color: #1e40af;
    color: white;
}

/* Cards */
[data-theme="dark"] .card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .application-card,
[data-theme="dark"] .loan-card,
[data-theme="dark"] .settings-section,
[data-theme="dark"] .report-card {
    background-color: #1e293b;
    border-color: #334155;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .application-card:hover,
[data-theme="dark"] .loan-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

/* Text colors */
[data-theme="dark"] .stat-card-value,
[data-theme="dark"] .report-value,
[data-theme="dark"] .settings-section-title,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4 {
    color: #f1f5f9;
}

[data-theme="dark"] .stat-card-label,
[data-theme="dark"] .report-label,
[data-theme="dark"] .settings-section-description,
[data-theme="dark"] p,
[data-theme="dark"] .text-gray-600,
[data-theme="dark"] .text-gray-500 {
    color: #94a3b8 !important;
}

[data-theme="dark"] .text-gray-900 {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .text-gray-700 {
    color: #cbd5e1 !important;
}

/* Borders */
[data-theme="dark"] .border-gray-300,
[data-theme="dark"] .border-gray-200 {
    border-color: #334155 !important;
}

/* Timeline */
[data-theme="dark"] .timeline::before {
    background: #334155;
}

[data-theme="dark"] .timeline-dot {
    background: #3b82f6;
    border-color: #1e293b;
    box-shadow: 0 0 0 2px #334155;
}

/* Schedule */
[data-theme="dark"] .schedule-row {
    border-bottom-color: #334155;
}

[data-theme="dark"] .schedule-row:hover {
    background: #334155;
}

[data-theme="dark"] .schedule-row.overdue {
    background: #7f1d1d;
}

/* Document preview */
[data-theme="dark"] .document-preview {
    background: #0f172a;
    border-color: #334155;
}

/* Settings section */
[data-theme="dark"] .settings-section-header {
    border-bottom-color: #334155;
}

/* Inputs & Forms */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background-color: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #64748b;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    background-color: #1e293b;
    border-color: #3b82f6;
    color: #e2e8f0;
}

/* Disabled inputs */
[data-theme="dark"] input:disabled,
[data-theme="dark"] textarea:disabled,
[data-theme="dark"] select:disabled {
    background-color: #0f172a;
    color: #64748b;
    opacity: 0.6;
}

/* Tables */
[data-theme="dark"] table {
    color: #e2e8f0;
}

[data-theme="dark"] thead {
    background-color: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] th {
    color: #cbd5e1;
}

[data-theme="dark"] tbody tr {
    border-color: #334155;
}

[data-theme="dark"] tbody tr:hover {
    background-color: #1e293b;
}

/* Modals */
[data-theme="dark"] .modal-content,
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-body,
[data-theme="dark"] .modal-footer {
    background-color: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

/* Backdrop */
[data-theme="dark"] .modal-backdrop,
[data-theme="dark"] .overlay {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Dropdowns */
[data-theme="dark"] .dropdown-menu {
    background-color: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .dropdown-item {
    color: #cbd5e1;
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: #334155;
    color: #f1f5f9;
}

/* Badges */
[data-theme="dark"] .badge {
    border-color: #334155;
}

/* Empty state */
[data-theme="dark"] .empty-state-icon {
    color: #475569;
}

/* Skeleton loader */
[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}

/* Specific background overrides */
[data-theme="dark"] .bg-white {
    background-color: #1e293b !important;
}

[data-theme="dark"] .bg-gray-50 {
    background-color: #0f172a !important;
}

[data-theme="dark"] .bg-gray-100 {
    background-color: #1e293b !important;
}

[data-theme="dark"] .bg-gray-200 {
    background-color: #334155 !important;
}

/* Headers & Topbar */
[data-theme="dark"] header {
    background-color: #1e293b;
    border-bottom-color: #334155;
}

/* Links */
[data-theme="dark"] a {
    color: #60a5fa;
}

[data-theme="dark"] a:hover {
    color: #93c5fd;
}

/* Code blocks */
[data-theme="dark"] code,
[data-theme="dark"] pre {
    background-color: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}
