/* =============================================================
   VigíaFlow — Custom Application Styles
   Newspaper-inspired design system for El Vigía editorial platform
   ============================================================= */

/* ---- Google Fonts are loaded via layout, so we rely on them below ---- */

/* =============================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================= */
:root {
    /* Brand Colors */
    --color-navy:       #1a2744;
    --color-navy-dark:  #0e1623;
    --color-navy-light: #243566;
    --color-gold:       #c8a96e;
    --color-gold-light: #d9c08a;
    --color-gold-pale:  #f5edd8;

    /* Grays */
    --color-bg:         #f4f5f7;
    --color-surface:    #ffffff;
    --color-border:     #e2e5ec;
    --color-text:       #1e2433;
    --color-muted:      #6c757d;

    /* Sidebar */
    --sidebar-width:    240px;
    --sidebar-bg:       #1a2744;
    --sidebar-text:     rgba(255, 255, 255, 0.75);
    --sidebar-active:   rgba(200, 169, 110, 0.15);
    --sidebar-active-border: #c8a96e;

    /* Status Colors */
    --status-borrador:  #6c757d;
    --status-revision:  #ffc107;
    --status-listo:     #0d6efd;
    --status-procesado: #198754;

    /* Spacing */
    --topbar-height:    56px;
    --card-radius:      0.5rem;
    --card-shadow:      0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9375rem;
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.5;
}

/* =============================================
   LAYOUT — Sidebar + Main Wrapper
   ============================================= */
#wrapper {
    min-height: 100vh;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background-color: var(--sidebar-bg);
    flex-shrink: 0;
    transition: transform 0.25s ease;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 64px;
}

.sidebar-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.sidebar-subtitle {
    font-size: 0.7rem;
    color: rgba(200, 169, 110, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-divider {
    border-color: rgba(255, 255, 255, 0.08);
    margin: 0.25rem 0.75rem;
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
    padding: 0.5rem 0.75rem 0.25rem;
}

.sidebar-link {
    color: var(--sidebar-text) !important;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
}

.sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.07);
    color: #fff !important;
}

.sidebar-link.active {
    background-color: var(--sidebar-active);
    color: var(--color-gold) !important;
    border-left-color: var(--sidebar-active-border);
    font-weight: 500;
}

.sidebar-link.text-danger-soft {
    color: rgba(255, 100, 100, 0.8) !important;
}

.sidebar-link.text-danger-soft:hover {
    background-color: rgba(220, 53, 69, 0.12);
    color: #ff6b6b !important;
}

/* Sublinks de submenús colapsables */
.sidebar-sublink {
    font-size: 0.825rem;
    padding: 0.35rem 0.6rem;
    opacity: 0.9;
}

.sidebar-sublink.active {
    opacity: 1;
}

/* Chevron rotación al expandir */
.sidebar-link .sidebar-chevron {
    transition: transform 0.2s ease;
}
.sidebar-link.collapsed .sidebar-chevron {
    transform: rotate(-90deg);
}

.text-gold {
    color: var(--color-gold) !important;
}

/* Mobile sidebar */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 1045;
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 1044;
        background: rgba(0, 0, 0, 0.5);
        display: none;
    }
    .sidebar-overlay.show {
        display: block;
    }
}

/* =============================================
   TOP NAVBAR
   ============================================= */
.topbar {
    background-color: var(--color-surface);
    height: var(--topbar-height);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 var(--color-border);
}

.topbar-page-title {
    font-size: 0.875rem;
    color: var(--color-muted);
}

/* =============================================
   MAIN CONTENT
   ============================================= */
#page-content {
    min-width: 0;
    max-width: calc(100vw - var(--sidebar-width));
}

.main-content {
    max-width: 1400px;
}

/* =============================================
   CARDS
   ============================================= */
.card {
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
}

.card-header {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

/* =============================================
   STAT CARDS (Dashboard)
   ============================================= */
.stat-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    box-shadow: var(--card-shadow);
    height: 100%;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--color-text);
    font-family: 'Inter', sans-serif;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

/* Soft bg color utility classes */
.bg-primary-soft   { background-color: #dce8ff !important; }
.bg-success-soft   { background-color: #d4edda !important; }
.bg-warning-soft   { background-color: #fff3cd !important; }
.bg-danger-soft    { background-color: #f8d7da !important; }
.bg-info-soft      { background-color: #d1ecf1 !important; }
.bg-secondary-soft { background-color: #e9ecef !important; }

/* =============================================
   FORMS & INPUTS
   ============================================= */
.form-control,
.form-select {
    font-size: 0.875rem;
    border-color: var(--color-border);
    border-radius: 0.375rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--color-navy);
    box-shadow: 0 0 0 0.2rem rgba(26, 39, 68, 0.12);
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 0.375rem;
}

.form-label-sm {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-muted);
}

/* =============================================
   BUTTONS
   ============================================= */
.btn-primary {
    background-color: var(--color-navy);
    border-color: var(--color-navy);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--color-navy-light);
    border-color: var(--color-navy-light);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--color-muted);
    padding: 0.25rem 0.5rem;
}

.btn-ghost:hover {
    background-color: var(--color-border);
    color: var(--color-text);
}

/* =============================================
   EDITOR (WYSIWYG)
   ============================================= */
.editor-toolbar {
    background-color: #f8f9fa;
}

.cuerpo-editor {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-text);
    font-family: 'Inter', sans-serif;
}

.cuerpo-editor p {
    margin-bottom: 1rem;
}

/* =============================================
   FILE UPLOAD ZONE
   ============================================= */
.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--card-radius);
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    background-color: #fafbfc;
}

