/* ============================================
   LPMS - Legal Practice Management System
   Main Application Stylesheet
   ============================================ */

/* ---- CSS Variables ---- */
:root {
    --primary: #DAA520;
    --primary-dark: #B8860B;
    --primary-light: #FFD700;
    --primary-rgb: 218, 165, 32;
    --primary-gradient: linear-gradient(135deg, #DAA520, #FFD700);
    --primary-gradient-dark: linear-gradient(135deg, #B8860B, #DAA520);
    --sidebar-bg: #FAF3E0;
    --sidebar-width: 260px;
    --navbar-height: 65px;
    --body-bg: #f0f2f5;
    --card-bg: #ffffff;
    --text-dark: #2c3e50;
    --text-muted: #6c757d;
    --text-light: #95a5a6;
    --border-color: #e9ecef;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
    --rainbow-height: 4px;
}

/* ---- Global Reset & Base ---- */
* { box-sizing: border-box; }

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--body-bg);
    color: var(--text-dark);
    direction: rtl;
    margin: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
}

a { color: var(--primary-dark); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary); }

::selection { background: var(--primary); color: #fff; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-left: 1px solid var(--border-color);
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.sidebar-brand img {
    max-height: 50px;
    max-width: 180px;
    object-fit: contain;
}

.sidebar-brand h4 {
    margin: 10px 0 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-dark);
}

.sidebar-brand small {
    color: var(--text-muted);
    font-size: 11px;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 0;
}

.sidebar-section {
    margin-bottom: 5px;
}

.sidebar-section-title {
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-dark);
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    border-right: 3px solid transparent;
    cursor: pointer;
}

.sidebar-link:hover {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-dark);
}

.sidebar-link.active {
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary-dark);
    border-right-color: var(--primary);
    font-weight: 600;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    opacity: 0.8;
}

.sidebar-link .badge {
    margin-right: auto;
    margin-left: 0;
    font-size: 10px;
}

/* Submenu */
.sidebar-submenu-toggle {
    cursor: pointer;
    user-select: none;
}

.sidebar-submenu-toggle::after {
    content: '\f104';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-right: auto;
    margin-left: 0;
    font-size: 11px;
    transition: transform 0.3s;
}

.sidebar-submenu-toggle.collapsed::after {
    transform: rotate(-90deg);
}

.sidebar-submenu {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-submenu.collapsed {
    max-height: 0;
}

.sidebar-submenu .sidebar-link {
    padding-right: 50px;
    font-size: 13px;
    font-weight: 400;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================
   TOP NAVBAR
   ============================================ */
.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: var(--sidebar-width);
    height: var(--navbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 1030;
    display: flex;
    align-items: center;
    padding: 0 25px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.navbar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-dark);
    cursor: pointer;
    padding: 5px 10px;
    margin-left: 10px;
}

.navbar-search {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.navbar-search input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 8px 20px 8px 40px;
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
    background: var(--body-bg);
    transition: var(--transition);
}

.navbar-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
    background: #fff;
}

.navbar-search i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 350px;
    overflow-y: auto;
    display: none;
    z-index: 1050;
    margin-top: 5px;
}

.search-results-dropdown.show { display: block; }

.search-result-item {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.search-result-item:hover { background: rgba(var(--primary-rgb), 0.05); }
.search-result-item:last-child { border-bottom: none; }

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-right: auto;
}

.navbar-action-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-dark);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}

.navbar-action-btn:hover {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-dark);
}

.navbar-action-btn .notification-badge {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #dc3545;
    color: #fff;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    margin-right: 10px;
}

.navbar-user:hover { background: rgba(var(--primary-rgb), 0.08); }

.navbar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.navbar-user-info {
    text-align: right;
    line-height: 1.3;
}

.navbar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.navbar-user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* Notification Dropdown */
.notification-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 350px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 450px;
    overflow-y: auto;
    display: none;
    z-index: 1050;
    margin-top: 5px;
}

.notification-dropdown.show { display: block; }

.notification-dropdown-header {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.notification-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
}

