/**
 * =============================================================================
 * app.css — Design System Principal
 * WhatsApp Status Manager
 * =============================================================================
 *
 * Sistema de diseño SaaS moderno.
 * Inspirado en Metronic, Tabler y AdminLTE con identidad WhatsApp.
 *
 * ÍNDICE:
 *  1. Variables CSS (tokens del diseño)
 *  2. Reset y base
 *  3. Layout (sidebar + main content)
 *  4. Sidebar
 *  5. Topbar / Navbar
 *  6. Cards
 *  7. KPI Cards
 *  8. Tablas
 *  9. Badges y estados
 * 10. Formularios y Upload
 * 11. Botones
 * 12. Módulo de Cuentas (avatars, QR)
 * 13. Módulo de Estado (type selector, preview phone)
 * 14. Dashboard (recent posts, charts)
 * 15. Auth Layout
 * 16. Utilidades
 * 17. Animaciones
 * 18. Responsive
 * =============================================================================
 */

/* ============================================================================
   1. VARIABLES CSS (Design Tokens)
   ============================================================================ */
:root {
    /* Colores de marca */
    --wa-green:          #25D366;
    --wa-green-dark:     #128C7E;
    --wa-green-darker:   #075E54;
    --wa-teal:           #34B7F1;

    /* Colores de UI */
    --brand-primary:     #128C7E;
    --brand-secondary:   #25D366;

    /* Sidebar */
    --sidebar-width:     260px;
    --sidebar-collapsed: 70px;
    --sidebar-bg:        #0f172a;
    --sidebar-text:      #94a3b8;
    --sidebar-text-hover:#e2e8f0;
    --sidebar-active-bg: rgba(37, 211, 102, 0.12);
    --sidebar-active-text: #25D366;
    --sidebar-border:    rgba(255,255,255,0.06);

    /* Layout */
    --topbar-height:     60px;
    --content-padding:   24px;

    /* Superficie */
    --surface-bg:        #f8fafc;
    --card-bg:           #ffffff;
    --card-border:       #e2e8f0;
    --card-radius:       14px;
    --card-shadow:       0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,.10), 0 8px 32px rgba(0,0,0,.06);

    /* Tipografía */
    --font-family:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --text-primary:      #0f172a;
    --text-secondary:    #475569;
    --text-muted:        #94a3b8;

    /* Bordes */
    --border-color:      #e2e8f0;
    --border-radius:     10px;
    --border-radius-sm:  6px;
    --border-radius-lg:  16px;

    /* Transiciones */
    --transition-base:   all 0.2s ease;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Status colors */
    --status-working:    #198754;
    --status-stopped:    #6c757d;
    --status-scan-qr:    #ffc107;
    --status-starting:   #0dcaf0;
    --status-failed:     #dc3545;
}

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

html { scroll-behavior: smooth; }

body {
    font-family:     var(--font-family);
    font-size:       14px;
    line-height:     1.6;
    color:           var(--text-primary);
    background:      var(--surface-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Links */
a { color: var(--brand-primary); text-decoration: none; transition: var(--transition-base); }
a:hover { color: var(--brand-secondary); }

/* ============================================================================
   3. LAYOUT
   ============================================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.page-content {
    padding: var(--content-padding);
    flex: 1;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
    line-height: 1.3;
}
.page-subtitle {
    color: var(--text-muted);
    margin: 0;
    font-size: 13px;
}
.page-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ============================================================================
   4. SIDEBAR
   ============================================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Scrollbar personalizado */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* Brand / Logo */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}
.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--wa-green-dark), var(--wa-green));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37,211,102,0.3);
}
.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.brand-name {
    font-size: 15px;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: -0.3px;
}
.brand-sub {
    font-size: 10px;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition-base);
    font-size: 18px;
    line-height: 1;
}
.sidebar-toggle-btn:hover { background: rgba(255,255,255,0.08); color: white; }

/* Navegación */
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-separator {
    padding: 14px 20px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.25);
}
.nav-item { margin: 2px 10px; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition-base);
    text-decoration: none;
    position: relative;
}
.nav-link:hover:not(.disabled) {
    background: rgba(255,255,255,0.06);
    color: var(--sidebar-text-hover);
}
.nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
}
.nav-link.active .nav-icon { color: var(--sidebar-active-text); }
.nav-icon { font-size: 16px; flex-shrink: 0; width: 18px; }
.nav-text { flex: 1; }
.nav-badge {
    font-size: 9px;
    font-weight: 700;
    background: var(--wa-green);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.nav-badge.badge-soon {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.4);
}
.nav-link.disabled { cursor: default; opacity: 0.5; }