.upload-zone:hover {
    border-color: var(--color-navy);
    background-color: #f0f3fa;
}

.upload-zone.drag-over {
    border-color: var(--color-gold);
    background-color: var(--color-gold-pale);
}

/* =============================================
   NOTA PREVIEW (reader-side typography)
   ============================================= */
.nota-preview {
    max-width: 72ch;
}

.nota-volanta {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-muted);
    margin-bottom: 0.5rem;
}

.nota-titulo {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--color-text);
    margin-bottom: 0.75rem;
}

.nota-bajada {
    font-size: 1.15rem;
    color: #3d4a60;
    line-height: 1.55;
    font-weight: 400;
    border-left: 3px solid var(--color-gold);
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.nota-byline {
    font-size: 0.8125rem;
    color: var(--color-muted);
}

.nota-cuerpo {
    font-size: 1rem;
    line-height: 1.75;
    color: #2c3547;
}

.nota-cuerpo p {
    margin-bottom: 1.25rem;
}

/* Small volanta for cards */
.nota-volanta-small {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-muted);
}

/* =============================================
   DESIGN CARDS (diseno/index)
   ============================================= */
.nota-card {
    transition: box-shadow 0.2s;
}

.nota-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.nota-procesada {
    opacity: 0.75;
}

.page-group-header {
    margin-bottom: 0.5rem;
}

.page-badge {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-muted);
    white-space: nowrap;
}

/* =============================================
   MURO DE GALERAS
   ============================================= */
.muro-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

@media (max-width: 1199.98px) {
    .muro-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 767.98px) {
    .muro-grid { grid-template-columns: repeat(2, 1fr); }
}

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

.muro-page {
    border-radius: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0.5rem;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.15s;
}

.muro-page:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.muro-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.muro-page-num {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text);
    font-family: 'Playfair Display', serif;
}

.muro-page-count {
    font-size: 0.65rem;
}

.muro-notas-list {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.muro-nota-item {
    background: rgba(255, 255, 255, 0.75);
    border-radius: 0.25rem;
    padding: 0.375rem 0.5rem;
    cursor: grab;
    font-size: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.muro-nota-item:active { cursor: grabbing; }

.muro-nota-section {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.muro-nota-titulo {
    font-size: 0.72rem;
    line-height: 1.3;
    color: var(--color-text);
}

.muro-nota-titulo a:hover { text-decoration: underline !important; }

.muro-page-empty {
    flex-grow: 1;
}

.muro-page-footer {
    margin-top: 0.375rem;
    padding-top: 0.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    text-align: center;
}

.sortable-ghost {
    opacity: 0.4;
    background: #c8a96e33;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-body {
    min-height: 100vh;
}

.login-input {
    background-color: #1e2d3d;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e9ecef;
    border-radius: 0 0.375rem 0.375rem 0;
}

.login-input::placeholder { color: rgba(255, 255, 255, 0.35); }

.login-input:focus {
    background-color: #243547;
    border-color: var(--color-gold);
    color: #fff;
    box-shadow: 0 0 0 0.15rem rgba(200, 169, 110, 0.2);
}

.login-input-icon {
    background-color: #1e2d3d;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.45);
}

.btn-login {
    background: linear-gradient(135deg, var(--color-gold) 0%, #a8843e 100%);
    border: none;
    color: var(--color-navy-dark);
    font-weight: 600;
    border-radius: 0.5rem;
    letter-spacing: 0.02em;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-login:hover {
    opacity: 0.9;
    color: var(--color-navy-dark);
    transform: translateY(-1px);
}

.login-rule-lines {
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 32px,
        rgba(255, 255, 255, 0.03) 32px,
        rgba(255, 255, 255, 0.03) 33px
    );
    pointer-events: none;
}

.login-feature-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(200, 169, 110, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* =============================================
   NOTIFICATIONS
   ============================================= */
.badge-notif {
    font-size: 0.6rem;
    padding: 0.2em 0.35em;
    min-width: 1.1rem;
}

.notif-dropdown {
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
}

.notif-item {
    cursor: pointer;
    white-space: normal;
    line-height: 1.4;
    transition: background-color 0.15s;
}

.notif-item.notif-unread {
    background-color: #f0f6ff;
    font-weight: 500;
}

.notif-item:hover {
    background-color: #f0f3fa;
}

/* =============================================
   TABLES
   ============================================= */
.table > thead > tr > th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
    border-bottom: 1px solid var(--color-border);
    background-color: #f8f9fb;
}

.table-hover tbody tr:hover {
    background-color: #f5f7ff;
}

.hover-bg:hover {
    background-color: #f5f7ff;
}

/* =============================================
   VERSION HISTORY DOT
   ============================================= */
.version-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #0d6efd;
    flex-shrink: 0;
}

/* =============================================
   FOOTER BAR
   ============================================= */
.footer-bar {
    background-color: var(--color-surface);
    font-size: 0.75rem;
}

/* =============================================
   FLASH MESSAGES
   ============================================= */
.flash-container .alert {
    font-size: 0.875rem;
    border-radius: var(--card-radius);
}

/* =============================================
   SCROLLBAR CUSTOMIZATION
   ============================================= */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 2px; }

/* =============================================
   UTILITY OVERRIDES
   ============================================= */
@media (max-width: 991.98px) {
    #page-content {
        max-width: 100vw;
    }
}

/* Ensure table cells don't push layout on small screens */
@media (max-width: 575.98px) {
    .nota-titulo { font-size: 1.5rem; }
    .nota-bajada { font-size: 1rem; }
}
