:root {
    --bg-app: #090C15;
    --bg-panel: #111827;
    --bg-card: #141C2F;
    --border-color: rgba(255, 255, 255, 0.05);
    
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    
    --primary: #6366F1;
    --primary-hover: #4F46E5;
    
    --color-purple: #8B5CF6;
    --color-yellow: #F59E0B;
    --color-green: #10B981;
    --color-blue: #3B82F6;
    --color-red: #EF4444;

    --font-main: 'Inter', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-main);
    background-color: var(--bg-app);
    color: var(--text-main);
    min-height: 100vh;
    font-size: 14px;
}

/* --- Layout Principal --- */
.app-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

/* --- Sidebar Esquerda --- */
.sidebar-left {
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
}

.sidebar-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 2rem; padding: 0 0.5rem;
}
.brand { font-size: 1.25rem; font-weight: 800; color: #fff; }
.brand span { color: var(--primary); }
.collapse-btn { background: none; border: 1px solid var(--border-color); color: var(--text-muted); border-radius: 50%; width: 28px; height: 28px; cursor: pointer; }

.sidebar-menu { display: flex; flex-direction: column; gap: 0.5rem; }
.sidebar-menu a {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1rem; color: var(--text-muted);
    text-decoration: none; border-radius: 8px; font-weight: 500;
    transition: all 0.2s;
}
.sidebar-menu a.active {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--text-main);
    border-left: 3px solid var(--primary);
}
.sidebar-menu a:hover:not(.active) { color: var(--text-main); background: rgba(255,255,255,0.02); }

.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 1rem; }

.tip-card {
    background: rgba(99, 102, 241, 0.05); border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 1rem; border-radius: 8px; position: relative;
}
.tip-card h5 { color: var(--primary); margin-bottom: 0.5rem; font-size: 0.85rem; }
.tip-card p { color: var(--text-muted); font-size: 0.8rem; line-height: 1.4; }
.close-tip { position: absolute; top: 0.5rem; right: 0.5rem; background: none; border: none; color: var(--text-muted); cursor: pointer; }

.user-profile {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem; border-radius: 8px;
    background: rgba(255,255,255,0.02);
}
.user-profile img { width: 36px; height: 36px; border-radius: 50%; }
.user-info { display: flex; flex-direction: column; }
.greeting { font-weight: 600; font-size: 0.85rem; }
.role { color: var(--text-muted); font-size: 0.75rem; }

.logout-btn { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); text-decoration: none; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 8px; justify-content: center; }

/* --- Área Principal --- */
.main-area { padding: 2rem; display: flex; flex-direction: column; gap: 2rem; overflow-y: auto; height: 100vh; }

