/* ── High-End SaaS Dark Mode CSS System ── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Sophisticated Dark Palette */
    --bg-main: #060913;
    --bg-gradient: radial-gradient(circle at top left, #0e1424 0%, #060913 70%, #03050a 100%);
    --card-bg: rgba(13, 20, 38, 0.55);
    --card-hover: rgba(20, 30, 55, 0.75);
    --card-border: rgba(255, 255, 255, 0.05);
    --card-border-glow: rgba(99, 102, 241, 0.15);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Vibrant Accent Tones */
    --primary: #5f5af6; /* Deep Violet */
    --primary-hover: #4e48e0;
    --primary-glow: rgba(95, 90, 246, 0.3);
    --primary-gradient: linear-gradient(135deg, #5f5af6 0%, #8b5cf6 100%);
    
    --success: #10b981; /* Emerald */
    --success-bg: rgba(16, 185, 129, 0.08);
    --success-border: rgba(16, 185, 129, 0.18);
    
    --warning: #f59e0b; /* Amber */
    --warning-bg: rgba(245, 158, 11, 0.08);
    --warning-border: rgba(245, 158, 11, 0.18);
    
    --danger: #f43f5e; /* Rose */
    --danger-bg: rgba(244, 63, 94, 0.08);
    --danger-border: rgba(244, 63, 94, 0.18);
    
    --transition-fast: all 0.15s ease;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* ── Reset & General ── */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background: var(--bg-main);
    background-image: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-y: scroll;
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── Layout Container ── */
.app-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
}

/* ── SaaS Header ── */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.logo-section h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.75px;
    background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 50%, #4338ca 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-section p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
    font-weight: 400;
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.3rem;
    border-radius: 10px;
    border: 1px solid var(--card-border);
}

.nav-link {
    font-family: var(--font-heading);
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 550;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

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

.nav-link.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.15);
}

/* ── Quick Dashboard Widgets (Stat Cards) ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(800px circle at var(--x, 0px) var(--y, 0px), rgba(255,255,255,0.03), transparent 40%);
    pointer-events: none;
}

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

.stat-label {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    color: var(--text-secondary);
}

.stat-icon {
    font-size: 1.2rem;
    opacity: 0.7;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #d1d5db 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-footer {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ── Interactive Actions Bar (Status & Buttons) ── */
.dashboard-actions-bar {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-bottom: 2.25rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
}

.status-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-pulse.active {
    background: var(--success);
    box-shadow: 0 0 12px var(--success);
    animation: breathing 2s infinite;
}

.status-pulse.busy {
    background: var(--warning);
    box-shadow: 0 0 12px var(--warning);
    animation: breathing 1.2s infinite;
}

@keyframes breathing {
    0% { transform: scale(0.92); opacity: 0.4; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.92); opacity: 0.4; }
}

/* ── Buttons Styling ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--primary-gradient);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.65rem 1.4rem;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 6px 20px rgba(95, 90, 246, 0.4);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
    box-shadow: none;
}

.btn.disabled, .btn[disabled] {
    opacity: 0.5;
    pointer-events: none;
    transform: none !important;
}

.btn-small {
    padding: 0.45rem 1rem;
    font-size: 0.82rem;
    border-radius: 8px;
}

.btn-group {
    display: flex;
    gap: 0.75rem;
}

/* ── Advanced Filters ── */
.filters-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 1.5rem;
    margin-bottom: 2.25rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    color: var(--text-secondary);
}

.filter-control {
    background: rgba(4, 6, 12, 0.4);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.65rem 1rem;
    height: 42px;
    box-sizing: border-box;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-fast);
    width: 100%;
    cursor: pointer;
}

/* Ensure consistent height and formatting for webkit date inputs */
.filter-control[type="date"] {
    padding-top: 0;
    padding-bottom: 0;
    line-height: 40px;
}

.filter-control::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
    transition: var(--transition-fast);
}

.filter-control::-webkit-calendar-picker-indicator:hover {
    filter: invert(1);
}


.filter-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ── Modern Table System ── */
.jobs-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    margin-bottom: 2.5rem;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: rgba(255, 255, 255, 0.01);
    padding: 1.25rem 1.5rem;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--card-border);
}

td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.92rem;
    vertical-align: middle;
    transition: var(--transition-fast);
}

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

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 30px;
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.25px;
    border: 1px solid transparent;
}

.badge-source-topcv {
    background: rgba(24, 187, 156, 0.08);
    color: #1ddca8;
    border-color: rgba(24, 187, 156, 0.2);
}

.badge-source-itviec {
    background: rgba(244, 63, 94, 0.08);
    color: #f43f5e;
    border-color: rgba(244, 63, 94, 0.2);
}

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

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

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

.badge-category {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border-color: var(--card-border);
}

/* ── Typography and cells inside tables ── */
.job-title-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.job-title-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 650;
    font-family: var(--font-heading);
    font-size: 1rem;
    transition: var(--transition-fast);
}

.job-title-link:hover {
    color: #8b5cf6;
}

.company-name {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 400;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: rgba(4, 6, 12, 0.35);
    border-top: 1px solid var(--card-border);
}

.pagination-text {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.pagination-buttons {
    display: flex;
    gap: 0.5rem;
}

/* ── Job Details View Layout ── */
.back-bar {
    margin-bottom: 2rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 2rem;
    align-items: start;
}

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

.detail-main {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 2.25rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.detail-meta-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 1.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.detail-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.detail-header h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 750;
    margin-bottom: 0.6rem;
    line-height: 1.35;
    letter-spacing: -0.25px;
}

.detail-subtitle {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.detail-section-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 2rem 0 1rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--primary-glow);
    display: inline-block;
    color: var(--text-primary);
}

.jd-content {
    color: var(--text-secondary);
    font-size: 0.98rem;
    line-height: 1.8;
    white-space: pre-line;
}

.blocks-preview-box {
    background: rgba(3, 4, 8, 0.65);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 1.25rem;
    max-height: 400px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.82rem;
    color: #a5b4fc;
    white-space: pre-wrap;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.meta-item label {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    color: var(--text-muted);
}

.meta-item span {
    font-size: 0.96rem;
    font-weight: 550;
}

/* ── Runs List (Logs) Styling ── */
.duration-cell {
    font-family: monospace;
    color: var(--text-secondary);
}

/* ── Custom Popups (Toast UI) ── */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #111827;
    border: 1px solid var(--card-border);
    border-left: 5px solid var(--primary);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateY(200%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateY(0);
}

.toast-icon {
    font-size: 1.1rem;
}

.toast-message {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Loading Spins animations ── */
.loading-spinner {
    display: inline-block;
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spinning 0.7s linear infinite;
}

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