@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Montserrat:wght@600;700&display=swap');

:root {
    /* Light Mode Default */
    --color-primary: #0066B2;
    --color-primary-hover: #004d87;
    --color-bg-body: #F9FAFB;
    --color-bg-card: #FFFFFF;
    --color-bg-card-hover: #F3F4F6;
    --color-bg-input: #FFFFFF;
    --color-text: #111827;
    --color-text-muted: #6B7280;
    --color-text-dim: #9CA3AF;
    --color-border: #E5E7EB;
    
    --color-success: #10B981;
    --color-danger: #EF4444;
    --color-warning: #F59E0B;
    --color-info: #3B82F6;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 9999px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Montserrat', sans-serif;
}

:root[data-theme='dark'] {
    --color-primary: #3B82F6;
    --color-primary-hover: #2563EB;
    --color-bg-body: #0A0E1A;
    --color-bg-card: #151D2C;
    --color-bg-card-hover: #1E293B;
    --color-bg-input: #0F1626;
    --color-text: #F3F4F6;
    --color-text-muted: #9CA3AF;
    --color-text-dim: #6B7280;
    --color-border: #1F2937;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
}

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

body {
    font-family: var(--font-sans);
    background: var(--color-bg-body);
    color: var(--color-text);
    min-height: 100vh;
    transition: background-color 0.2s ease, color 0.2s ease;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* Navbar */
.navbar {
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--color-text);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #0066B2, #3B82F6);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #FFFFFF;
    font-family: var(--font-heading);
}

.navbar-brand span {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 15px;
}
.navbar-brand span small {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-left: 6px;
    font-weight: 400;
    font-family: var(--font-sans);
}

.navbar-nav {
    display: flex;
    gap: 8px;
    list-style: none;
    align-items: center;
}

.navbar-nav a {
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.navbar-nav a:hover, .navbar-nav a.active {
    color: var(--color-text);
    background: var(--color-bg-card-hover);
}

.theme-toggle {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}
.theme-toggle:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-bg-card-hover);
    transform: rotate(5deg) scale(1.05);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.theme-toggle svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s;
}

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

/* Cards */
.card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primary);
    color: #FFFFFF;
}
.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-ghost {
    background: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}
.btn-ghost:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-bg-card-hover);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
}
.btn-danger:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-pill {
    border-radius: var(--radius-pill);
}

/* Form */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--color-text);
}

.form-control {
    width: 100%;
    height: 44px;
    padding: 10px 16px;
    background: var(--color-bg-input);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 14px;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

textarea.form-control {
    height: auto;
    resize: vertical;
    min-height: 140px;
    padding-top: 12px;
    padding-bottom: 12px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236B7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}
:root[data-theme='dark'] select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239CA3AF' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
}

/* Advanced Settings Toggle */
.advanced-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--color-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
    padding: 8px 0;
}
.advanced-toggle:hover { color: var(--color-text); }
.advanced-toggle svg { width: 16px; height: 16px; transition: transform 0.2s; }
.advanced-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.advanced-content {
    background: var(--color-bg-body);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

/* Checkbox group */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    user-select: none;
}

.checkbox-label:has(input:checked) {
    border-color: var(--color-primary);
    background: rgba(59, 130, 246, 0.05);
    color: var(--color-primary);
}

.checkbox-label input {
    accent-color: var(--color-primary);
    width: 16px; height: 16px;
}

/* Table */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

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

thead th {
    text-align: left;
    padding: 14px 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-body);
}

tbody td {
    padding: 16px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

tbody tr {
    transition: background 0.15s;
    background: var(--color-bg-card);
}

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

tbody tr:hover {
    background: var(--color-bg-card-hover);
}

.job-video-row-active td {
    background: rgba(59, 130, 246, 0.08);
    border-bottom-color: rgba(59, 130, 246, 0.18);
}

.job-video-detail-row:hover {
    background: var(--color-bg-card);
}

.job-video-detail-row-active td {
    background: rgba(59, 130, 246, 0.04);
}

.video-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-link-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

.url-text {
    display: inline-block;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.detail-link-row .btn {
    flex: 0 0 auto;
}

.expandable-content {
    overflow-x: hidden;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--color-success); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--color-danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--color-warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-info { background: rgba(59, 130, 246, 0.1); color: var(--color-info); border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-muted { background: var(--color-bg-body); color: var(--color-text-muted); border: 1px solid var(--color-border); }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-value {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
    color: var(--color-text);
}

.stat-card .stat-label {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-top: 4px;
    font-weight: 500;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 2rem;
}

.pagination button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-bg-input);
    color: var(--color-text);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-bg-card-hover);
}

.pagination button.active {
    background: var(--color-primary);
    color: #FFFFFF;
    border-color: var(--color-primary);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--color-bg-body);
}

/* Filters */
.filters-bar {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    align-items: flex-end;
}

.filters-bar .form-group {
    margin-bottom: 0;
    flex-grow: 1;
    min-width: 160px;
}

/* Expandable content */
.expandable-content {
    padding: 1.25rem;
    background: var(--color-bg-body);
    border-top: 1px solid var(--color-border);
}

.inline-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 1rem;
}

.inline-panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.inline-tab-active {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: rgba(59, 130, 246, 0.08);
}

/* Loading */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Utility */
.text-muted { color: var(--color-text-muted); }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.font-bold { font-weight: 700; }

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 1.5rem 1rem; }
    .navbar { padding: 0 1rem; }
    .navbar-brand span { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .inline-panel-header { flex-direction: column; }
    .detail-link-row { flex-wrap: wrap; }
    .url-text { max-width: 100%; }
}

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

/* Toast */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 300px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-success { background: var(--color-success); color: #fff; border: 1px solid rgba(16, 185, 129, 0.2); }
.toast-error { background: var(--color-danger); color: #fff; border: 1px solid rgba(239, 68, 68, 0.2); }
.toast-info { background: var(--color-bg-card); color: var(--color-text); border: 1px solid var(--color-border); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
