/* ============================================================
   LiteVideo — CSS (réplica fiel do React/Tailwind)
   Cores: slate-900 bg, slate-800 cards, sky-500 accent
   ============================================================ */

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0f172a; color: #e2e8f0; line-height: 1.5; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   Layout (idêntico ao React Layout.tsx)
   ============================================================ */
.app-layout { min-height: 100vh; }
.main-content { margin-left: 256px; padding: 2rem; }
@media (max-width: 767px) {
    .main-content { margin-left: 0; padding: 1rem; }
}

/* ============================================================
   Sidebar (idêntico ao React Sidebar.tsx)
   ============================================================ */
.sidebar {
    position: fixed; top: 0; left: 0; width: 256px; height: 100vh;
    background: #0f172a; border-right: 1px solid #1e293b;
    display: flex; flex-direction: column; z-index: 40;
    transition: transform 0.3s;
}
.sidebar-header {
    padding: 1.25rem; border-bottom: 1px solid #1e293b;
    display: flex; align-items: center; justify-content: space-between;
}
.sidebar-header .logo-img { height: 42px; }
.sidebar-close { display: none; background: none; border: none; color: #94a3b8; padding: 4px; }

/* Plan Badge */
.plan-badge {
    margin: 0.75rem 0.75rem 0.5rem; padding: 0.625rem 0.75rem;
    border-radius: 0.5rem; border: 1px solid;
}
.plan-badge.status-ok { background: rgba(14,165,233,0.15); border-color: rgba(14,165,233,0.3); }
.plan-badge.status-urgent { background: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.3); }
.plan-badge.status-expired { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.3); }
.plan-badge .plan-name { font-size: 0.75rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.375rem; }
.plan-badge .plan-name.ok { color: #38bdf8; }
.plan-badge .plan-name.urgent { color: #fbbf24; }
.plan-badge .plan-name.expired { color: #f87171; }
.plan-badge .plan-info { font-size: 0.6875rem; color: #94a3b8; }
.plan-badge .plan-progress { margin-top: 0.375rem; height: 4px; background: rgba(51,65,85,0.5); border-radius: 9999px; overflow: hidden; }
.plan-badge .plan-progress-fill { height: 100%; border-radius: 9999px; }
.plan-badge .plan-progress-fill.ok { background: #0ea5e9; }
.plan-badge .plan-progress-fill.urgent { background: #f59e0b; }
.plan-badge .plan-progress-fill.expired { background: #ef4444; }
.plan-badge .plan-videos { font-size: 0.6875rem; color: #64748b; margin-top: 0.375rem; }
.plan-badge .plan-actions { display: flex; gap: 0.375rem; margin-top: 0.5rem; }
.plan-badge .plan-actions a {
    flex: 1; text-align: center; font-size: 0.6875rem; font-weight: 500;
    padding: 0.375rem; border-radius: 0.25rem; transition: background 0.15s;
}
.plan-badge .plan-actions .btn-renew { background: rgba(14,165,233,0.2); color: #38bdf8; }
.plan-badge .plan-actions .btn-renew:hover { background: rgba(14,165,233,0.3); }
.plan-badge .plan-actions .btn-renew.expired { background: rgba(239,68,68,0.2); color: #f87171; }
.plan-badge .plan-actions .btn-renew.expired:hover { background: rgba(239,68,68,0.3); }
.plan-badge .plan-actions .btn-support {
    background: rgba(34,197,94,0.15); color: #4ade80;
    display: flex; align-items: center; justify-content: center; gap: 0.25rem;
}
.plan-badge .plan-actions .btn-support:hover { background: rgba(34,197,94,0.25); }

/* Nav Items */
.sidebar-nav { flex: 1; padding: 1rem 0.75rem; display: flex; flex-direction: column; gap: 0.25rem; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1rem; font-size: 0.875rem; font-weight: 500;
    border-radius: 0.5rem; color: #d1d5db; transition: all 0.15s;
}
.nav-item:hover { background: rgba(14,165,233,0.15); color: #fff; }
.nav-item.active { background: #0c4a6e; color: #fff; }
.nav-item svg { flex-shrink: 0; }

/* Sidebar Footer */
.sidebar-footer { padding: 0.5rem 0.75rem 1rem; }
.sidebar-footer .nav-item { margin-bottom: 0; }
.sidebar-footer .instagram-link { color: #d1d5db; }
.sidebar-footer .logout-btn { border-top: 1px solid #1e293b; padding-top: 1rem; margin-top: 0.5rem; }

/* Mobile */
.mobile-menu-btn {
    display: none; position: fixed; top: 1rem; right: 1rem; z-index: 50;
    background: #1e293b; border: none; color: #fff; padding: 0.5rem; border-radius: 0.5rem;
}
.mobile-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 39;
}

@media (max-width: 767px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .mobile-menu-btn { display: block; }
    .mobile-overlay.show { display: block; }
}

/* ============================================================
   Auth Layout (login split-screen idêntico ao React)
   ============================================================ */
.auth-layout {
    min-height: 100vh; display: flex; background: #020617;
}
.auth-container { display: contents; }
.auth-illustration {
    display: none; width: 50%; position: relative;
    background: linear-gradient(to bottom right, #0f172a, #020617, #082f49);
    overflow: hidden; align-items: center; justify-content: center;
}
.auth-illustration .overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(2,6,23,0.8), transparent, rgba(2,6,23,0.4));
}
.auth-illustration .content { position: relative; z-index: 10; text-align: center; padding: 3rem; }
.auth-illustration .content img { width: 100%; max-width: 28rem; filter: drop-shadow(0 25px 25px rgba(0,0,0,0.4)); }
.auth-illustration .content h2 { font-size: 1.5rem; font-weight: 700; color: #fff; margin-top: 2rem; margin-bottom: 0.75rem; }
.auth-illustration .content p { color: #94a3b8; font-size: 0.875rem; line-height: 1.6; max-width: 24rem; margin: 0 auto; }
.auth-illustration .deco1 { position: absolute; top: 5rem; left: 2.5rem; width: 8rem; height: 8rem; background: rgba(14,165,233,0.05); border-radius: 50%; filter: blur(48px); }
.auth-illustration .deco2 { position: absolute; bottom: 5rem; right: 2.5rem; width: 12rem; height: 12rem; background: rgba(6,182,212,0.05); border-radius: 50%; filter: blur(48px); }

@media (min-width: 1024px) {
    .auth-illustration { display: flex; }
}

.auth-form-side {
    width: 100%; display: flex; align-items: center; justify-content: center; padding: 1.5rem 2rem;
}
@media (min-width: 1024px) {
    .auth-form-side { width: 50%; }
}

.auth-card { width: 100%; max-width: 28rem; }
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo img { height: 2.5rem; margin: 0 auto; }
.auth-title { text-align: center; font-size: 1.5rem; font-weight: 700; color: #fff; }
.auth-subtitle { text-align: center; color: #94a3b8; margin-top: 0.5rem; font-size: 0.875rem; }

/* ============================================================
   Form Elements
   ============================================================ */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; color: #cbd5e1; margin-bottom: 0.25rem; }
.form-input-wrapper { position: relative; }
.form-input-wrapper .icon {
    position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
    color: #94a3b8; pointer-events: none; display: flex;
}
.form-input, .input {
    display: block; width: 100%;
    padding: 0.625rem 0.75rem;
    background: #1e293b; border: 1px solid #334155; border-radius: 0.5rem;
    color: #fff; font-size: 0.875rem;
    transition: all 0.15s;
}
.form-input:focus, .input:focus { outline: none; border-color: #0ea5e9; box-shadow: 0 0 0 2px rgba(14,165,233,0.3); }
.form-input.with-icon { padding-left: 2.5rem; }
.form-input::placeholder { color: #64748b; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.625rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500;
    border: none; transition: all 0.15s; cursor: pointer;
}
.btn-full { width: 100%; }
.btn-primary { background: #0ea5e9; color: #fff; }
.btn-primary:hover { background: #0284c7; }
.btn-primary:disabled { background: #334155; color: #94a3b8; cursor: not-allowed; }
.btn-google { background: #fff; color: #374151; }
.btn-google:hover { background: #f3f4f6; }
.btn-apple { background: #000; color: #fff; border: 1px solid #374151; }
.btn-apple:hover { background: #111; }
.btn-outline { background: #1e293b; color: #fff; border: 1px solid #334155; }
.btn-outline:hover { background: #334155; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }

/* ============================================================
   Alerts
   ============================================================ */
.alert { padding: 1rem; margin-bottom: 1.5rem; border-radius: 0.375rem; font-size: 0.875rem; }
.alert-error { background: rgba(127,29,29,0.3); color: #f87171; border: 1px solid #7f1d1d; }
.alert-success { background: rgba(20,83,45,0.3); color: #4ade80; border: 1px solid #14532d; }

/* ============================================================
   Divider
   ============================================================ */
.divider {
    display: flex; align-items: center; margin: 1.5rem 0; font-size: 0.875rem; color: #94a3b8;
}
.divider::before, .divider::after {
    content: ''; flex: 1; height: 1px; background: #334155;
}
.divider::before { margin-right: 0.5rem; }
.divider::after { margin-left: 0.5rem; }

/* ============================================================
   Stat Cards (idêntico ao React StatCard.tsx)
   ============================================================ */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
@media (max-width: 1023px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 639px) { .stats-grid { grid-template-columns: 1fr; } }

.stat-card {
    background: #1e293b; border-radius: 0.5rem; padding: 1.25rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
}
.stat-card .stat-header { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-card .stat-label { font-size: 0.875rem; color: #9ca3af; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 600; margin-top: 0.25rem; color: #fff; }
.stat-card .stat-icon { padding: 0.5rem; border-radius: 9999px; background: rgba(14,165,233,0.15); color: #0ea5e9; }

/* ============================================================
   Cards
   ============================================================ */
.card { background: #1e293b; border-radius: 0.5rem; padding: 1.5rem; margin-bottom: 1.5rem; }
.card-title { font-size: 1.125rem; font-weight: 500; color: #fff; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

/* ============================================================
   Dashboard Filters (idêntico ao React)
   ============================================================ */
.filter-bar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.filter-pills {
    display: flex; align-items: center; background: #1e293b; border-radius: 0.5rem;
    padding: 0.25rem; gap: 0.25rem;
}
.filter-pills .pill {
    padding: 0.375rem 0.75rem; border-radius: 0.375rem; font-size: 0.875rem; font-weight: 500;
    border: none; background: transparent; color: #94a3b8; cursor: pointer; transition: all 0.15s;
}
.filter-pills .pill:hover { color: #fff; background: #334155; }
.filter-pills .pill.active { background: #0369a1; color: #fff; }

.video-selector {
    display: flex; align-items: center; gap: 0.75rem;
    background: #1e293b; border-radius: 0.5rem; padding: 0.625rem 1rem;
    cursor: pointer; transition: background 0.15s; position: relative;
    border: none; color: #fff; font-size: 0.875rem;
}
.video-selector:hover { background: #334155; }
.video-selector .vs-icon { color: #0ea5e9; flex-shrink: 0; }
.video-selector .vs-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.video-selector .vs-arrow { color: #94a3b8; flex-shrink: 0; transition: transform 0.15s; }
.video-selector .vs-arrow.open { transform: rotate(180deg); }

.video-dropdown {
    position: absolute; top: 100%; left: 0; margin-top: 0.25rem;
    background: #1e293b; border: 1px solid #334155; border-radius: 0.5rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); z-index: 20;
    width: 100%; min-width: 20rem; max-height: 16rem; overflow-y: auto;
    display: none;
}
.video-dropdown.show { display: block; }
.video-dropdown .dd-item {
    width: 100%; text-align: left; padding: 0.625rem 1rem; font-size: 0.875rem;
    border: none; background: none; color: #cbd5e1; cursor: pointer;
    display: flex; align-items: center; gap: 0.5rem; transition: background 0.15s;
}
.video-dropdown .dd-item:hover { background: #334155; }
.video-dropdown .dd-item.active { color: #38bdf8; background: rgba(51,65,85,0.5); }

/* ============================================================
   Recent Views List
   ============================================================ */
.view-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem; background: rgba(51,65,85,0.5); border-radius: 0.5rem;
    transition: background 0.15s; margin-bottom: 0.75rem;
}
.view-item:hover { background: rgba(51,65,85,0.7); }
.view-item .view-left { display: flex; align-items: center; gap: 0.75rem; }
.view-item .view-title { font-size: 0.875rem; font-weight: 500; color: #fff; }
.view-item .view-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; }
.view-item .view-meta .device { font-weight: 500; }
.view-item .view-meta .dot { color: #64748b; }
.view-item .view-meta .browser { color: #94a3b8; }
.view-item .view-meta .unique { color: #4ade80; }
.view-item .view-right { text-align: right; }
.view-item .view-duration { font-size: 0.875rem; font-weight: 500; color: #38bdf8; }
.view-item .view-time { font-size: 0.75rem; color: #64748b; }

/* ============================================================
   Charts Grid
   ============================================================ */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 2rem; }
@media (max-width: 1023px) { .charts-grid { grid-template-columns: 1fr; } }

/* ============================================================
   Tables
   ============================================================ */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 0.75rem 1rem; font-size: 0.75rem; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid #334155; }
td { padding: 0.75rem 1rem; font-size: 0.875rem; color: #e2e8f0; border-bottom: 1px solid #1e293b; }
tr:hover td { background: rgba(51,65,85,0.3); }

/* ============================================================
   Video Grid
   ============================================================ */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.video-card {
    background: #1e293b; border-radius: 0.5rem; overflow: hidden; cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.video-card:hover { transform: translateY(-2px); box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3); }
.video-thumb { aspect-ratio: 16/9; background: #0f172a; display: flex; align-items: center; justify-content: center; color: #475569; }
.video-info { padding: 1rem; }
.video-title { font-size: 0.875rem; font-weight: 500; color: #fff; margin-bottom: 0.5rem; }
.video-meta { display: flex; align-items: center; gap: 0.75rem; font-size: 0.75rem; color: #94a3b8; }
.video-status { font-size: 0.75rem; }
.video-status.ready { color: #4ade80; }
.video-status.processing { color: #fbbf24; }

/* ============================================================
   Empty States
   ============================================================ */
.empty-state { text-align: center; padding: 3rem 1rem; color: #94a3b8; }
.empty-state svg { margin: 0 auto 1rem; color: #475569; }
.empty-state h3 { font-size: 1.125rem; font-weight: 500; color: #e2e8f0; margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; color: #94a3b8; }

/* ============================================================
   Refresh button
   ============================================================ */
.btn-refresh {
    display: flex; align-items: center; gap: 0.5rem;
    background: #1e293b; color: #fff; border: none; padding: 0.5rem 1rem;
    border-radius: 0.5rem; font-size: 0.875rem; transition: background 0.15s;
}
.btn-refresh:hover { background: #334155; }
.btn-refresh:disabled { opacity: 0.5; }
.btn-refresh .spinning { animation: spin 1s linear infinite; }

/* ============================================================
   Utilities
   ============================================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: #94a3b8; }
.text-white { color: #fff; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Spinner */
.spinner { display: inline-block; width: 1rem; height: 1rem; border: 2px solid transparent; border-top-color: #fff; border-bottom-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Page Header
   ============================================================ */
.page-header { margin-bottom: 1.5rem; }
.page-title { font-size: 1.5rem; font-weight: 700; color: #fff; }
.page-subtitle { font-size: 0.875rem; color: #94a3b8; margin-top: 0.25rem; }

/* Forgot password link */
.forgot-link { font-size: 0.75rem; color: #94a3b8; transition: color 0.15s; }
.forgot-link:hover { color: #38bdf8; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* Select styled */
select.input {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* Pagination */
.pagination { display: flex; align-items: center; gap: 0.5rem; }
.pagination button {
    padding: 0.25rem; border-radius: 0.25rem; background: #334155; border: none;
    color: #fff; transition: background 0.15s; display: flex; align-items: center;
}
.pagination button:hover { background: #475569; }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination .page-info { font-size: 0.875rem; color: #94a3b8; padding: 0 0.5rem; }