/**
 * Modern Job Application Assistant - Modular Stylesheet
 * Optimized for Bootstrap 5 with Dark Glassmorphism Aesthetics
 */

:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.85);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-accent: rgba(59, 130, 246, 0.3);
    --accent-blue: #3b82f6;
    --accent-indigo: #6366f1;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --text-primary: #f9fafb;
    --text-muted: #9ca3af;
    --card-radius: 14px;
}

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

input, textarea, select {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

.hashtag-btn {
    font-size: 0.72rem;
    padding: 2px 9px;
    border-color: rgba(255, 255, 255, 0.18);
    color: #cbd5e1;
    transition: all 0.2s ease;
}
.hashtag-btn:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: #38bdf8;
    color: #ffffff;
    transform: translateY(-1px);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #0f172a;
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Navbar */
.app-navbar {
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.85rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.brand-badge {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Candidate Profile Banner */
.candidate-banner {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.85));
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--card-radius);
    padding: 1.25rem 1.5rem;
    backdrop-filter: blur(12px);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.candidate-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent-blue), var(--accent-green));
}

.candidate-avatar {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1e40af, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.skill-pill {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    font-size: 0.75rem;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    display: inline-block;
    margin: 2px;
    font-weight: 500;
}

/* Glassmorphic Search Container */
.search-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--card-radius);
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.form-control, .form-select {
    background-color: rgba(15, 23, 42, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #f3f4f6 !important;
    border-radius: 10px !important;
    padding: 0.65rem 0.9rem !important;
    transition: all 0.2s ease-in-out;
}

.form-control:focus, .form-select:focus {
    background-color: rgba(15, 23, 42, 0.95) !important;
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
}

.form-control::placeholder {
    color: #6b7280;
}

/* Job Card */
.job-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--card-radius);
    backdrop-filter: blur(12px);
    padding: 1.35rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.job-card:hover {
    transform: translateY(-3px);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.5);
}

.job-card.already-applied {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.04);
}

.company-logo-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #60a5fa;
    font-size: 1.1rem;
}

/* Expiry & Status Badges */
.badge-active-vacancy {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    font-size: 0.72rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
}

.badge-closing-soon {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
    font-size: 0.72rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
}

.badge-expired {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 0.72rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
}

.badge-applied {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid #10b981;
    font-size: 0.72rem;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    font-weight: 700;
}

.badge-match-score {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
}

/* Modals */
.modal-content {
    background-color: #111827 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 16px !important;
    color: var(--text-primary) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6) !important;
}

.modal-header {
    border-bottom: 1px solid var(--border-subtle) !important;
    padding: 1.25rem 1.5rem !important;
}

.modal-footer {
    border-top: 1px solid var(--border-subtle) !important;
    padding: 1rem 1.5rem !important;
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Nav Tabs in Modals */
.nav-tabs {
    border-bottom: 1px solid var(--border-subtle);
}

.nav-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    padding: 0.6rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link.active {
    color: var(--accent-blue);
    background: transparent;
    border-bottom: 2px solid var(--accent-blue);
}

.nav-tabs .nav-link:hover {
    color: var(--text-primary);
}

/* Code Viewer / Log Pre */
.code-viewer {
    background: #030712;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 1rem;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.8rem;
    color: #93c5fd;
    max-height: 420px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Buttons */
.btn-primary-custom {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    border: none;
    color: #fff;
    font-weight: 600;
    padding: 0.65rem 1.35rem;
    border-radius: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary-custom:hover {
    background: linear-gradient(135deg, #1d4ed8, #4338ca);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
    transform: translateY(-1px);
    color: #fff;
}

.btn-secondary-custom {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-subtle);
    color: #e2e8f0;
    font-weight: 500;
    padding: 0.6rem 1.1rem;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.btn-secondary-custom:hover {
    background: rgba(51, 65, 85, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1090;
}

.custom-toast {
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    color: #fff;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInUp 0.3s ease;
}

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

/* ==========================================================================
   Enterprise Table List View & Interactive Domain Tabs
   ========================================================================== */
#domain-filter-pills .nav-link {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    transition: all 0.2s ease;
}

#domain-filter-pills .nav-link:hover {
    background: rgba(51, 65, 85, 0.7);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.18);
}

#domain-filter-pills .nav-link.active {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.jobs-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--card-radius);
    overflow: hidden;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.jobs-table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--text-primary);
}

.jobs-table thead th {
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.95rem 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.jobs-table tbody tr {
    transition: background-color 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.jobs-table tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.06);
}

.jobs-table tbody td {
    padding: 1rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table-domain-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.table-domain-business { background: rgba(14, 165, 233, 0.15); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.3); }
.table-domain-biotech { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.table-domain-tech { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.3); }
.table-domain-finance { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.table-domain-healthcare { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.table-domain-hr { background: rgba(139, 92, 246, 0.15); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.3); }
.table-domain-marketing { background: rgba(244, 63, 94, 0.15); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.3); }
.table-domain-education { background: rgba(234, 179, 8, 0.15); color: #facc15; border: 1px solid rgba(234, 179, 8, 0.3); }

.match-score-pill {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.3));
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
    font-weight: 700;
    font-size: 0.78rem;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* Compact result controls wrap naturally on mobile. */
.results-controls .form-control { width: 220px; }
.results-controls .form-select { width: auto; max-width: 180px; }
@media (max-width: 575px) {
    .results-controls { width: 100%; }
    .results-controls .form-control { width: 100%; }
    .results-controls .form-select { flex: 1; max-width: none; min-width: 115px; }
}

/* Resume Upload AI Loader Modal Aesthetics */
#resumeUploadModal .modal-content {
    box-shadow: 0 0 45px rgba(56, 189, 248, 0.3), 0 25px 35px -5px rgba(0, 0, 0, 0.7) !important;
}

#upload-loader-icon {
    transition: transform 0.3s ease, color 0.3s ease;
}

@keyframes pulseGlow {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.6));
    }
    50% {
        transform: scale(1.15);
        filter: drop-shadow(0 0 15px rgba(56, 189, 248, 0.95));
    }
}

.upload-icon-pulse {
    animation: pulseGlow 1.3s ease-in-out infinite;
}

/* Real-Time Offline Banner Styling */
.offline-banner-offline {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.95), rgba(185, 28, 28, 0.95)) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    animation: slideDownBanner 0.35s ease forwards;
}

.offline-banner-online {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(5, 150, 105, 0.95)) !important;
    border-color: rgba(16, 185, 129, 0.5) !important;
    animation: slideDownBanner 0.35s ease forwards;
}

@keyframes slideDownBanner {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