/* Footer del sidebar */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--sidebar-border);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-avatar {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--wa-green-dark), var(--wa-green));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    display: block;
    font-size: 11px;
    color: var(--sidebar-text);
}
.btn-logout {
    color: var(--sidebar-text);
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition-base);
    font-size: 16px;
}
.btn-logout:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

/* Overlay para móviles */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1039;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ============================================================================
   5. TOPBAR
   ============================================================================ */
.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.breadcrumb { font-size: 13px; }
.breadcrumb-item + .breadcrumb-item::before { content: "›"; }

/* User menu */
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-base);
}
.user-menu-btn:hover { background: var(--surface-bg); }
.user-avatar-sm {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--wa-green-dark), var(--wa-green));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
}
.user-menu-btn::after { display: none; } /* Quitar caret por defecto */

/* ============================================================================
   6. CARDS
   ============================================================================ */
.card-app {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: var(--transition-smooth);
}
.card-app:hover { box-shadow: var(--card-shadow-hover); }

.card-header-app {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
}
.card-title-app {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
}

/* ============================================================================
   7. KPI CARDS
   ============================================================================ */
.kpi-card {
    background: white;
    border-radius: var(--card-radius);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
    transition: var(--transition-smooth);
    height: 100%;
}
.kpi-card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-1px); }

