/* ============================================
   Job Hunter - Court Compliance Tracker
   Mobile-first responsive dark theme
   ============================================ */

:root {
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-input: #16213e;
    --bg-hover: #1f2b47;
    --accent: #e94560;
    --accent-hover: #ff6b81;
    --accent-glow: rgba(233, 69, 96, 0.2);
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --text: #eaeaea;
    --text-dim: #8892a4;
    --text-muted: #555e70;
    --border: #2a2a4a;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --transition: all 0.2s ease;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* ---- MOBILE TOP BAR ---- */

#topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    z-index: 200;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-title {
    font-weight: 700;
    font-size: 17px;
}

.topbar-deadline {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--warning);
}

.topbar-deadline.urgent {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(231, 76, 60, 0.1);
}

/* ---- SIDEBAR (desktop) ---- */

#sidebar {
    width: 240px;
    min-height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    color: white;
    flex-shrink: 0;
}

.logo-text {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.5px;
}

.nav-links {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 4px;
}

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

.nav-link.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 600;
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.deadline-badge {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
    font-size: 13px;
    color: var(--text-dim);
}

.deadline-badge span {
    font-weight: 700;
    color: var(--warning);
    font-size: 18px;
}

.deadline-badge.urgent {
    border-color: var(--danger);
    background: rgba(231, 76, 60, 0.1);
}

.deadline-badge.urgent span {
    color: var(--danger);
}

/* ---- BOTTOM TAB BAR (mobile) ---- */

#bottombar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 200;
    justify-content: space-around;
    align-items: center;
}

.tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    flex: 1;
    transition: color 0.15s;
    min-width: 0;
}

.tab-btn .tab-icon {
    font-size: 20px;
    line-height: 1;
}

.tab-btn.active {
    color: var(--accent);
}

/* ---- MORE MENU (mobile overlay) ---- */

.more-menu {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 300;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: calc(80px + var(--safe-bottom));
}

.more-menu.open {
    display: flex;
}

.more-menu-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 24px;
    width: 100%;
    max-width: 400px;
}

.more-menu-content h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-dim);
}

.more-link {
    display: block;
    padding: 14px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    transition: background 0.15s;
}

.more-link:hover, .more-link:active {
    background: var(--bg-hover);
}

/* ---- MAIN CONTENT ---- */

#main-content {
    margin-left: 240px;
    flex: 1;
    padding: 32px 40px;
    max-width: 1200px;
    min-height: 100vh;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- PAGE HEADER ---- */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-dim);
    font-size: 14px;
    margin-top: 2px;
}

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

.filter-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    margin-top: 8px;
}

.section-header h2 {
    font-size: 17px;
    font-weight: 600;
}

/* ---- STAT CARDS ---- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 12px;
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }

.stat-label {
    font-size: 11px;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---- TABLES (desktop) ---- */

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-input);
}

th {
    text-align: left;
    padding: 12px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px 14px;
    font-size: 14px;
    border-bottom: 1px solid rgba(42, 42, 74, 0.5);
}

tr:hover td {
    background: var(--bg-hover);
}

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

/* ---- MOBILE CARD LIST ---- */

.card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.data-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.data-card-title {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.3;
}

.data-card-subtitle {
    color: var(--text-dim);
    font-size: 13px;
    margin-top: 2px;
}

.data-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-dim);
}

.data-card-meta span {
    background: var(--bg-input);
    padding: 3px 8px;
    border-radius: 4px;
}

.data-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
}

/* ---- FORMS ---- */

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 700px;
}

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

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.form-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.input-field,
.input-select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
    -webkit-appearance: none;
}

.input-field:focus,
.input-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea.input-field {
    resize: vertical;
    min-height: 60px;
}

.input-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%238892a4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* ---- BUTTONS ---- */

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover, .btn-primary:active {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

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

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 16px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
    flex: 1;
}

.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }

