/* =============================================================================
   Mail System - Tema Claro (Light Theme)
   Estilos compartidos para todas las páginas
   ============================================================================= */

/* --- Variables de color --- */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #f1f5f9;
    --border-color: #e2e8f0;
    --border-hover: #3b82f6;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-accent: #3b82f6;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.08);
}

/* --- Reset y Base --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
}

/* --- Scrollbar personalizado --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* --- Sidebar --- */
.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    width: 260px;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sidebar-logo h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.sidebar-logo p {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    border-right: 3px solid transparent;
}

.sidebar-link:hover {
    background: #eff6ff;
    color: var(--text-accent);
}

.sidebar-link.active {
    background: #eff6ff;
    color: var(--text-accent);
    border-right-color: #3b82f6;
    font-weight: 600;
}

.sidebar-link span.icon { font-size: 18px; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.sidebar-status {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #16a34a;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: pulse 2s infinite;
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* --- Contenido principal --- */
.main-content {
    margin-left: 260px;
    padding: 32px;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-header p {
    font-size: 14px;
    color: var(--text-muted);
}

.page-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

/* --- Tarjetas --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: #dbeafe;
}

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.06;
}

.stat-card.blue::before { background: #3b82f6; }
.stat-card.green::before { background: #22c55e; }
.stat-card.purple::before { background: #a855f7; }
.stat-card.amber::before { background: #f59e0b; }

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
}

.stat-icon-wrapper.blue { background: #eff6ff; }
.stat-icon-wrapper.green { background: #f0fdf4; }
.stat-icon-wrapper.purple { background: #faf5ff; }
.stat-icon-wrapper.amber { background: #fffbeb; }

.stat-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

.stat-footer {
    margin-top: 12px;
    display: flex;
    gap: 16px;
    font-size: 12px;
}

.stat-footer .green { color: #16a34a; }
.stat-footer .amber { color: #d97706; }
.stat-footer .red { color: #dc2626; }
.stat-footer .blue { color: #2563eb; }
.stat-footer .purple { color: #9333ea; }

/* --- Badge de estado --- */
.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.badge-blue { background: #eff6ff; color: #2563eb; }
.badge-green { background: #f0fdf4; color: #16a34a; }
.badge-amber { background: #fffbeb; color: #d97706; }
.badge-red { background: #fef2f2; color: #dc2626; }
.badge-slate { background: #f1f5f9; color: #64748b; }
.badge-purple { background: #faf5ff; color: #9333ea; }

/* --- Botones --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 8px;
}

.btn-green { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.btn-green:hover { background: #dcfce7; }
.btn-amber { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.btn-amber:hover { background: #fef3c7; }
.btn-red { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.btn-red:hover { background: #fee2e2; }
.btn-blue { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.btn-blue:hover { background: #dbeafe; }

/* --- Inputs --- */
.input-field {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.2s;
    outline: none;
}

.input-field:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: white;
}

.input-field::placeholder { color: #94a3b8; }

select.input-field { cursor: pointer; }

textarea.input-field {
    resize: vertical;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* --- Tablas --- */
.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-wrapper table { width: 100%; border-collapse: collapse; }

.table-wrapper th {
    text-align: left;
    padding: 14px 24px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    background: #fafbfc;
}

.table-wrapper td {
    padding: 14px 24px;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
}

.table-wrapper tr:hover td { background: #fafbfc; }
.table-wrapper tr:last-child td { border-bottom: none; }

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-muted);
}

/* --- Modales --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal-body {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    padding: 4px;
}

.modal-close:hover { color: var(--text-primary); }

/* --- Grid helpers --- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-cols-2xl-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

@media (max-width: 1280px) {
    .grid-cols-2xl-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-cols-2xl-4, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .main-content { margin-left: 0; padding: 16px; }
    .sidebar { display: none; }
}

/* --- Drop zone --- */
.drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 14px;
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
}

/* --- Alerts / Notifications --- */
.alert {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    border: 1px solid;
    margin-bottom: 16px;
}

.alert-success { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
.alert-error { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #d97706; border-color: #fde68a; }

/* --- Tags dinámicos --- */
.tag-btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
    background: #f1f5f9;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.tag-btn:hover { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }

/* --- Progress bars --- */
.progress-bar {
    width: 100%;
    height: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* --- Campaign card --- */
.campaign-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.campaign-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #dbeafe;
}

.campaign-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.campaign-metric {
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    background: #f8fafc;
}

.campaign-metric .value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.campaign-metric .label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- Animaciones --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeInUp 0.4s ease-out forwards; }
.fade-in-delay-1 { animation-delay: 0.1s; opacity: 0; }
.fade-in-delay-2 { animation-delay: 0.15s; opacity: 0; }
.fade-in-delay-3 { animation-delay: 0.2s; opacity: 0; }
.fade-in-delay-4 { animation-delay: 0.25s; opacity: 0; }

/* --- Section titles --- */
.section-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Filter buttons --- */
.filter-btn {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 8px;
    background: #f1f5f9;
    color: var(--text-secondary);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover { background: #e2e8f0; }
.filter-btn.active { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }

/* --- Pagination --- */
.page-btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    background: #f1f5f9;
    color: var(--text-secondary);
}

.page-btn:hover { background: #e2e8f0; }
.page-btn.active { background: #3b82f6; color: white; }

/* --- Radio options --- */
.radio-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.radio-option:hover { border-color: #93c5fd; background: #eff6ff; }
.radio-option input[type="radio"] { accent-color: #3b82f6; }