.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.kpi-card-primary .kpi-icon { background: rgba(18,140,126,0.12); color: var(--brand-primary); }
.kpi-card-success .kpi-icon { background: rgba(25,135,84,0.12); color: #198754; }
.kpi-card-info    .kpi-icon { background: rgba(13,110,253,0.10); color: #0d6efd; }
.kpi-card-warning .kpi-icon { background: rgba(255,193,7,0.15);  color: #856404; }

.kpi-body { flex: 1; }
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin: 0 0 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 28px; font-weight: 800; color: var(--text-primary); margin: 0 0 4px; line-height: 1; }
.kpi-sub   { font-size: 12px; color: var(--text-muted); margin: 0; }
.kpi-link  { font-size: 12px; color: var(--brand-primary); font-weight: 500; }
.kpi-link:hover { color: var(--brand-secondary); }

/* ============================================================================
   8. TABLAS
   ============================================================================ */
.table-app {
    font-size: 13.5px;
    margin: 0;
}
.table-app thead th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.table-app tbody td {
    padding: 14px 20px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
}
.table-app tbody tr:last-child td { border-bottom: none; }
.table-app tbody tr:hover td { background: #f8fafc; }

/* Miniaturas en historial */
.thumb-preview {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    transition: var(--transition-base);
}
.thumb-preview:hover { transform: scale(2.5); z-index: 10; position: relative; box-shadow: 0 8px 24px rgba(0,0,0,0.2); }

/* ============================================================================
   9. BADGES Y ESTADOS
   ============================================================================ */
.badge-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.badge-status.badge-lg { padding: 6px 14px; font-size: 12px; }

.badge-success   { background: rgba(25,135,84,0.1);  color: #198754; }
.badge-secondary { background: rgba(108,117,125,0.1); color: #6c757d; }
.badge-warning   { background: rgba(255,193,7,0.15);  color: #856404; }
.badge-info      { background: rgba(13,202,240,0.12); color: #0a6783; }
.badge-danger    { background: rgba(220,53,69,0.1);   color: #dc3545; }

/* Status dot en avatar */
.status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid white;
}
.status-dot-success   { background: #198754; }
.status-dot-secondary { background: #6c757d; }
.status-dot-warning   { background: #ffc107; }
.status-dot-info      { background: #0dcaf0; }
.status-dot-danger    { background: #dc3545; }

/* Stat pills (en listado de cuentas) */
.stat-pill {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}
.stat-pill-success   { background: rgba(25,135,84,0.08);  color: #198754; }
.stat-pill-secondary { background: rgba(108,117,125,0.08); color: #6c757d; }
.stat-pill-warning   { background: rgba(255,193,7,0.12);  color: #856404; }

/* ============================================================================
   10. FORMULARIOS Y UPLOAD
   ============================================================================ */

/* Input wrapper (login) */
.input-wrapper { position: relative; }
.input-wrapper .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 16px;
}
.input-wrapper .form-control { padding-left: 40px; }
.btn-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    transition: var(--transition-base);
}
.btn-toggle-password:hover { color: var(--text-primary); }

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    background: #f8fafc;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}
.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--brand-primary);
    background: rgba(18,140,126,0.04);
}
.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}
.upload-icon {
    font-size: 36px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: block;
}
.upload-text { color: var(--text-secondary); margin-bottom: 10px; font-size: 14px; }
.upload-hint { color: var(--text-muted); font-size: 12px; margin-top: 8px; margin-bottom: 0; }

.upload-preview { position: relative; }
.preview-img {
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}
.preview-video {
    width: 100%;
    max-height: 240px;
    border-radius: 6px;
    display: block;
}
.btn-remove-file {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    border: none;
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition-base);
}
.btn-remove-file:hover { background: rgba(220,53,69,0.8); }

/* Char counter */
.char-counter {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 11px;
    color: var(--text-muted);
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Emoji textarea */
.emoji-input {
    font-size: 15px;
    resize: vertical;
    padding-bottom: 28px;
}

/* Color presets */
.color-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.color-btn {
    width: 28px;
    height: 28px;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-base);
    padding: 0;
}
.color-btn:hover,
.color-btn.active {
    border-color: white;
    box-shadow: 0 0 0 2px var(--brand-primary);
    transform: scale(1.1);
}

/* ============================================================================
   11. BOTONES
   ============================================================================ */
.btn {
    font-weight: 500;
    border-radius: 8px;
    transition: var(--transition-base);
    font-size: 13.5px;
}
.btn-primary { background: var(--brand-primary); border-color: var(--brand-primary); }
.btn-primary:hover { background: var(--wa-green-darker); border-color: var(--wa-green-darker); }

.btn-group-sm > .btn { border-radius: 6px !important; }

/* ============================================================================
   12. MÓDULO DE CUENTAS
   ============================================================================ */

/* Avatars */
.account-avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--wa-green-dark), var(--wa-green));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: white;
    position: relative;
    flex-shrink: 0;
}
.account-avatar-sm {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--wa-green-dark), var(--wa-green));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}
.account-avatar-xl {
    width: 80px;
    height: 80px;
    font-size: 28px;
}
.profile-avatar-lg { text-align: center; }

/* Session code */
.session-code {
    font-size: 12px;
    background: #f1f5f9;
    color: var(--brand-primary);
    padding: 2px 8px;
    border-radius: 4px;
}

/* QR Panel */
.qr-image {
    border: 4px solid white;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    animation: fadeIn 0.3s ease;
}
.qr-instructions { text-align: left; }
.qr-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.step-num {
    width: 24px;
    height: 24px;
    background: var(--brand-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.step-text { font-size: 12px; color: var(--text-secondary); margin: 3px 0 0; }

/* Live indicator */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #198754;
}
.live-dot {
    width: 8px;
    height: 8px;
    background: #198754;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* Info list */
.info-list { margin: 0; }
.info-list dt {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin: 12px 0 2px;
}
.info-list dt:first-child { margin-top: 0; }
.info-list dd { margin: 0; font-size: 13px; color: var(--text-primary); }

/* Stat item (en detalle de sesión) */
.stat-item { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 11px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 14px; font-weight: 600; }

/* JSON preview */
.json-preview {
    font-size: 11px;
    background: #0f172a;
    color: #94a3b8;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
}

/* ============================================================================
   13. MÓDULO DE ESTADOS
   ============================================================================ */

/* Type selector grid */
.status-type-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}
.type-option { cursor: pointer; }
.type-radio { display: none; }
.type-card {
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 8px;
    text-align: center;
    background: white;
    transition: var(--transition-base);
}
.type-card:hover { border-color: var(--brand-primary); background: rgba(18,140,126,0.04); }
.type-radio:checked + .type-card {
    border-color: var(--brand-primary);
    background: rgba(18,140,126,0.08);
    box-shadow: 0 0 0 3px rgba(18,140,126,0.15);
}
.type-icon { font-size: 24px; margin-bottom: 6px; display: block; }
.type-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); }

/* Phone mockup */
.phone-mockup {
    display: inline-block;
    width: 220px;
    background: #1a1a2e;
    border-radius: 30px;
    padding: 16px 10px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(255,255,255,0.1);
}
.phone-screen {
    background: #111;
    border-radius: 20px;
    overflow: hidden;
    aspect-ratio: 9/16;
    position: relative;
    display: flex;
    align-items: stretch;
}
.wa-status-preview { width: 100%; display: flex; align-items: stretch; }

/* Status text preview */
.preview-text-status {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 200px;
    transition: background 0.3s ease;
}
#previewTextContent {
    color: white;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    word-break: break-word;
    white-space: pre-wrap;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Status media preview */
.preview-media-status {
    width: 100%;
    position: relative;
    display: flex;
    align-items: stretch;
    flex-direction: column;
}
.preview-media-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    flex: 1;
}
.preview-caption {
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 12px;
    font-size: 12px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

/* Preview type badge */
.preview-type-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

/* Success animation */
.success-animation { animation: bounceIn 0.5s ease; }

/* ============================================================================
   14. DASHBOARD
   ============================================================================ */

/* Recent posts list */
.recent-posts-list { display: flex; flex-direction: column; }
.recent-post-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease;
}
.recent-post-item:last-child { border-bottom: none; }
.recent-post-item:hover { background: #f8fafc; }

.post-type-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.post-type-text       { background: rgba(13,110,253,0.1); color: #0d6efd; }
.post-type-image      { background: rgba(25,135,84,0.1);  color: #198754; }
.post-type-video      { background: rgba(13,202,240,0.1); color: #0a6783; }
.post-type-image_text { background: rgba(255,193,7,0.12); color: #856404; }
.post-type-video_text { background: rgba(220,53,69,0.1);  color: #dc3545; }

.post-info { flex: 1; min-width: 0; }
.post-account { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.post-text { font-size: 13px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-meta { font-size: 11px; color: var(--text-muted); }
.post-status { flex-shrink: 0; }

/* Empty state */
.empty-state { text-align: center; color: var(--text-muted); }
.empty-icon-wrapper {
    width: 80px;
    height: 80px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.empty-icon { font-size: 36px; color: var(--text-muted); }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-text { font-size: 13px; margin-bottom: 16px; }

/* Session legend */
.session-legend { display: flex; flex-direction: column; gap: 6px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-label { flex: 1; color: var(--text-secondary); }
.legend-count { font-weight: 700; color: var(--text-primary); }

/* ============================================================================
   15. AUTH LAYOUT
   ============================================================================ */
.auth-layout {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 40%, #0a2e2a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Formas decorativas animadas */
.auth-bg { position: absolute; inset: 0; overflow: hidden; }
.auth-bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.15;
}
.auth-bg-shape-1 {
    width: 400px; height: 400px;
    background: var(--wa-green);
    top: -100px; right: -100px;
    animation: floatBg 8s ease-in-out infinite;
}
.auth-bg-shape-2 {
    width: 300px; height: 300px;
    background: #0d6efd;
    bottom: -50px; left: -50px;
    animation: floatBg 10s ease-in-out infinite reverse;
}
.auth-bg-shape-3 {
    width: 200px; height: 200px;
    background: var(--wa-teal);
    top: 40%; left: 40%;
    animation: floatBg 12s ease-in-out infinite;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

.auth-card {
    background: rgba(255,255,255,0.97);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
    backdrop-filter: blur(20px);
}

.auth-card-header { text-align: center; margin-bottom: 32px; }
.auth-logo {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--wa-green-dark), var(--wa-green));
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: white;
    margin: 0 auto 16px;
    box-shadow: 0 8px 24px rgba(37,211,102,0.35);
}
.auth-title { font-size: 22px; font-weight: 800; color: var(--text-primary); margin-bottom: 4px; }
.auth-subtitle { color: var(--text-muted); font-size: 14px; margin: 0; }

.auth-form .form-group { margin-bottom: 20px; }
.auth-help { text-align: center; padding-top: 20px; border-top: 1px solid var(--border-color); margin-top: 20px; }

.btn-login { padding: 12px; font-size: 15px; font-weight: 600; margin-top: 4px; }

.auth-footer-text {
    text-align: center;
    color: rgba(255,255,255,0.3);
    font-size: 12px;
    margin-top: 20px;
}

/* ============================================================================
   16. UTILIDADES
   ============================================================================ */
.tiny { font-size: 11px !important; }
.object-fit-cover { object-fit: cover; }
.spin { animation: spin 1s linear infinite; }

/* Tooltip wrappers */
[data-bs-toggle="tooltip"] { cursor: help; }

/* ============================================================================
   17. ANIMACIONES
   ============================================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes bounceIn {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.1); }
    100% { transform: scale(1); }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.4); opacity: 0.6; }
}
@keyframes floatBg {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(20px, -20px) scale(1.05); }
    66%      { transform: translate(-10px, 15px) scale(0.95); }
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ============================================================================
   18. RESPONSIVE
   ============================================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .status-type-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .page-header { flex-direction: column; }
    .page-header-actions { width: 100%; }
}

@media (max-width: 575.98px) {
    .page-content { padding: 16px; }
    .auth-card { padding: 28px 20px; }
    .kpi-value { font-size: 22px; }
    .status-type-grid { grid-template-columns: repeat(3, 1fr); }
    .phone-mockup { width: 160px; }
}

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