/* Lawyer Case Manager - Self-contained CSS
   Adapted from colour.html + modern sleek design */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --theme-color: #0077ea;
    --theme-color-dark: #005bb5;
    --theme-color-light: #e6f1ff;
    --bg-gradient: radial-gradient(circle at top, #0077ea, #1f4f96, #1b2949, #000);
    --text-light: #ffffff;
    --text-dark: #1a1a2e;
    --card-bg: rgba(255,255,255,0.97);
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Segoe UI", system-ui, sans-serif;
}

html {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100%;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
    background: #f0f4f8;
    -webkit-font-smoothing: antialiased;
}

/* ========== Top Bar ========== */
.top-bar {
    background: linear-gradient(135deg, var(--theme-color), var(--theme-color-dark));
    color: var(--text-light);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.top-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    text-decoration: none;
    color: inherit;
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.5px;
}

.brand-multi {
    background: linear-gradient(90deg, #fff, #a5d8ff, #fff, #ffd6a5);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 6s ease infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.nav-right a {
    color: rgba(255,255,255,0.92);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.nav-right a:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.btn-primary, .nav-right .btn-primary {
    background: #fff;
    color: #111111 !important;
    font-weight: 700;
    padding: 0.4rem 1rem;
    border-radius: 8px;
}

.btn-primary:hover, .nav-right .btn-primary:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
}

.btn-outline {
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 8px;
    color: #ffffff;
}

.btn-outline:hover {
    background: #ef4444 !important;
    border-color: #ef4444;
    color: #ffffff !important;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

/* ========== Layout ========== */
.container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.main-content {
    padding: 1.75rem 0 3rem;
    min-height: calc(100vh - 140px);
}

/* ========== Cards & Boxes ========== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--theme-color-dark);
}

/* ========== Typography ========== */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-dark);
}

h1 { font-size: 1.85rem; margin-bottom: 0.75rem; }
h2 { font-size: 1.45rem; margin-bottom: 0.6rem; }
h3 { font-size: 1.2rem; }

.page-title {
    background: linear-gradient(90deg, var(--theme-color), #6366f1, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.35rem;
}

.page-desc {
    color: #64748b;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 1.1rem;
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
    color: #334155;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="tel"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--theme-color);
    box-shadow: 0 0 0 3px rgba(0,119,234,0.15);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.35rem;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    color: #111111;
    transition: transform 0.15s, box-shadow 0.2s, background 0.2s, color 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    color: #111111 !important;
    border: 1px solid #cbd5e1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.btn-primary:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
    border-color: #dc2626;
    box-shadow: 0 4px 14px rgba(239,68,68,0.4);
}

.btn-secondary {
    background: #e2e8f0;
    color: #111111 !important;
}

.btn-secondary:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
}

.btn-danger {
    background: var(--danger);
    color: #ffffff !important;
}

.btn-danger:hover {
    background: #b91c1c !important;
    color: #ffffff !important;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    color: #111111;
}

.btn-block {
    width: 100%;
}

/* Ensure all button text is highly visible */
button.btn,
a.btn {
    color: #111111;
}

button.btn:hover,
a.btn:hover {
    color: #ffffff !important;
}

/* ========== Alerts ========== */
.alert {
    padding: 0.9rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.925rem;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ========== Tables ========== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--theme-color-light);
    font-weight: 600;
    color: var(--theme-color-dark);
    white-space: nowrap;
}

tr:hover td {
    background: #f8fafc;
}

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

/* ========== Calendar ========== */
.calendar-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.calendar-nav h2 {
    font-size: 1.35rem;
    background: linear-gradient(90deg, var(--theme-color), #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-day-name {
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #64748b;
    padding: 0.5rem 0;
    text-transform: uppercase;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: default;
    transition: all 0.2s;
    border: 2px solid transparent;
    background: #f8fafc;
    color: #334155;
    text-decoration: none;
}

.cal-day.empty {
    background: transparent;
    cursor: default;
}

.cal-day.today {
    border-color: var(--theme-color);
    font-weight: 700;
}

.cal-day.has-case {
    background: #ef4444 !important;
    color: #fff !important;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(239,68,68,0.4);
}

.cal-day.has-case:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(239,68,68,0.5);
}

.cal-day:not(.empty):not(.has-case):hover {
    background: var(--theme-color-light);
}

/* ========== Case list popup / modal ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: var(--radius);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
}

/* ========== Dashboard widgets ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--theme-color), var(--theme-color-dark));
    color: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card .number {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}

.stat-card .label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.case-item {
    border-left: 4px solid var(--theme-color);
    background: #f8fafc;
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 0.75rem;
    transition: background 0.2s;
}

.case-item:hover {
    background: #f1f5f9;
}

.case-item h4 {
    margin-bottom: 0.25rem;
    font-size: 1.05rem;
}

.case-meta {
    font-size: 0.85rem;
    color: #64748b;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-green { background: #d1fae5; color: #047857; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }

/* ========== Footer ========== */
.site-footer {
    background: #1e293b;
    color: #94a3b8;
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.875rem;
}

.site-footer .version {
    margin-top: 0.35rem;
    opacity: 0.7;
    font-size: 0.8rem;
}

/* ========== Auth pages ========== */
.auth-wrapper {
    max-width: 420px;
    margin: 2rem auto;
}

.auth-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-switch {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #64748b;
}

.auth-switch a {
    color: var(--theme-color);
    font-weight: 600;
    text-decoration: none;
}

/* ========== Admin ========== */
.admin-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.5rem;
}

.admin-sidebar {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    height: fit-content;
}

.admin-sidebar a {
    display: block;
    padding: 0.6rem 0.9rem;
    color: #334155;
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    background: var(--theme-color-light);
    color: var(--theme-color-dark);
}

/* ========== Color picker preview ========== */
.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #cbd5e1;
    display: inline-block;
    vertical-align: middle;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .mobile-toggle {
        display: block;
    }

    .nav-right {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--theme-color-dark);
        flex-direction: column;
        padding: 1rem;
        gap: 0.5rem;
    }

    .nav-right.open {
        display: flex;
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }

    .calendar-grid {
        gap: 2px;
    }

    .cal-day {
        font-size: 0.8rem;
        border-radius: 6px;
    }

    h1 { font-size: 1.5rem; }
}

/* ========== Utility ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* Lower third style support from colour.html (optional) */
body.lower-third {
    background: #008000 !important;
}