/* ==========================================
   Reports Page Specific Styles
   ========================================== */

/* Layout Structure */
/* Layout Structure */
:root {
    /* Light Mode (Default) */
    --primary: #D4A853;
    --primary-dark: #b8923d;
    --primary-light: rgba(212, 168, 83, 0.1);
    --text: #2D3748;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --surface: #FFFFFF;
    --background: #F3F4F6;
    --card-bg: #FFFFFF;

    /* Semantic Colors for Light Mode */
    --text-success: #10B981;
    --text-warning: #F59E0B;
    --text-danger: #EF4444;
    --text-info: #3B82F6;

    --bg-success-light: rgba(16, 185, 129, 0.1);
    --bg-warning-light: rgba(245, 158, 11, 0.1);
    --bg-danger-light: rgba(239, 68, 68, 0.1);
    --bg-info-light: rgba(59, 130, 246, 0.1);
    --bg-purple-light: rgba(139, 92, 246, 0.1);
}

[data-theme="dark"] {
    --primary: #D4A853;
    --primary-dark: #b8923d;
    --primary-light: rgba(212, 168, 83, 0.1);
    --text: #ffffff;
    --text-muted: #888888;
    --border: #333333;
    --surface: #1e1e1e;
    --background: #121212;
    --card-bg: #1e1e1e;

    /* Semantic Colors for Dark Mode - brighter for contrast */
    --text-success: #34d399;
    --text-warning: #fbbf24;
    --text-danger: #f87171;
    --text-info: #60a5fa;

    --bg-success-light: rgba(16, 185, 129, 0.2);
    --bg-warning-light: rgba(245, 158, 11, 0.2);
    --bg-danger-light: rgba(239, 68, 68, 0.2);
    --bg-info-light: rgba(59, 130, 246, 0.2);
    --bg-purple-light: rgba(139, 92, 246, 0.2);
}

body {
    background-color: var(--background);
    color: var(--text);
    font-family: 'Tajawal', sans-serif;
    margin: 0;
    padding: 0;
}

.page-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar (Reusing/Adjusting existing) */
.sidebar {
    width: 250px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
}

