/**
 * WB Ad Sales Query Platform
 * Global Styles & Design System
 */

:root {
    /* Color Palette */
    --wb-blue: #002BE7;
    --wb-blue-dark: #001B99;
    --wb-blue-light: #4D6DF0;
    
    --accent-gold: #FFC000;
    --accent-gold-hover: #E6AC00;
    --accent-cyan: #00E5FF;
    
    --bg-dark: #0B0E17;
    --bg-panel: rgba(255, 255, 255, 0.03);
    --bg-panel-hover: rgba(255, 255, 255, 0.05);
    
    --text-primary: #FFFFFF;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    --border-color: rgba(255, 255, 255, 0.1);
    --border-focus: var(--wb-blue-light);
    
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;

    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    
    /* Layout */
    --sidebar-width: 260px;
    --border-radius-sm: 6px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
    
    /* Effects */
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    position: relative;
}

/* Background ambient glow effect */
body::before {
    content: '';
    position: fixed;
    top: -10vw;
    left: -10vw;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(0, 43, 231, 0.15) 0%, rgba(11, 14, 23, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    bottom: -10vw;
    right: -10vw;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(0, 229, 255, 0.05) 0%, rgba(11, 14, 23, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- Utilities --- */
.hidden {
    display: none !important;
}

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--glass-shadow);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

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

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-left: 8px;
    vertical-align: middle;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(10, 12, 20, 0.8);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 48px;
}

.logo-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wb-blue), var(--wb-blue-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 43, 231, 0.4);
}

.app-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.main-nav ul {
    list-style: none;
}

.main-nav li {
    margin-bottom: 8px;
}

.main-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
    font-weight: 500;
}

.main-nav a:hover {
    background: var(--bg-panel-hover);
    color: var(--text-primary);
}

.main-nav li.active a {
    background: rgba(0, 43, 231, 0.15);
    color: var(--wb-blue-light);
    border-left: 3px solid var(--wb-blue-light);
}

.user-profile {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gold);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- Main Content --- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px 48px;
    max-width: 1400px;
}

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

.top-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
    outline: none;
}

.btn-primary {
    background: var(--wb-blue);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 43, 231, 0.3);
}

.btn-primary:hover {
    background: var(--wb-blue-light);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 43, 231, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

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

/* --- Form Elements --- */
.query-builder {
    padding: 32px;
    margin-bottom: 40px;
}

.query-builder h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.section-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

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

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

label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.helper-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

input[type="text"],
input[type="date"],
select.custom-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

input[type="text"]:focus,
input[type="date"]:focus,
select.custom-select:focus {
    border-color: var(--border-focus);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 43, 231, 0.2);
}

/* Custom styles for select multiple */
select[multiple].custom-select {
    height: 120px;
    padding: 8px;
}

select[multiple].custom-select option {
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 2px;
}

select[multiple].custom-select option:checked {
    background: rgba(0, 43, 231, 0.3) linear-gradient(0deg, rgba(0, 43, 231, 0.3) 0%, rgba(0, 43, 231, 0.3) 100%);
    color: white;
}

.date-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-inputs .separator {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-primary);
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    transition: var(--transition-fast);
}

.checkbox-label:hover {
    border-color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.checkbox-label:has(input:checked) {
    border-color: var(--wb-blue-light);
    background: rgba(0, 43, 231, 0.15);
}

.checkbox-label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkbox-custom {
    display: none; /* Can be styled if needed, keeping simple for now by styling the label itself */
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

/* --- Results Dashboard --- */
.results-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-platinum {
    background: rgba(255, 192, 0, 0.15);
    color: var(--accent-gold);
    border: 1px solid rgba(255, 192, 0, 0.3);
    margin-left: 8px;
    font-size: 0.75rem;
}

.badge-gold {
    background: rgba(255, 215, 0, 0.1);
    color: #FFD700;
    border: 1px solid rgba(255, 215, 0, 0.25);
    margin-left: 8px;
    font-size: 0.75rem;
}

.badge-silver {
    background: rgba(192, 192, 192, 0.1);
    color: #C0C0C0;
    border: 1px solid rgba(192, 192, 192, 0.25);
    margin-left: 8px;
    font-size: 0.75rem;
}

.badge-bronze {
    background: rgba(205, 127, 50, 0.1);
    color: #CD7F32;
    border: 1px solid rgba(205, 127, 50, 0.25);
    margin-left: 8px;
    font-size: 0.75rem;
}

.badge-n-a {
    background: rgba(128, 128, 128, 0.1);
    color: #888888;
    border: 1px solid rgba(128, 128, 128, 0.25);
    margin-left: 8px;
    font-size: 0.75rem;
}

.badge-content {
    background: rgba(0, 229, 255, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 229, 255, 0.3);
    font-weight: 500;
}

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

.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.2);
}

.stat-icon {
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.05);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.stat-info h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

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

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.content-matches, .ad-efforts {
    padding: 24px;
    height: 100%;
}

.content-matches h4, .ad-efforts h4 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* Dynamic Lists */
.release-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.release-item:last-child {
    border-bottom: none;
}

.release-poster {
    width: 60px;
    height: 80px;
    background: #1E293B;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.release-details h5 {
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.release-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.channel-tag {
    background: rgba(0, 43, 231, 0.2);
    color: var(--wb-blue-light);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Effort Packages */
.effort-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 16px;
    margin-bottom: 12px;
    transition: var(--transition-fast);
    border-left: 3px solid var(--accent-gold);
}

.effort-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

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

.effort-title {
    font-weight: 600;
    font-size: 1rem;
}

.effort-price {
    font-weight: 700;
    color: var(--success);
}

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

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .details-grid {
        grid-template-columns: 1fr;
    }
}