.notification-item:hover { background: rgba(var(--primary-rgb), 0.04); }
.notification-item.unread { background: rgba(var(--primary-rgb), 0.06); }

.notification-item .title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 3px;
}

.notification-item .message {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.notification-item .time {
    font-size: 11px;
    color: var(--text-light);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-right: var(--sidebar-width);
    margin-top: var(--navbar-height);
    padding: 25px;
    min-height: calc(100vh - var(--navbar-height));
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}
.main-content > .app-statusbar { margin-top: auto; }

/* Fade in animation */
.fade-in {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h4 {
    margin: 0;
    font-weight: 700;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h4 i { color: var(--primary); }

.page-header .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Breadcrumb */
.breadcrumb-nav {
    margin-bottom: 15px;
}

.breadcrumb-nav ol {
    background: transparent;
    padding: 0;
    margin: 0;
    list-style: none;
    display: flex;
    gap: 8px;
    font-size: 13px;
}

.breadcrumb-nav li::before {
    content: '/';
    margin-left: 8px;
    color: var(--text-muted);
}

.breadcrumb-nav li:first-child::before { display: none; }

.breadcrumb-nav li a { color: var(--text-muted); }
.breadcrumb-nav li a:hover { color: var(--primary-dark); }
.breadcrumb-nav li.active { color: var(--text-dark); font-weight: 500; }

/* ============================================
   CONTENT CARDS
   ============================================ */
.content-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    transition: var(--transition);
}

.content-card:hover {
    box-shadow: var(--shadow-md);
}

.content-card .card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
}

.content-card .card-header h5,
.content-card .card-header h6 {
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-card .card-body { padding: 20px; }
.content-card .card-body.p-0 { padding: 0; }

.content-card .card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background: transparent;
}

/* ============================================
   STAT CARDS (Dashboard KPI)
   ============================================ */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-gradient);
}