.sidebar .logo {
    padding: 0 20px 30px;
    text-align: center;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-item:hover,
.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item .icon {
    font-size: 20px;
}

/* Main Area */
.main-area {
    margin-right: 250px;
    /* Sidebar width */
    flex: 1;
    display: flex;
    flex-direction: column;
    width: calc(100% - 250px);
}

/* Header */
.main-header {
    background: var(--surface);
    height: 70px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.header-search {
    position: relative;
    width: 300px;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-search-input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-btn {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    position: relative;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.3s;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.notification-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
}

.user-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Page Content */
.page-content {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.page-header {
    margin-bottom: 30px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

/* Tabs */
.tabs-container {
    background: var(--surface);
    padding: 15px 20px 0;
    border-radius: 12px 12px 0 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.tabs-nav {
    display: flex;
    gap: 30px;
    background: transparent;
    /* Override accounting.css */
    padding: 0;
    /* Align with reports design */
}

.tab-btn {
    background: none;
    border: none;
    padding: 15px 5px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--primary);
    background: transparent;
    /* Override accounting.css */
    box-shadow: none;
    /* Override accounting.css */
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

.tab-panel {
    display: none;
}

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

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

/* Premium Filters */
.filters-container-premium {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filters-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 20px;
}

.filter-label-premium {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Date Inputs */
/* Date Inputs */
.date-inputs-modern {
    display: flex;
    align-items: center;
    background: var(--background);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.date-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* Removed input-icon-small styling */

.form-control-modern {
    background: transparent;
    border: none;
    color: var(--text);
    padding: 6px 0;
    font-family: inherit;
    font-size: 14px;
    width: 100%;
}

.date-input-wrapper input {
    padding: 0;
    width: 130px;
}




.form-control-modern:focus {
    outline: none;
}

.date-separator {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 10px;
}

/* New Toolbar Group Styling */
.date-toolbar-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.actions-buttons-modern {
    display: flex;
    gap: 8px;
}

.btn-action-modern {
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.btn-action-modern:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

.date-separator {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 10px;
}

/* Segmented Control */
.segmented-control {
    display: flex;
    background: var(--background);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.segment-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.segment-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    /* subtle hover */
}

/* Modern Grid */
.filters-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.filter-item-modern {
    display: flex;
    flex-direction: column;
}

.input-icon-group {
    position: relative;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.2s;
}

.input-icon-group:focus-within,
.select-wrapper-modern:focus-within {
    border-color: var(--primary);
}

.input-icon-main {
    position: absolute;
    left: 12px;
    /* Move to left for RTL end */
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

.input-icon-group input {
    padding: 12px 12px 12px 40px;
    /* Add Left padding for icon */
    border-radius: 8px;
}

/* Custom Select */
.select-wrapper-modern {
    position: relative;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.custom-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 12px 15px;
    cursor: pointer;
}

.select-arrow-custom {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}

/* Inputs & Buttons */
.form-control {
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 6px;
    width: 100%;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.3s;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text-muted);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-success-outline {
    color: #10b981;
    border-color: #10b981;
}

.btn-success-outline:hover {
    background: #10b981;
    color: white;
}

.btn-danger-outline {
    color: #ef4444;
    border-color: #ef4444;
}

.btn-danger-outline:hover {
    background: #ef4444;
    color: white;
}

.btn-light {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

/* Summary Row */
.summary-row {
    display: flex;
    gap: 24px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 20px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.summary-icon {
    width: 48px;
    height: 40px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 8px;
    font-size: 20px;
}

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

.summary-value {
    font-size: 18px;
    /* Reduced from 20px */
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.summary-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* Summary Cards (Refactored for Stability) */
.summary-cards-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px !important;
}

.summary-cards-row .summary-card {
    flex: 1 1 200px;
    /* Grow, shrink, basis */
    min-width: 200px;
}

.summary-cards-row.five-cols .summary-card {
    flex: 1 1 180px;
    /* Slightly smaller basis for 5 cols */
}

/* Remove old grid classes if they exist */
.summary-cards-row.five-cols {
    display: flex;
}



.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s;
}

.summary-card .card-body {
    padding: 20px;
    /* Ensure internal padding */
    display: flex;
    align-items: center;
}

.bg-primary-light {
    background: var(--bg-info-light);
    color: var(--text-info);
}

.bg-warning-light {
    background: var(--bg-warning-light);
    color: var(--text-warning);
}

.bg-success-light {
    background: var(--bg-success-light);
    color: var(--text-success);
}

.bg-info-light {
    background: var(--bg-info-light);
    color: var(--text-info);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: right;
    padding: 15px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

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

.table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.project-name {
    font-weight: 500;
    color: var(--text);
}

/* Badges & Text Colors */
.text-muted {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--text-success) !important;
}

.text-warning {
    color: var(--text-warning) !important;
}

.text-danger {
    color: var(--text-danger) !important;
}

.text-purple {
    color: #a78bfa !important;
}

.text-info {
    color: var(--text-info) !important;
}

.fw-bold {
    font-weight: 700;
}

.fs-4 {
    font-size: 1.5rem;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge.bg-success {
    background: var(--bg-success-light);
    color: var(--text-success);
}

.badge.bg-warning {
    background: var(--bg-warning-light);
    color: var(--text-warning);
}

.badge.bg-primary {
    background: var(--bg-info-light);
    color: var(--text-info);
}

.badge.bg-purple {
    background: var(--bg-purple-light);
    color: #a78bfa;
}

.badge.bg-info {
    background: var(--bg-info-light);
    color: var(--text-info);
}

.badge.bg-danger {
    background: var(--bg-danger-light);
    color: var(--text-danger);
}

.badge.bg-secondary {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.rounded-circle {
    border-radius: 50% !important;
}

/* Accordion */
.accordion-item {
    border-bottom: 1px solid var(--border);
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    margin: 0;
}

.accordion-button {
    width: 100%;
    text-align: right;
    background: transparent;
    border: none;
    padding: 15px 20px;
    color: var(--text);
    display: flex;
    align-items: center;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: background 0.2s;
}

.accordion-button:hover {
    background: rgba(255, 255, 255, 0.02);
}

.accordion-button:not(.collapsed) {
    background: rgba(255, 255, 255, 0.03);
    color: var(--primary);
}

.accordion-body {
    padding: 0;
}

/* Pagination */
.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 5px;
}

.page-link {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
}

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

.page-item.disabled .page-link {
    opacity: 0.5;
    pointer-events: none;
}

/* Misc */
.me-2 {
    margin-left: 0.5rem;
}

.me-3 {
    margin-left: 1rem;
}

.ms-3 {
    margin-right: 1rem;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.justify-content-end {
    justify-content: flex-end;
}

.flex-grow-1 {
    flex-grow: 1;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 1rem;
}

.p-0 {
    padding: 0 !important;
}

.p-3 {
    padding: 1rem !important;
}

.py-4 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.border-success {
    border-color: #10b981 !important;
}

.border-warning {
    border-color: #f59e0b !important;
}

.text-center {
    text-align: center;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive */
@media (max-width: 1200px) {
    .summary-cards-row .summary-card {
        flex-basis: calc(50% - 15px);
        /* 2 per row */
    }
}

@media (max-width: 768px) {
    .summary-cards-row {
        flex-direction: column;
    }

    .summary-cards-row .summary-card {
        width: 100%;
        flex-basis: auto;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }

    .main-area {
        margin-right: 0;
        width: 100%;
    }

    .sidebar {
        display: none;
        /* Or toggleable */
    }
}