/* ============================================================
   Gauhati High Court Kohima Bench — Judicial Admin Portal
   Design Philosophy: Minimal • Institutional • Elegant • Quiet • Professional
   ============================================================ */

/* ── Reset & Custom Properties ───────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Pure dark charcoal / black surfaces */
    --bg-body:          #0a0b0d;
    --bg-surface:       #101114;
    --bg-card:          #14161a;
    --bg-card-alt:      #181a1f;
    --bg-input:         #0d0e11;
    --bg-input-focus:   #111317;
    --bg-hover:         #1a1d23;

    /* Borders & Dividers */
    --border-subtle:    #1b1d22;
    --border:           #242730;
    --border-hover:     #343844;
    --border-focus:     #bfa365;

    /* Understated, Muted Gold Accents */
    --gold:             #c2a766;
    --gold-hover:       #b39755;
    --gold-muted:       #8a7543;
    --gold-subtle:      rgba(194, 167, 102, 0.08);
    --gold-border:      rgba(194, 167, 102, 0.22);

    /* Off-white & Neutral Text */
    --text-primary:     #ededed;
    --text-secondary:   #969aa4;
    --text-muted:       #5d616c;
    --text-inverse:     #0a0b0d;

    /* Subtle Status Tones */
    --success:          #3db86e;
    --success-bg:       rgba(61, 184, 110, 0.08);
    --success-border:   rgba(61, 184, 110, 0.22);
    --danger:           #cf5656;
    --danger-bg:        rgba(207, 86, 86, 0.08);
    --danger-border:    rgba(207, 86, 86, 0.22);
    --warning:          #dca044;
    --warning-bg:       rgba(220, 160, 68, 0.08);

    /* Geometry */
    --radius-sm:        4px;
    --radius:           6px;
    --radius-md:        8px;

    /* Shadows (Subtle, non-diffuse) */
    --shadow-subtle:    0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-card:      0 2px 8px rgba(0, 0, 0, 0.45);
    --shadow-modal:     0 8px 32px rgba(0, 0, 0, 0.65);

    /* Typography & Speed */
    --font:             'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono:        ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --transition:       color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background-color: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.55;
}

