/* ISP Finance Recap - Custom Styles */

:root {
    --primary-color: #0d6efd;
    --primary-dark: #0b5ed7;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-warning: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-info: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

body {
    background-color: #f0f2f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
}

.nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-link:hover {
    transform: translateY(-2px);
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

/* Stat Cards */
.stat-card {
    border-radius: 16px;
    overflow: hidden;
    position: relative;
}

.stat-card .card-body {
    position: relative;
    z-index: 1;
}

.stat-card.bg-gradient-primary {
    background: var(--gradient-primary);
}

.stat-card.bg-gradient-success {
    background: var(--gradient-success);
}

.stat-card.bg-gradient-warning {
    background: var(--gradient-warning);
}

.stat-card.bg-gradient-info {
    background: var(--gradient-info);
}

.stat-card .stat-icon {
    font-size: 3rem;
    opacity: 0.3;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tables */
.table-responsive {
    border-radius: 12px;
    overflow-x: auto;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: #6c757d;
    white-space: nowrap;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
    border-radius: 6px;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Forms */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.625rem 1rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.375rem;
}

/* Login Page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
}

.login-card {
    max-width: 420px;
    width: 100%;
    margin: 1rem;
}

.login-card .card {
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.login-card .card-body {
    padding: 2.5rem;
}

.login-logo {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Page Header */
.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--secondary-color);
    font-size: 0.875rem;
}

/* Filter Card */
.filter-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

/* Action Buttons Group */
.action-btns .btn {
    margin-right: 0.25rem;
}

.action-btns .btn:last-child {
    margin-right: 0;
}

/* Import Preview */
.import-preview {
    max-height: 400px;
    overflow: auto;
}

.import-preview table {
    font-size: 0.875rem;
}

/* Export Cards */
.export-card {
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.export-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Alert improvements */
.alert {
    border: none;
    border-radius: 12px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--secondary-color);
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.5;
    margin-bottom: 1rem;
}

/* Pagination */
.pagination {
    margin-bottom: 0;
}

.page-link {
    border-radius: 8px;
    margin: 0 2px;
    border: none;
    color: var(--dark-color);
}

.page-link:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .stat-card .stat-value {
        font-size: 1.25rem;
    }

    .stat-card .stat-icon {
        font-size: 2rem;
    }

    .filter-card .row>div {
        margin-bottom: 0.75rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    .action-btns .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Print styles */
@media print {

    .navbar,
    .filter-card,
    .action-btns,
    footer {
        display: none !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}

/* Loading spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Currency formatting */
.text-currency {
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
}

.text-currency-positive {
    color: var(--success-color);
}

.text-currency-negative {
    color: var(--danger-color);
}

/* Sidebar Layout */
/* Sidebar Layout */
#wrapper {
    overflow-x: hidden;
    display: flex;
}

#sidebar-wrapper {
    min-height: 100vh;
    margin-left: -16rem;
    width: 16rem;
    background-color: var(--dark-color);
    transition: margin 0.25s ease-out, transform 0.3s ease-in-out;

    /* Mobile/Tablet Fallback (Default Hidden) */
    position: fixed;
    z-index: 1035;
    /* Above navbar */
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    margin-left: 0;
}

#sidebar-wrapper .sidebar-heading {
    padding: 1rem 1.25rem;
    font-size: 1.2rem;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.1);
}

#sidebar-wrapper .list-group {
    width: 16rem;
}

#page-content-wrapper {
    min-width: 100vw;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Mobile Toggle State (Open) */
body.sb-sidenav-toggled #sidebar-wrapper {
    transform: translateX(0);
}

/* Backdrop for Mobile */
@media (max-width: 991.98px) {
    body.sb-sidenav-toggled #page-content-wrapper::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1030;
        /* Below sidebar, above content */
        cursor: pointer;
    }
}

/* Sidebar Links */
#sidebar-wrapper .list-group-item-action {
    color: rgba(255, 255, 255, 0.75);
    background-color: transparent;
    border: none;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    border-radius: 0;
}

#sidebar-wrapper .list-group-item-action:hover,
#sidebar-wrapper .list-group-item-action:focus {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

#sidebar-wrapper .list-group-item-action.active {
    color: #fff;
    background-color: var(--primary-color);
    border-left: 4px solid #fff;
}

/* Desktop Styles (>= 992px) */
@media (min-width: 992px) {
    #sidebar-wrapper {
        position: relative;
        transform: none;
        margin-left: 0;
        /* Visible by default */
        z-index: 0;
    }

    #page-content-wrapper {
        min-width: 0;
        width: 100%;
    }

    /* Desktop Toggle State (Collapsed) */
    body.sb-sidenav-toggled #sidebar-wrapper {
        margin-left: -16rem;
        transform: none;
    }

    body.sb-sidenav-toggled #sidebar-wrapper .sidebar-heading,
    body.sb-sidenav-toggled #sidebar-wrapper .list-group {
        display: none;
        /* Hide content when collapsed on desktop to prevent overflow issues */
    }
}