/* ---- STATUS BADGES ---- */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-applied { background: rgba(52, 152, 219, 0.15); color: #3498db; }
.badge-interviewing { background: rgba(243, 156, 18, 0.15); color: #f39c12; }
.badge-offered { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.badge-rejected { background: rgba(231, 76, 60, 0.15); color: #e74c3c; }
.badge-no-response { background: rgba(136, 146, 164, 0.15); color: #8892a4; }
.badge-scheduled { background: rgba(52, 152, 219, 0.15); color: #3498db; }
.badge-completed { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.badge-pending { background: rgba(243, 156, 18, 0.15); color: #f39c12; }
.badge-accepted { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.badge-declined { background: rgba(231, 76, 60, 0.15); color: #e74c3c; }

/* ---- COURT REPORT ---- */

.report-container {
    background: white;
    color: #111;
    border-radius: var(--radius);
    padding: 32px;
    max-width: 850px;
    margin: 0 auto;
    font-family: 'Inter', Arial, sans-serif;
    line-height: 1.5;
    overflow-x: auto;
}

.report-container h1 {
    text-align: center;
    font-size: 20px;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.report-container .report-subtitle {
    text-align: center;
    font-size: 13px;
    color: #666;
    margin-bottom: 20px;
}

.report-container hr {
    border: none;
    border-top: 2px solid #1a1a2e;
    margin: 16px 0;
}

.report-container h2 {
    font-size: 14px;
    color: #1a1a2e;
    margin: 20px 0 10px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 4px;
}

.report-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin: 12px 0;
}

.report-container th {
    background: #1a1a2e;
    color: white;
    padding: 6px 8px;
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
}

.report-container td {
    padding: 6px 8px;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

.report-container tr:nth-child(even) td { background: #f8f8f8; }
.report-container tr:hover td { background: #f0f0f0; }

.report-info-grid {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 4px 12px;
    font-size: 13px;
    margin-bottom: 16px;
}

.report-info-grid .label { font-weight: 600; color: #333; }
.report-info-grid .value { color: #555; }

.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 16px 0;
}

.report-summary-card {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 14px;
    text-align: center;
}

.report-summary-card .num {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
}

.report-summary-card .lbl {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
}

.signature-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #ccc;
}

.sig-line {
    border-bottom: 1px solid #333;
    width: 250px;
    display: inline-block;
    margin-bottom: 4px;
}

/* ---- TOAST ---- */

#toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--success);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: 14px;
    box-shadow: var(--shadow);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    max-width: 340px;
    text-align: center;
    pointer-events: auto;
}

.toast.error { border-left-color: var(--danger); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ---- EXPERIENCE/EDUCATION BLOCKS ---- */

.exp-block, .edu-block {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
}

.remove-block {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 8px;
    border-radius: 4px;
    line-height: 1;
}

.remove-block:hover, .remove-block:active {
    color: var(--danger);
    background: rgba(231,76,60,0.1);
}

/* ---- VISIBILITY HELPERS ---- */

.desktop-only { display: block; }
.mobile-only { display: none; }

/* ---- PRINT STYLES ---- */

@media print {
    body { background: white; color: black; }
    #sidebar, #main-content, #toast-container, #topbar, #bottombar, .more-menu { display: none !important; }
    .print-only { display: block !important; }
    #print-area { display: block !important; padding: 0; margin: 0; }
    .report-container { box-shadow: none; border: none; padding: 20px; }
}

.print-only { display: none; }

/* ============================================
   RESPONSIVE - TABLET
   ============================================ */

@media (max-width: 1024px) {
    #main-content {
        padding: 24px 20px;
    }
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 768px) {
    /* Show mobile nav, hide desktop sidebar */
    #sidebar { display: none; }
    #topbar { display: flex; }
    #bottombar { display: flex; }

    /* Toggle desktop/mobile views */
    .desktop-only { display: none !important; }
    .mobile-only { display: block !important; }

    #main-content {
        margin-left: 0;
        padding: 72px 16px 88px 16px;
        max-width: 100%;
    }

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

    .page-header h1 {
        font-size: 22px;
    }

    /* Stat cards: 2 columns on small phones */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 14px 8px;
    }

    .stat-value {
        font-size: 26px;
    }

    .stat-label {
        font-size: 10px;
    }

    /* Forms */
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .form-card {
        padding: 20px 16px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Filter bar */
    .filter-bar {
        flex-direction: column;
    }

    .filter-bar .input-select,
    .filter-bar .btn {
        width: 100%;
    }

    /* Report */
    .report-container {
        padding: 20px 14px;
        border-radius: var(--radius-sm);
    }

    .report-info-grid {
        grid-template-columns: 110px 1fr;
        font-size: 12px;
    }

    .report-summary-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .report-summary-card {
        padding: 10px 6px;
    }

    .report-summary-card .num {
        font-size: 20px;
    }

    .sig-line {
        width: 200px;
    }

    /* Toast */
    #toast-container {
        bottom: calc(80px + var(--safe-bottom));
        left: 16px;
        right: 16px;
        transform: none;
    }

    .toast {
        max-width: 100%;
        width: 100%;
    }
}

/* Very small screens */
@media (max-width: 380px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 22px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .form-card {
        padding: 16px 12px;
    }
}

/* ============================================
   LARGE DESKTOP
   ============================================ */

@media (min-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* ============================================
   SPINNER
   ============================================ */

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-row {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 32px;
    grid-column: 1 / -1;
}

/* ============================================
   SEARCH STATUS BAR
   ============================================ */

.search-status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 20px;
}

/* ============================================
   FIND JOBS (LISTINGS)
   ============================================ */

.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.listing-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: var(--transition);
}

.listing-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-glow);
}

.listing-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.listing-title {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.3;
}

.listing-company {
    color: var(--text-dim);
    font-size: 13px;
    margin-top: 2px;
}

.listing-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: var(--text-dim);
}

.listing-meta span {
    background: var(--bg-input);
    padding: 3px 8px;
    border-radius: 4px;
}

.source-badge {
    background: var(--accent-glow) !important;
    color: var(--accent) !important;
    font-weight: 600;
    text-transform: capitalize;
}

.listing-desc {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

.listing-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

/* ============================================
   LOAD MORE BAR
   ============================================ */

.load-more-bar {
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

/* ============================================
   BADGE — NEW / REVIEWED for listings
   ============================================ */

.badge-new { background: rgba(52,152,219,0.15); color: #3498db; }
.badge-reviewed { background: rgba(243,156,18,0.15); color: #f39c12; }

@media (max-width: 768px) {
    .listings-grid {
        grid-template-columns: 1fr;
    }
}