/* ── Understated Scrollbar ───────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ── Minimal Institutional Header ───────────────────────── */
.site-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 1.75rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    display: block;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.brand-sub {
    font-size: 0.72rem;
    color: var(--gold);
    letter-spacing: 0.02em;
    font-weight: 400;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-link {
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid transparent;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    border-color: var(--border-subtle);
}

.nav-link.active {
    color: var(--gold);
    background: var(--gold-subtle);
    border-color: var(--gold-border);
}

.nav-logout {
    margin-left: 0.75rem;
    color: var(--text-muted);
}

.nav-logout:hover {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: var(--danger-border);
}

/* ── Main Layout ─────────────────────────────────────────── */
.main-content {
    flex: 1;
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
    padding: 2.25rem 1.75rem 3.5rem;
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.page-title {
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.page-subtitle {
    font-size: 0.825rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ── Quiet Institutional Summary Bar ─────────────────────── */
.stats-bar {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 0.85rem 1.35rem;
    margin-bottom: 1.5rem;
    gap: 1.5rem;
}

.stat-item {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-value.stat-muted {
    font-size: 0.825rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.stat-divider {
    width: 1px;
    height: 16px;
    background: var(--border-subtle);
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-live {
    color: var(--success);
}
.status-live .status-dot {
    background: var(--success);
}

.status-offline {
    color: var(--text-muted);
}
.status-offline .status-dot {
    background: var(--text-muted);
}

/* ── Minimalist Cards ────────────────────────────────────── */
.table-card,
.form-card,
.publish-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
}

/* ── Directory Table & Toolbar ───────────────────────────── */
.table-toolbar {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.table-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.table-search input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.8rem;
    font-size: 0.8rem;
    width: 260px;
    transition: var(--transition);
}

.table-search input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
}

.table-search input::placeholder {
    color: var(--text-muted);
}

.table-wrap {
    overflow-x: auto;
}

.judges-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.judges-table th {
    padding: 0.75rem 1.25rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card-alt);
    white-space: nowrap;
}

.judges-table td {
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
}

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

.judges-table tbody tr:hover {
    background-color: var(--bg-hover);
}

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

/* Portrait Presentation */
.judge-portrait-cell {
    width: 56px;
    padding-right: 0.5rem !important;
}

.judge-portrait-thumb {
    width: 42px;
    height: 52px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: block;
    background: var(--bg-surface);
}

.portrait-placeholder {
    width: 42px;
    height: 52px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.judge-name-cell .name {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.35;
}

.judge-name-cell .judge-id {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.73rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.position-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
}

.table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}

/* ── Production Publish Panel ────────────────────────────── */
.publish-panel {
    margin-top: 1.75rem;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.pub-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.pub-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.json-link {
    color: var(--gold);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    border-bottom: 1px dotted var(--gold-muted);
    transition: var(--transition);
}

.json-link:hover {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

/* ── Minimalist Buttons ──────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0.95rem;
    font-size: 0.825rem;
    font-weight: 500;
    font-family: var(--font);
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary Action: Muted Gold Accent */
.btn-primary {
    background: var(--gold);
    color: var(--text-inverse);
    border-color: var(--gold);
    font-weight: 600;
}

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

/* Secondary Action: Quiet Charcoal with Subtle Border */
.btn-secondary {
    background: var(--bg-card-alt);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* Ghost / Understated */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Danger Button */
.btn-danger {
    color: var(--danger);
    background: transparent;
    border-color: transparent;
}

.btn-danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger-border);
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
}

.btn-lg {
    padding: 0.65rem 1.25rem;
    font-size: 0.875rem;
}

/* ── Clean Forms ─────────────────────────────────────────── */
.form-card {
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-subtle);
}

.form-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.section-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold-muted);
    margin-bottom: 1.25rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem 1.5rem;
}

.form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.field-full {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.45rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.required-star {
    color: var(--gold);
    font-size: 0.8rem;
}

.optional-tag {
    font-size: 0.68rem;
    font-weight: 400;
    color: var(--text-muted);
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.8rem;
    font-size: 0.85rem;
    font-family: var(--font);
    transition: var(--transition);
    width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
}

.form-group input[readonly] {
    background: var(--bg-card-alt);
    border-color: var(--border-subtle);
    color: var(--text-secondary);
    cursor: default;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.field-hint {
    font-size: 0.73rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    line-height: 1.4;
}

.field-hint code {
    background: var(--bg-surface);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    border: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.field-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 0.35rem;
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

/* ── Portrait Upload Presentation ────────────────────────── */
.portrait-upload-area {
    display: flex;
    align-items: flex-start;
    gap: 1.75rem;
}

.portrait-preview-wrap {
    width: 120px;
    height: 155px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portrait-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.portrait-placeholder-large {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: var(--bg-input);
}

.portrait-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    align-items: flex-start;
}

.upload-guide {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.upload-guide strong {
    color: var(--text-primary);
}

.file-input-label {
    cursor: pointer;
}

input[type="file"] {
    display: none;
}

.portrait-filename {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.remove-portrait-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--danger);
    cursor: pointer;
    margin-top: 0.4rem;
}

.remove-portrait-toggle input[type="checkbox"] {
    accent-color: var(--danger);
}

/* ── Minimalist Login Page ───────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: var(--bg-body);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 2.5rem 2.25rem;
    box-shadow: var(--shadow-card);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    height: 68px;
    width: auto;
    margin: 0 auto 1.25rem;
    display: block;
}

.login-court-name {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.login-bench {
    font-size: 0.75rem;
    color: var(--gold);
    margin-top: 0.25rem;
    letter-spacing: 0.03em;
}

.login-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger);
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.login-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.login-form-group label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.login-form-group input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    font-size: 0.875rem;
    font-family: var(--font);
    transition: var(--transition);
}

.login-form-group input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
}

.login-submit {
    margin-top: 0.5rem;
    width: 100%;
}

/* ── Flash Messages (Minimal) ────────────────────────────── */
.flash {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.825rem;
    border: 1px solid transparent;
}

.flash-success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success);
}

.flash-error {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
}

.flash-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: var(--warning-bg);
}

.flash-icon {
    font-weight: 600;
}

.flash-text {
    flex: 1;
}

.flash-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.6;
}

.flash-close:hover {
    opacity: 1;
}

/* ── Modal (Understated Scrim & Box) ─────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 100;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 440px;
    padding: 1.75rem;
    box-shadow: var(--shadow-modal);
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.modal-body {
    font-size: 0.825rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
    padding: 3.5rem 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.empty-state-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.empty-state-body {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* ── Minimalist Footer ───────────────────────────────────── */
.site-footer {
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    padding: 1.25rem 1.75rem;
    margin-top: auto;
}

.footer-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer-version {
    font-family: var(--font-mono);
}

/* ── Responsive Refinements ──────────────────────────────── */
@media (max-width: 900px) {
    .form-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .publish-panel {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .header-inner {
        padding: 0 1rem;
    }
    .brand-sub {
        display: none;
    }
    .main-content {
        padding: 1.5rem 1rem 2.5rem;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .stats-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .stat-divider {
        display: none;
    }
    .form-grid,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }
    .portrait-upload-area {
        flex-direction: column;
    }
    .table-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .table-search input {
        width: 100%;
    }
}