.main-topbar { display: flex; justify-content: space-between; align-items: center; }
.page-title h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.page-title p { color: var(--text-muted); font-size: 0.9rem; }
.topbar-actions { display: flex; gap: 1rem; align-items: center; }
.notification-btn { background: var(--bg-panel); border: 1px solid var(--border-color); color: #fff; width: 40px; height: 40px; border-radius: 8px; position: relative; cursor: pointer; }
.notification-btn .badge { position: absolute; top: -5px; right: -5px; background: var(--color-red); font-size: 0.7rem; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.btn { padding: 0.75rem 1.25rem; border-radius: 8px; font-weight: 600; font-family: inherit; cursor: pointer; border: none; }
.btn-primary { background: var(--primary); color: #fff; }

/* --- KPIs Row --- */
.kpis-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.kpi-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 1.25rem; display: flex; align-items: center; gap: 1rem; position: relative; overflow: hidden; }
.kpi-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.icon-purple { background: rgba(139, 92, 246, 0.1); color: var(--color-purple); border: 1px solid rgba(139, 92, 246, 0.2); }
.icon-yellow { background: rgba(245, 158, 11, 0.1); color: var(--color-yellow); border: 1px solid rgba(245, 158, 11, 0.2); }
.icon-green { background: rgba(16, 185, 129, 0.1); color: var(--color-green); border: 1px solid rgba(16, 185, 129, 0.2); }
.icon-blue { background: rgba(59, 130, 246, 0.1); color: var(--color-blue); border: 1px solid rgba(59, 130, 246, 0.2); }

.kpi-data { flex: 1; z-index: 1; }
.kpi-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.kpi-value-row { display: flex; align-items: baseline; gap: 0.5rem; margin-top: 0.25rem; }
.kpi-value-row strong { font-size: 1.5rem; font-weight: 800; }
.kpi-trend { font-size: 0.75rem; }
.trend-up { color: var(--color-green); }

/* --- Filters Bar --- */
.filters-bar { 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    gap: 1rem; 
    background: rgba(20, 28, 47, 0.6); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.75rem 1rem; 
    border-radius: 16px; 
    border: 1px solid var(--border-color); 
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}
.filters-bar:focus-within {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 4px 25px rgba(99, 102, 241, 0.15);
}

.search-box { 
    display: flex; 
    align-items: center; 
    flex: 1; 
    padding: 0.5rem 1.25rem; 
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}
.search-box:focus-within {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}
.search-icon { 
    width: 18px; 
    height: 18px; 
    color: var(--text-muted); 
    transition: color 0.3s ease;
}
.search-box:focus-within .search-icon {
    color: var(--primary);
}
.search-box input { 
    background: transparent; 
    border: none; 
    color: var(--text-main); 
    width: 100%; 
    outline: none; 
    font-family: inherit; 
    font-size: 0.95rem; 
    margin-left: 0.75rem; 
}
.search-box input::placeholder {
    color: rgba(148, 163, 184, 0.6);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.filter-selects { 
    display: flex; 
    gap: 0.75rem; 
}

.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.select-wrapper select { 
    appearance: none;
    background: rgba(255, 255, 255, 0.03); 
    border: 1px solid rgba(255, 255, 255, 0.08); 
    color: var(--text-main); 
    outline: none; 
    font-family: inherit; 
    font-size: 0.85rem; 
    font-weight: 500; 
    cursor: pointer; 
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    border-radius: 10px;
    transition: all 0.2s ease;
}
.select-wrapper select:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}
.select-wrapper select:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.select-wrapper select option {
    background: var(--bg-panel);
    color: var(--text-main);
    padding: 10px;
}

.select-arrow {
    position: absolute;
    right: 0.8rem;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
    transition: transform 0.2s ease;
}
.select-wrapper select:focus + .select-arrow {
    transform: rotate(180deg);
    color: var(--primary);
}

.clear-filters { 
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-red);
    border-radius: 10px;
    text-decoration: none; 
    transition: all 0.2s ease;
}
.clear-filters svg {
    width: 18px;
    height: 18px;
}
.clear-filters:hover {
    background: var(--color-red);
    color: #fff;
    transform: scale(1.05);
}
.clear-filters:active {
    transform: scale(0.95);
}

/* --- Grid de Criativos --- */
.creatives-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.c-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.c-media { position: relative; height: 180px; background: #000; cursor: pointer; }
.c-media img, .c-media video { width: 100%; height: 100%; object-fit: cover; opacity: 0.8; transition: opacity 0.3s; }
.c-media:hover img, .c-media:hover video { opacity: 1; }

.fav-star { position: absolute; top: 12px; left: 12px; z-index: 2; font-size: 1.1rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.c-badge { position: absolute; top: 12px; right: 12px; z-index: 2; padding: 0.25rem 0.75rem; border-radius: 20px; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.5px; }
.badge-novo { background: var(--color-blue); color: #fff; }
.badge-rodando { background: var(--color-yellow); color: #fff; }
.badge-escalando { background: var(--color-green); color: #fff; }
.badge-ruim { background: var(--color-red); color: #fff; }

.media-overlay { position: absolute; bottom: 0; left: 0; right: 0; padding: 1rem; background: linear-gradient(transparent, rgba(0,0,0,0.9)); }
.media-title { display: block; font-weight: 700; font-size: 1rem; margin-bottom: 0.5rem; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }
.price-btn { background: var(--primary); color: #fff; border: none; padding: 0.3rem 0.8rem; border-radius: 4px; font-size: 0.75rem; font-weight: 700; }

.c-details { padding: 1.25rem; display: flex; flex-direction: column; flex: 1; }
.c-title { font-size: 1rem; margin-bottom: 0.25rem; font-weight: 600; }
.c-meta { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; letter-spacing: 0.5px; margin-bottom: 1rem; }

.c-metrics { display: flex; gap: 1.5rem; margin-bottom: 1rem; }
.metric { display: flex; flex-direction: column; }
.metric small { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.2rem; }
.metric strong { font-size: 1rem; font-weight: 700; }
.text-green { color: var(--color-green) !important; }
.text-red { color: var(--color-red) !important; }

.c-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.tag { background: rgba(255,255,255,0.05); padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.7rem; color: var(--text-muted); }

.c-actions { display: flex; gap: 0.5rem; margin-top: auto; }
.action-btn { flex: 1; background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); border-radius: 6px; padding: 0.5rem; cursor: pointer; transition: all 0.2s; display: flex; justify-content: center; align-items: center; text-decoration: none; }
.action-btn:hover { background: rgba(255,255,255,0.05); color: #fff; }
.active-star { color: var(--color-yellow) !important; }

/* --- Sidebar Direita --- */
.sidebar-right { background-color: var(--bg-panel); border-left: 1px solid var(--border-color); padding: 2rem 1.5rem; display: flex; flex-direction: column; gap: 2rem; overflow-y: auto; height: 100vh; }

.widget-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.widget-header h3 { font-size: 0.95rem; font-weight: 600; }
.small-select { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); padding: 0.25rem; border-radius: 4px; font-size: 0.75rem; }

.widget-list { display: flex; flex-direction: column; gap: 1rem; }
.top-item { display: flex; align-items: center; gap: 0.75rem; }
.rank { width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
.top-item:nth-child(1) .rank { background: var(--color-yellow); color: #000; }
.top-item:nth-child(2) .rank { background: #E2E8F0; color: #000; }
.top-item:nth-child(3) .rank { background: #F87171; color: #000; }

.thumb { width: 40px; height: 40px; border-radius: 8px; overflow: hidden; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.info { flex: 1; }
.info h4 { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.2rem; }
.score { text-align: right; font-weight: 700; font-size: 0.9rem; line-height: 1.2; }
.score small { font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }

.timeline { display: flex; flex-direction: column; gap: 1.25rem; margin-bottom: 1rem; }
.timeline-item { display: flex; gap: 1rem; position: relative; }
.t-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; z-index: 2; }
.t-icon.icon-blue { background: rgba(59, 130, 246, 0.2); color: var(--color-blue); }
.t-icon.icon-green { background: rgba(16, 185, 129, 0.2); color: var(--color-green); }
.t-icon.icon-yellow { background: rgba(245, 158, 11, 0.2); color: var(--color-yellow); }
.t-content h4 { font-size: 0.85rem; font-weight: 600; }
.t-content p { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }
.t-time { margin-left: auto; font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }

/* --- Gerais Utils --- */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.full-input { width: 100%; background: var(--bg-app); border: 1px solid var(--border-color); color: #fff; padding: 0.75rem; border-radius: 6px; font-family: inherit; }

/* --- Modais --- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 1000; }
.modal-overlay.active { display: flex; }
.modal-content { background: var(--bg-panel); border: 1px solid var(--border-color); width: 100%; max-width: 450px; padding: 1.5rem; border-radius: 12px; }
.modal-header { display: flex; justify-content: space-between; margin-bottom: 1rem; }
.close-btn { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }

/* Super Lightbox */
.super-lightbox-content { display: flex; width: 90vw; height: 90vh; background: var(--bg-panel); border-radius: 12px; overflow: hidden; border: 1px solid var(--border-color); }
.sl-media { flex: 2; background: #000; display: flex; align-items: center; justify-content: center; position: relative; }
.sl-media img, .sl-media video { max-width: 100%; max-height: 100%; object-fit: contain; }
.sl-sidebar { flex: 1; padding: 2.5rem 2rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1.5rem; background: var(--bg-app); }
.super-close { position: absolute; top: 1.5rem; right: 1.5rem; z-index: 1001; background: rgba(0,0,0,0.5); border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }

/* Metrics Form UI */
.metrics-form { display: flex; flex-direction: column; gap: 1rem; }
.metric-group { display: flex; align-items: center; justify-content: space-between; background: rgba(0,0,0,0.2); padding: 0.75rem 1rem; border-radius: 8px; border: 1px solid var(--border-color); }
.metric-group label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; width: 40%; }
.metric-group input { width: 60%; background: transparent; border: none; color: #fff; font-size: 1.1rem; font-weight: 700; text-align: right; outline: none; }
.metric-group input::placeholder { color: rgba(255,255,255,0.2); }
.metric-group input:focus { color: var(--primary); }

/* --- Login Page --- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    padding: 2rem;
    margin: 0;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 3rem;
    border-radius: 24px;
    background: rgba(20, 28, 47, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.login-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}
.login-header h1 span {
    color: var(--primary);
}
.login-header p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 2.5rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 0.5rem;
}
.input-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}
.input-group input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Outfit', sans-serif;
}
.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background: rgba(0, 0, 0, 0.3);
}

.btn-block {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    border-radius: 12px;
    margin-top: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px var(--primary);
}

.login-hints {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}
.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
}
.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