.stat-card .stat-icon {
    width: 55px;
    height: 55px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-card .stat-icon.bg-primary-soft { background: rgba(var(--primary-rgb), 0.12); color: var(--primary-dark); }
.stat-card .stat-icon.bg-success-soft { background: rgba(40, 167, 69, 0.12); color: #28a745; }
.stat-card .stat-icon.bg-info-soft { background: rgba(23, 162, 184, 0.12); color: #17a2b8; }
.stat-card .stat-icon.bg-danger-soft { background: rgba(220, 53, 69, 0.12); color: #dc3545; }
.stat-card .stat-icon.bg-warning-soft { background: rgba(255, 193, 7, 0.12); color: #e0a800; }

.stat-card .stat-info { flex: 1; }

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 5px;
    font-weight: 500;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.stat-card .stat-detail {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 5px;
}

.stat-card .stat-detail .up { color: #28a745; }
.stat-card .stat-detail .down { color: #dc3545; }

/* ============================================
   WELCOME BANNER
   ============================================ */
.welcome-banner {
    background: linear-gradient(135deg, #2c3e50 0%, #3d566e 100%);
    border-radius: var(--radius-lg);
    padding: 30px;
    color: #fff;
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -30%;
    width: 300px;
    height: 300px;
    background: rgba(var(--primary-rgb), 0.1);
    border-radius: 50%;
}

.welcome-banner h3 {
    font-weight: 700;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.welcome-banner p {
    opacity: 0.8;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.welcome-banner .btn {
    position: relative;
    z-index: 1;
}

/* ============================================
   DATA TABLES
   ============================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    background: var(--body-bg);
    padding: 12px 15px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    text-align: right;
}

.data-table tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: rgba(var(--primary-rgb), 0.04);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .text-center { text-align: center; }
.data-table .text-left { text-align: left; }

/* Summary row */
.data-table tfoot td {
    padding: 12px 15px;
    font-weight: 700;
    background: rgba(var(--primary-rgb), 0.06);
    border-top: 2px solid var(--primary);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-gold {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
}

.btn-gold:hover {
    background: var(--primary-gradient-dark);
    color: #fff;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
    transform: translateY(-1px);
}

.btn-gold:active { transform: translateY(0); }

.btn-outline-gold {
    background: transparent;
    color: var(--primary-dark);
    border: 1px solid var(--primary);
    padding: 7px 19px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-family: 'Tajawal', sans-serif;
    font-weight: 500;
    cursor: pointer;
}

.btn-outline-gold:hover {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-dark);
}

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 30px; font-size: 16px; }

/* ============================================
   BADGES
   ============================================ */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
}

/* ============================================
   FORMS
   ============================================ */
.form-label {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 5px;
    color: var(--text-dark);
}

.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.form-section-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--primary-dark);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 8px;
    margin: 25px 0 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-title:first-of-type { margin-top: 0; }

/* ============================================
   MODALS
   ============================================ */
.modal-header {
    background: var(--body-bg);
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-title i { color: var(--primary); }

.modal-footer {
    border-top: 1px solid var(--border-color);
    background: var(--body-bg);
}

/* ============================================
   FILTERS
   ============================================ */
.filter-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

/* ============================================
   TABS
   ============================================ */
.nav-tabs .nav-link {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    padding: 10px 20px;
    border: none;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
}

.nav-tabs .nav-link:hover {
    color: var(--primary-dark);
    border-color: transparent;
    border-bottom-color: rgba(var(--primary-rgb), 0.3);
}

.nav-tabs .nav-link.active {
    color: var(--primary-dark);
    border-color: transparent;
    border-bottom-color: var(--primary);
    background: transparent;
}

/* ============================================
   TIMELINE
   ============================================ */
.timeline {
    position: relative;
    padding: 20px 30px 20px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    right: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 25px;
    padding-right: 35px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    right: -25px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--primary);
    z-index: 1;
}

.timeline-item .timeline-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.timeline-item .timeline-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 15px;
}

.timeline-item .timeline-title {
    font-weight: 600;
    margin-bottom: 5px;
}

/* ============================================
   FILE UPLOAD
   ============================================ */
.file-upload-box {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.file-upload-box:hover,
.file-upload-box.dragover {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.04);
}

.file-upload-box i {
    font-size: 40px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.file-upload-box p { color: var(--text-muted); margin: 0; }

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.7);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.loading-overlay.show { display: flex; }

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   ALERTS (Toast)
   ============================================ */
.alert-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 350px;
    max-width: 500px;
}

.alert-custom {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 13px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-custom.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-custom.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-custom.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-custom.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 60px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.empty-state h5 {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.empty-state p {
    font-size: 13px;
    max-width: 400px;
    margin: 0 auto 15px;
}

/* ============================================
   CHARTS
   ============================================ */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ============================================
   PRINT STYLES
   ============================================ */
.no-print-col { }

@media print {
    body { background: #fff !important; }
    .sidebar, .top-navbar, .no-print-col, .page-header .actions, .filter-card { display: none !important; }
    .main-content { margin: 0 !important; padding: 0 !important; }
    .content-card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
}

.sidebar-overlay.show { display: block; }

@media (max-width: 1199.98px) {
    .sidebar {
        width: 260px;
        transform: translateX(100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .top-navbar {
        right: 0;
    }

    .navbar-toggle {
        display: block;
    }

    .main-content {
        margin-right: 0;
    }
}

@media (max-width: 767.98px) {
    .main-content {
        padding: 15px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stat-cards {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 12px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card .stat-value { font-size: 20px; }

    .welcome-banner {
        padding: 20px;
    }

    .welcome-banner h3 { font-size: 18px; }

    .data-table { font-size: 12px; }
    .data-table thead th, .data-table tbody td { padding: 8px 10px; }

    .navbar-search { display: none; }

    .notification-dropdown { width: 300px; left: -150px; }
}

@media (max-width: 575.98px) {
    .stat-cards {
        grid-template-columns: 1fr 1fr;
    }

    .navbar-user-info { display: none; }

    .modal-dialog { margin: 10px; }
}

/* ============================================
   KANBAN BOARD (Tasks)
   ============================================ */
.kanban-board {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 15px;
}

.kanban-column {
    min-width: 280px;
    flex: 1;
    background: var(--body-bg);
    border-radius: var(--radius-md);
    padding: 15px;
}

.kanban-column-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kanban-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
    cursor: grab;
    transition: var(--transition);
}

.kanban-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.kanban-card .card-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
}

.kanban-card .card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================
   LOGIN PAGE — Lawyer Desk Background + Bubbles
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(20, 30, 48, 0.65) 0%, rgba(36, 59, 85, 0.55) 50%, rgba(20, 30, 48, 0.75) 100%),
        url('https://wallpapers.com/images/hd/lawyer-desk-byyvgpisoi6lwdez.jpg') center center / cover no-repeat fixed;
}

.login-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 30%, rgba(218, 165, 32, 0.15), transparent 60%),
                radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.08), transparent 55%);
    pointer-events: none;
    z-index: 0;
}

/* Bubbles container */
.login-bubbles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.login-bubbles span {
    position: absolute;
    bottom: -120px;
    display: block;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.18), 0 0 20px rgba(218, 165, 32, 0.08);
    animation: loginBubbleRise linear infinite;
    opacity: 0;
}

@keyframes loginBubbleRise {
    0%   { transform: translateY(0) scale(0.8);        opacity: 0; }
    10%  { opacity: 0.9; }
    90%  { opacity: 0.7; }
    100% { transform: translateY(-110vh) scale(1.05);  opacity: 0; }
}

/* Individual bubble sizing/timing — soft, varied, gentle */
.login-bubbles span:nth-child(1)  { left:  6%; width: 36px;  height: 36px;  animation-duration: 22s; animation-delay: 0s; }
.login-bubbles span:nth-child(2)  { left: 14%; width: 18px;  height: 18px;  animation-duration: 18s; animation-delay: 3s; }
.login-bubbles span:nth-child(3)  { left: 22%; width: 50px;  height: 50px;  animation-duration: 28s; animation-delay: 1s; }
.login-bubbles span:nth-child(4)  { left: 30%; width: 24px;  height: 24px;  animation-duration: 20s; animation-delay: 5s; }
.login-bubbles span:nth-child(5)  { left: 40%; width: 14px;  height: 14px;  animation-duration: 16s; animation-delay: 2s; }
.login-bubbles span:nth-child(6)  { left: 48%; width: 60px;  height: 60px;  animation-duration: 32s; animation-delay: 6s; }
.login-bubbles span:nth-child(7)  { left: 56%; width: 22px;  height: 22px;  animation-duration: 19s; animation-delay: 8s; }
.login-bubbles span:nth-child(8)  { left: 64%; width: 40px;  height: 40px;  animation-duration: 25s; animation-delay: 0.5s; }
.login-bubbles span:nth-child(9)  { left: 72%; width: 18px;  height: 18px;  animation-duration: 17s; animation-delay: 4s; }
.login-bubbles span:nth-child(10) { left: 80%; width: 46px;  height: 46px;  animation-duration: 26s; animation-delay: 7s; }
.login-bubbles span:nth-child(11) { left: 88%; width: 28px;  height: 28px;  animation-duration: 21s; animation-delay: 2.5s; }
.login-bubbles span:nth-child(12) { left: 94%; width: 16px;  height: 16px;  animation-duration: 15s; animation-delay: 1.5s; }

/* Glassmorphism card */
.login-card {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55),
                inset 0 1px 0 rgba(255, 255, 255, 0.25);
    width: 100%;
    max-width: 440px;
    padding: 44px 38px;
    color: #fff;
    animation: loginCardIn 0.7s cubic-bezier(.2,.9,.3,1.2) both;
}

@keyframes loginCardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card .logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-card .logo i {
    color: #DAA520 !important;
    filter: drop-shadow(0 3px 10px rgba(218, 165, 32, 0.55));
    animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

.login-card .logo h2 {
    font-weight: 800;
    color: #fff;
    margin: 14px 0 6px;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.login-card .logo p {
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    margin: 0;
}

.login-card .form-label {
    color: rgba(255, 255, 255, 0.92);
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
}

.login-card .form-control,
.login-card .input-group-text {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #fff;
    padding: 11px 15px;
    font-size: 14px;
    transition: all 0.25s ease;
}

.login-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

.login-card .form-control:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: #DAA520;
    box-shadow: 0 0 0 0.2rem rgba(218, 165, 32, 0.25);
    color: #fff;
}

.login-card .input-group-text {
    color: #DAA520;
}

.login-card .form-check-label {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
}

.login-card .form-check-input {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

.login-card .form-check-input:checked {
    background-color: #DAA520;
    border-color: #DAA520;
}

.login-card .btn-gold,
.login-card button[type="submit"] {
    width: 100%;
    padding: 13px;
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(135deg, #DAA520 0%, #B8860B 100%);
    border: none;
    color: #fff;
    border-radius: 10px;
    letter-spacing: 0.4px;
    box-shadow: 0 8px 20px rgba(218, 165, 32, 0.35);
    transition: all 0.25s ease;
}

.login-card .btn-gold:hover,
.login-card button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(218, 165, 32, 0.5);
    filter: brightness(1.08);
}

.login-card .alert {
    background: rgba(220, 53, 69, 0.18);
    border: 1px solid rgba(220, 53, 69, 0.45);
    color: #ffdede;
    border-radius: 10px;
}

.login-footer {
    text-align: center;
    margin-top: 22px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.login-footer p {
    color: rgba(255, 255, 255, 0.7) !important;
}

.login-footer a { font-weight: 600; color: #DAA520; }

/* 2FA screen tweaks */
.login-card .text-muted,
.login-card .form-text {
    color: rgba(255, 255, 255, 0.7) !important;
}
.login-card code {
    background: rgba(255, 255, 255, 0.15);
    color: #DAA520;
    padding: 1px 6px;
    border-radius: 4px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .login-bubbles span,
    .login-card .logo i,
    .login-card { animation: none; }
}

@media (max-width: 480px) {
    .login-card { padding: 30px 22px; }
}

/* ============================================
   CLIENT PORTAL (separate layout)
   ============================================ */
.portal-navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 30px;
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.portal-content {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

/* ============================================
   MISC UTILITIES
   ============================================ */
.text-primary-custom { color: var(--primary-dark) !important; }
.bg-primary-custom { background: var(--primary) !important; }
.border-primary-custom { border-color: var(--primary) !important; }

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }

.cursor-pointer { cursor: pointer; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

/* ============================================
   RAINBOW ANIMATED TOP BAR
   ============================================ */
.rainbow-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--rainbow-height);
    z-index: 10000;
    background: linear-gradient(
        90deg,
        #e74c3c 0%, #e67e22 14%, #f1c40f 28%,
        #2ecc71 42%, #3498db 56%, #9b59b6 70%,
        #e91e63 84%, #e74c3c 100%
    );
    background-size: 200% 100%;
    animation: rainbowSlide 3s linear infinite;
}

@keyframes rainbowSlide {
    0%   { background-position: 200% 0; }
    100% { background-position: 0% 0; }
}

/* Push fixed elements below rainbow bar */
.sidebar {
    top: var(--rainbow-height) !important;
    height: calc(100vh - var(--rainbow-height)) !important;
}

.top-navbar {
    top: var(--rainbow-height) !important;
}

.main-content {
    margin-top: calc(var(--navbar-height) + var(--rainbow-height)) !important;
}

/* ============================================
   ENHANCED SIDEBAR BRAND
   ============================================ */
.sidebar-brand {
    background: linear-gradient(160deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%) !important;
    padding: 22px 18px !important;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.sidebar-brand::before {
    content: '';
    position: absolute;
    top: -25px; right: -25px;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: rgba(218,165,32,0.12);
    pointer-events: none;
}

.sidebar-brand::after {
    content: '';
    position: absolute;
    bottom: -35px; left: -15px;
    width: 110px; height: 110px;
    border-radius: 50%;
    background: rgba(218,165,32,0.07);
    pointer-events: none;
}

.brand-icon {
    position: relative;
    z-index: 1;
    width: 54px; height: 54px;
    border-radius: 14px;
    background: rgba(218,165,32,0.18);
    border: 1.5px solid rgba(218,165,32,0.4);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 10px;
    font-size: 24px;
    color: #DAA520;
    box-shadow: 0 4px 15px rgba(218,165,32,0.2);
}

.brand-icon img {
    max-width: 34px; max-height: 34px;
    object-fit: contain;
}

.sidebar-brand h4 {
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    margin: 0 0 5px !important;
    position: relative; z-index: 1;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.sidebar-brand small {
    color: rgba(255,255,255,0.5) !important;
    font-size: 10px !important;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 2px 10px;
    display: inline-block;
    position: relative; z-index: 1;
    letter-spacing: 0.5px;
}

/* ============================================
   SIDEBAR OVERALL IMPROVEMENTS
   ============================================ */
.sidebar {
    background: #ffffff !important;
    border-left: 1px solid rgba(0,0,0,0.06) !important;
    box-shadow: -3px 0 25px rgba(0,0,0,0.06) !important;
}

.sidebar-nav { padding: 8px 0 20px !important; }

.sidebar-section-title {
    font-size: 10.5px !important;
    letter-spacing: 0.8px !important;
    padding: 10px 20px 5px !important;
    display: flex !important;
    align-items: center;
    gap: 6px;
}

.sidebar-section-title::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link {
    margin: 1px 10px !important;
    border-radius: 10px !important;
    padding: 8px 12px !important;
    border-right: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    position: relative;
}

/* Colored accent bar on the right side */
.sidebar-link::after {
    content: '';
    position: absolute;
    right: -10px; top: 22%; bottom: 22%;
    width: 3px;
    border-radius: 3px 0 0 3px;
    background: transparent;
    transition: var(--transition);
}

.sidebar-link.active::after,
.sidebar-link:hover::after {
    background: var(--sect-color, var(--primary));
}

/* Icon box styling */
.sidebar-link i {
    width: 30px !important;
    height: 30px !important;
    border-radius: 8px !important;
    background: rgba(var(--primary-rgb), 0.1) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 13px !important;
    flex-shrink: 0;
    opacity: 1 !important;
    transition: var(--transition);
    text-align: center !important;
}

.sidebar-footer {
    background: rgba(0,0,0,0.02);
    border-top: 1px solid rgba(0,0,0,0.05);
    font-size: 11px;
    color: rgba(0,0,0,0.3);
}

/* ============================================
   SIDEBAR SECTION COLORS
   ============================================ */
.sidebar-section[data-section="main"]         { --sect-color: #DAA520; --sect-rgb: 218,165,32; }
.sidebar-section[data-section="cases"]        { --sect-color: #e74c3c; --sect-rgb: 231,76,60; }
.sidebar-section[data-section="clients"]      { --sect-color: #27ae60; --sect-rgb: 39,174,96; }
.sidebar-section[data-section="sessions_cal"] { --sect-color: #2980b9; --sect-rgb: 41,128,185; }
.sidebar-section[data-section="documents"]    { --sect-color: #8e44ad; --sect-rgb: 142,68,173; }
.sidebar-section[data-section="tasks"]        { --sect-color: #e67e22; --sect-rgb: 230,126,34; }
.sidebar-section[data-section="finance"]      { --sect-color: #16a085; --sect-rgb: 22,160,133; }
.sidebar-section[data-section="reports"]      { --sect-color: #c0392b; --sect-rgb: 192,57,43; }
.sidebar-section[data-section="admin"]        { --sect-color: #546e7a; --sect-rgb: 84,110,122; }

/* Section title gets the section color */
.sidebar-section[data-section] .sidebar-section-title {
    color: var(--sect-color) !important;
}

/* Icon background and color per section */
.sidebar-section[data-section] .sidebar-link i {
    color: var(--sect-color) !important;
    background: rgba(var(--sect-rgb), 0.1) !important;
}

/* Hover state */
.sidebar-section[data-section] .sidebar-link:hover {
    background: rgba(var(--sect-rgb), 0.08) !important;
    color: var(--sect-color) !important;
}

.sidebar-section[data-section] .sidebar-link:hover i {
    background: rgba(var(--sect-rgb), 0.18) !important;
}

.sidebar-section[data-section] .sidebar-link:hover::after {
    background: var(--sect-color) !important;
}

/* Active state */
.sidebar-section[data-section] .sidebar-link.active {
    background: rgba(var(--sect-rgb), 0.1) !important;
    color: var(--sect-color) !important;
    font-weight: 700 !important;
}

.sidebar-section[data-section] .sidebar-link.active i {
    background: rgba(var(--sect-rgb), 0.2) !important;
    box-shadow: 0 2px 8px rgba(var(--sect-rgb), 0.25);
}

.sidebar-section[data-section] .sidebar-link.active::after {
    background: var(--sect-color) !important;
}

/* ============================================
   ENHANCED TOP NAVBAR
   ============================================ */
.top-navbar {
    background: rgba(255,255,255,0.97) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
    box-shadow: 0 2px 20px rgba(0,0,0,0.05) !important;
}

.top-navbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: var(--sidebar-width);
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(var(--primary-rgb),0.5) 0%, transparent 80%);
    pointer-events: none;
}

.navbar-action-btn {
    border-radius: 10px !important;
    width: 38px !important;
    height: 38px !important;
}

.navbar-user-avatar {
    border-radius: 10px !important;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

/* ============================================
   APP STATUS BAR (compact system footer)
   ============================================ */
.app-statusbar {
    margin: 30px -25px -25px -25px;   /* flush with .main-content edges */
    background: #1a1a2e;
    color: rgba(255,255,255,0.7);
    border-top: 1px solid rgba(218,165,32,0.25);
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    flex-wrap: wrap;
    position: relative;
}
.app-statusbar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #DAA520, transparent);
    opacity: 0.6;
}
.statusbar-left, .statusbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.statusbar-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.65);
    white-space: nowrap;
}
.statusbar-item i { color: #DAA520; font-size: 11px; }
.statusbar-sep {
    width: 1px;
    height: 14px;
    background: rgba(255,255,255,0.12);
    display: inline-block;
}
.statusbar-copy { color: rgba(255,255,255,0.4); font-size: 11px; }

.status-ok { color: #2ecc71; font-weight: 600; }
.status-ok .status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #2ecc71;
    box-shadow: 0 0 6px rgba(46,204,113,0.6);
    animation: pulseDot 2s ease-in-out infinite;
    display: inline-block;
}
@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.5; transform: scale(0.7); }
}

/* ============================================
   NAVBAR CLOCK
   ============================================ */
.navbar-clock {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(218,165,32,0.08), rgba(218,165,32,0.02));
    border: 1px solid rgba(218,165,32,0.2);
    border-radius: 10px;
    color: var(--text-dark, #1a1a2e);
    transition: all 0.25s ease;
    cursor: default;
    user-select: none;
}
.navbar-clock:hover {
    border-color: rgba(218,165,32,0.45);
    background: linear-gradient(135deg, rgba(218,165,32,0.14), rgba(218,165,32,0.05));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(218,165,32,0.15);
}
.navbar-clock > i {
    color: #DAA520;
    font-size: 18px;
}
.navbar-clock .clock-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}
.navbar-clock .clock-time {
    font-weight: 700;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    color: #1a1a2e;
    font-family: 'Tajawal', 'Segoe UI', monospace;
}
.navbar-clock .clock-date {
    font-size: 10.5px;
    color: rgba(26,26,46,0.55);
    margin-top: 2px;
}

/* ============================================
   MOBILE RESPONSIVE — STATUS BAR / CLOCK
   ============================================ */
@media (max-width: 1199.98px) {
    .top-navbar::after { right: 0; }
}
@media (max-width: 767.98px) {
    .app-statusbar {
        padding: 7px 12px;
        font-size: 11px;
        gap: 8px;
    }
    .statusbar-left, .statusbar-right { gap: 8px; }
}
