/* 
   Executive Legal SaaS Theme
   Branded for Advocate Aakash Arora & Associates
*/

:root {
    --primary: #1e293b;        /* Slate / Deep Navy */
    --primary-dark: #0f172a;
    --accent: #b45309;         /* Executive Gold / Amber */
    --accent-light: #fef3c7;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-width: 260px;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

/* Layout */
#app-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-dark);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-info-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-close-btn {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cbd5e1;
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Sidebar Backdrop on Mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #d97706, #b45309);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: #fff;
    box-shadow: 0 2px 8px rgba(180, 83, 9, 0.4);
}

.brand-text h2 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #f8fafc;
}

.brand-text p {
    font-size: 0.72rem;
    color: #94a3b8;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 1.25rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-menu li a:hover, .sidebar-menu li.active a {
    background-color: rgba(255, 255, 255, 0.07);
    color: #fff;
    border-left-color: #f59e0b;
}

.sidebar-menu li a i {
    width: 20px;
    font-size: 1.1rem;
    text-align: center;
}

.sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info h4 {
    font-size: 0.85rem;
    color: #f8fafc;
}

.user-info p {
    font-size: 0.72rem;
    color: #94a3b8;
}

.btn-logout {
    color: #f87171;
    text-decoration: none;
    font-size: 1.1rem;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Top Header */
.top-header {
    background: var(--bg-card);
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.mobile-toggle-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--primary);
    padding: 6px 10px;
    border-radius: 6px;
    line-height: 1;
    transition: background 0.2s;
}

.mobile-toggle-btn:hover {
    background: var(--bg-body);
}

.header-search {
    position: relative;
    width: 100%;
    max-width: 380px;
}

.header-search input {
    width: 100%;
    padding: 0.55rem 1rem 0.55rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background-color: var(--bg-body);
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s;
}

.header-search input:focus {
    background-color: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

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

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.notif-bell-btn {
    position: relative;
    color: var(--primary);
    font-size: 1.15rem;
    padding: 6px 10px;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-bell-btn:hover {
    background: var(--bg-body);
}

.notif-badge {
    position: absolute;
    top: 0;
    right: 2px;
    background: var(--danger);
    color: #fff;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.quick-btn {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: #fff;
    border: none;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.quick-btn:hover {
    opacity: 0.9;
}

.quick-btn-case {
    background: linear-gradient(135deg, #d97706, #b45309);
}

/* Container */
.content-body {
    padding: 2rem;
    flex: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

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

.page-title p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

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

.metric-card {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-data h3 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
}

.metric-data p {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.icon-blue { background: #e0f2fe; color: #0284c7; }
.icon-amber { background: #fef3c7; color: #d97706; }
.icon-green { background: #d1fae5; color: #059669; }
.icon-red { background: #fee2e2; color: #dc2626; }

/* Dashboard Columns */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 1.25rem;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0.5rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
    min-width: 620px;
}

.table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

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

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

/* Status Badges */
.badge {
    padding: 0.25rem 0.65rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #e0f2fe; color: #075985; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* Timeline */
.timeline {
    position: relative;
    padding-left: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 5px;
    bottom: 5px;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.25rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -19px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #fff;
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.timeline-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: 2px;
}

.timeline-desc {
    font-size: 0.82rem;
    color: #475569;
    margin-top: 2px;
}

/* Buttons & Inputs */
.btn {
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #92400e; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.btn-outline { border: 1px solid var(--border-color); background: #fff; color: var(--text-main); }
.btn-outline:hover { background: #f8fafc; }

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.35rem;
}

.form-control {
    width: 100%;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.88rem;
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: var(--radius);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

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

.modal-header h3 {
    font-size: 1.1rem;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Alerts */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Comprehensive Responsive Design System */
@media (max-width: 1200px) {
    .content-body {
        padding: 1.5rem;
    }
    .metrics-grid {
        gap: 1rem;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1050;
        box-shadow: none;
        width: 280px;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 6px 0 30px rgba(0, 0, 0, 0.45);
    }
    .sidebar-close-btn {
        display: flex;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        min-width: 100%;
    }
    .mobile-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .header-search {
        max-width: 260px;
    }
}

@media (max-width: 768px) {
    .top-header {
        padding: 0 0.85rem;
        height: 60px;
        gap: 8px;
    }
    .header-left {
        gap: 8px;
    }
    .header-search {
        max-width: 180px;
    }
    .header-search input {
        padding: 0.45rem 0.75rem 0.45rem 2rem;
        font-size: 0.8rem;
    }
    .header-search i {
        left: 9px;
        font-size: 0.8rem;
    }
    .header-actions {
        gap: 6px;
    }
    .quick-btn {
        padding: 0.45rem 0.65rem;
        font-size: 0.82rem;
        border-radius: 8px;
    }
    .quick-btn-label {
        display: none; /* Hide button text on mobile to guarantee clean 1-line header */
    }
    .content-body {
        padding: 1rem 0.75rem;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 1.25rem;
    }
    .page-header > div:last-child {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
    .page-title h1 {
        font-size: 1.25rem;
    }
    .page-title p {
        font-size: 0.78rem;
    }
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }
    .metric-card {
        padding: 1rem 0.85rem;
    }
    .metric-data h3 {
        font-size: 1.35rem;
    }
    .metric-icon {
        width: 40px;
        height: 40px;
        font-size: 1.15rem;
    }
    .card-header {
        padding: 0.85rem 1rem;
        flex-wrap: wrap;
        gap: 8px;
    }
    .card-body {
        padding: 1rem 0.85rem;
    }
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .table th, .table td {
        padding: 0.65rem 0.75rem;
        font-size: 0.82rem;
    }
    .modal-content {
        max-width: 95%;
        margin: 0.5rem;
        max-height: 92vh;
        border-radius: 12px;
    }
    .modal-header {
        padding: 0.85rem 1rem;
    }
    .modal-body {
        padding: 1rem;
    }
    .modal-footer {
        padding: 0.85rem 1rem;
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    .header-search {
        max-width: 125px;
    }
    .header-search input {
        font-size: 0.75rem;
        padding-left: 1.75rem;
    }
    .header-search i {
        left: 7px;
        font-size: 0.72rem;
    }
    .top-header {
        padding: 0 0.5rem;
    }
    .content-body {
        padding: 0.75rem 0.5rem;
    }
    .role-selector {
        grid-template-columns: 1fr !important;
    }
}

/* Professional Print Rules for Court Files & Invoices */
@media print {
    .sidebar, .top-header, .btn, .modal, .sidebar-backdrop, #mobile-menu-toggle {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .content-body {
        padding: 0 !important;
    }
    body {
        background: #fff !important;
        color: #000 !important;
    }
}
