/* ============================================================
   Reserva AI — Estilos
   ============================================================ */

:root {
    --color-bg:        #0f0f14;
    --color-surface:   #1a1a24;
    --color-border:    #2a2a38;
    --color-primary:   #e63946;
    --color-primary-h: #c1121f;
    --color-success:   #2a9d8f;
    --color-warning:   #e9c46a;
    --color-danger:    #e63946;
    --color-text:      #e8e8f0;
    --color-muted:     #6b6b80;
    --color-accent:    #457b9d;
    --radius:          6px;
    --shadow:          0 2px 8px rgba(0,0,0,0.4);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    color: var(--color-text);
}
.brand-icon { font-size: 1.3rem; }
.brand-name strong { color: var(--color-primary); }

.navbar-links {
    list-style: none;
    display: flex;
    gap: 0.25rem;
}
.navbar-links a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    color: var(--color-muted);
    font-size: 0.9rem;
    transition: color 0.15s, background 0.15s;
}
.navbar-links a:hover,
.navbar-links a.active {
    color: var(--color-text);
    background: var(--color-border);
    text-decoration: none;
}
.logout-link { color: var(--color-danger) !important; }

/* ---- Badge ---- */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
}

.badge-count {
    font-size: 0.85rem;
    color: var(--color-muted);
    background: var(--color-border);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
}

/* ---- Flash messages ---- */
.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    border-left: 4px solid transparent;
}
.flash-success { background: rgba(42,157,143,0.15); border-color: var(--color-success); }
.flash-error   { background: rgba(230,57,70,0.15);  border-color: var(--color-danger);  }
.flash-info    { background: rgba(69,123,157,0.15); border-color: var(--color-accent);  }
.flash button  { background: none; border: none; color: var(--color-muted); cursor: pointer; font-size: 1.1rem; }

/* ---- Main content ---- */
.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ---- Page header ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.page-header h2 { font-size: 1.3rem; font-weight: 600; }
.header-meta { display: flex; align-items: center; gap: 0.5rem; }

.back-link {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-bottom: 0.4rem;
}
.back-link:hover { color: var(--color-text); text-decoration: none; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.45rem 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, opacity 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { opacity: 0.88; text-decoration: none; }
.btn-primary   { background: var(--color-accent);   color: #fff; border-color: var(--color-accent); }
.btn-success   { background: var(--color-success);  color: #fff; border-color: var(--color-success); }
.btn-danger    { background: var(--color-danger);   color: #fff; border-color: var(--color-danger); }
.btn-secondary { background: var(--color-surface);  color: var(--color-text); border-color: var(--color-border); }
.btn-ghost     { background: transparent; color: var(--color-muted); border-color: transparent; }
.btn-sm        { padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.btn-block     { width: 100%; justify-content: center; }
.btn-approve   { background: var(--color-success); }

/* ---- Tags ---- */
.tag {
    display: inline-block;
    background: rgba(69,123,157,0.2);
    color: var(--color-accent);
    border: 1px solid rgba(69,123,157,0.4);
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.source-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(230,57,70,0.15);
    color: var(--color-primary);
    border-radius: 4px;
    padding: 0.1rem 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
}

/* ---- Table ---- */
.table-responsive { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.table th, .table td {
    padding: 0.65rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}
.table th {
    background: var(--color-surface);
    color: var(--color-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.table tbody tr:hover { background: rgba(255,255,255,0.02); }
.td-title a { color: var(--color-text); font-weight: 500; }
.td-title a:hover { color: var(--color-accent); }
.td-center { text-align: center; }
.td-date { color: var(--color-muted); font-size: 0.85rem; white-space: nowrap; }
.td-actions { white-space: nowrap; display: flex; gap: 0.4rem; align-items: center; }

/* Log table */
.table-logs .td-context { color: var(--color-muted); font-size: 0.82rem; white-space: nowrap; }
.log-level {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.log-level-info    { background: rgba(69,123,157,0.2); color: var(--color-accent); }
.log-level-warning { background: rgba(233,196,106,0.2); color: var(--color-warning); }
.log-level-error   { background: rgba(230,57,70,0.2);   color: var(--color-danger);  }

/* ---- Empty state ---- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p { margin-bottom: 0.4rem; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-bottom: 0.3rem;
    font-weight: 600;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-accent);
}
.form-group textarea { resize: vertical; line-height: 1.5; }
.field-hint { font-size: 0.78rem; color: var(--color-muted); margin-top: 0.25rem; }

/* ---- Filter bar ---- */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    align-items: center;
}
.filter-bar select {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
    font-family: inherit;
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    gap: 0.25rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: 0.85rem;
    background: var(--color-surface);
    transition: background 0.15s;
}
.page-link:hover { background: var(--color-border); text-decoration: none; color: var(--color-text); }
.page-link.active { background: var(--color-accent); border-color: var(--color-accent); color: #fff; }

/* ---- Login page ---- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--color-bg);
}
.login-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow);
}
.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.login-logo .brand-icon { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; }
.login-logo h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.login-logo h1 strong { color: var(--color-primary); }
.login-logo p { color: var(--color-muted); font-size: 0.9rem; }
.login-form .btn { margin-top: 0.5rem; }

/* ---- Draft editor layout ---- */
.draft-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 768px) {
    .draft-layout { grid-template-columns: 1fr; }
}
.draft-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

/* Sidebar de fontes */
.draft-sources {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
}
.draft-sources h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
    margin-bottom: 0.75rem;
}
.sources-list { list-style: none; }
.source-item {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.source-item:last-child { border-bottom: none; }
.source-name { font-size: 0.75rem; color: var(--color-primary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.source-title { font-size: 0.85rem; color: var(--color-text); line-height: 1.4; }
a.source-title:hover { color: var(--color-accent); }
.source-date { font-size: 0.75rem; color: var(--color-muted); }

/* ---- YouTube notifications ---- */
.notifications-list { list-style: none; }
.notification-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    transition: background 0.15s;
}
.notification-item.unseen { background: rgba(230,57,70,0.07); border-left: 3px solid var(--color-primary); }
.notification-item.seen   { opacity: 0.6; }
.notif-channel { font-size: 0.75rem; color: var(--color-primary); font-weight: 700; text-transform: uppercase; }
.notif-title   { font-size: 0.9rem; color: var(--color-text); }
a.notif-title:hover { color: var(--color-accent); }
.notif-date    { font-size: 0.78rem; color: var(--color-muted); }

/* ---- Sources page ---- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.form-row {
    display: flex;
    gap: 1rem;
}
.form-row .form-group { margin-bottom: 0.75rem; }
.td-url { font-size: 0.82rem; color: var(--color-muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-url a { color: var(--color-muted); }
.td-url a:hover { color: var(--color-accent); }
.row-inactive { opacity: 0.5; }
.status-badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
}
.status-active   { background: rgba(42,157,143,0.2); color: var(--color-success); }
.status-inactive { background: rgba(107,107,128,0.2); color: var(--color-muted); }

/* ---- Utility ---- */
.text-muted { color: var(--color-muted); }
