/* ============================================================
   SENDERA v2.0 - ESTILOS CONSOLIDADOS Y MODERNOS
   Consolidación definitiva: styles.css + styles-modern.css
   ============================================================ */

/* ============================================================
   VARIABLES GLOBALES Y TEMA
   ============================================================ */
:root {
    /* Colores Principales */
    --primary-color: #0f172a;
    --secondary-color: #1e293b;
    --accent-color: #3b82f6;
    --accent-cyan: #00d9ff;
    --accent-cyan-alt: #00bcd4;
    
    /* Colores de Estado */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    
    /* Fondos */
    --light-bg: #f8fafc;
    --dark-bg: #0f172a;
    --glass-bg: rgba(15, 23, 42, 0.85);
    
    /* Bordes y Vidrio */
    --border-color: #e2e8f0;
    --glass-border: rgba(0, 217, 255, 0.2);
    
    /* Tipografía */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* Sombras */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 8px 24px rgba(0, 217, 255, 0.15);
    --shadow-glow: 0 0 30px rgba(0, 217, 255, 0.3);
    
    /* Radio de Bordes */
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    
    /* Transiciones */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease-in-out;
}

/* ============================================================
   RESET Y ESTILOS BASE
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f5f5f5 0%, #eeeeee 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
    font-weight: 400;
    height: 100vh;
    overflow: hidden;
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.container {
    max-width: 1600px;
    margin: 20px auto;
    background: white;
    height: calc(100vh - 40px);
    box-shadow: var(--shadow-xl);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    overflow: auto;
    display: flex;
}

.sidebar {
    width: 280px;
    background: var(--primary-color);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    overflow-y: auto;
    flex-shrink: 0;
}

.content {
    flex: 1;
    overflow-y: auto;
    background: white;
}

/* ============================================================
   TABS / SECCIONES PRINCIPALES
   ============================================================ */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
    background: var(--glass-bg);
    border: 1.5px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-card);
    padding: 18px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 50;
    flex-shrink: 0;
}

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

.logo-img {
    max-height: 40px;
    width: auto;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.logo-text h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.logo-slogan {
    font-size: 0.85rem;
    color: var(--accent-cyan);
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
}

.user-menu {
    position: relative;
}

.user-btn {
    background: rgba(0, 217, 255, 0.1);
    border: 1.5px solid var(--accent-cyan);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--accent-cyan);
    font-size: 1.3rem;
    transition: var(--transition-fast);
}

.user-btn:hover {
    background: rgba(0, 217, 255, 0.2);
    box-shadow: 0 0 12px rgba(0, 217, 255, 0.25);
}

.user-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    background: var(--glass-bg);
    border: 1.5px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-card);
    min-width: 180px;
    overflow: hidden;
    z-index: 100;
}

.user-dropdown a {
    display: block;
    padding: 12px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 217, 255, 0.1);
    transition: var(--transition-fast);
}

.user-dropdown a:last-child {
    border-bottom: none;
}

.user-dropdown a:hover,
.user-dropdown a.active {
    background: rgba(0, 217, 255, 0.1);
    color: var(--accent-cyan);
}

/* ============================================================
   NAVEGACIÓN
   ============================================================ */
.nav-tabs {
    display: flex;
    gap: 8px;
    background: var(--glass-bg);
    border: 1.5px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 10px 16px;
    margin-bottom: 24px;
    overflow-x: auto;
    scroll-behavior: smooth;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(20px);
}

.nav-tabs::-webkit-scrollbar {
    height: 6px;
}

.nav-tabs::-webkit-scrollbar-track {
    background: rgba(0, 217, 255, 0.05);
    border-radius: 10px;
}

.nav-tabs::-webkit-scrollbar-thumb {
    background: var(--accent-cyan);
    border-radius: 10px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tab-btn:hover {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    background: rgba(0, 217, 255, 0.1);
}

.tab-btn.active {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    background: rgba(0, 217, 255, 0.1);
    box-shadow: 0 0 12px rgba(0, 217, 255, 0.25);
}

/* ============================================================
   BOTONES
   ============================================================ */
button, .btn {
    font-family: inherit;
    cursor: pointer;
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 16px;
    font-weight: 600;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent-cyan);
    color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--accent-cyan-alt);
    box-shadow: 0 0 16px rgba(0, 217, 255, 0.4);
}

.btn-secondary {
    background: rgba(0, 217, 255, 0.1);
    color: var(--accent-cyan);
    border: 1.5px solid var(--accent-cyan);
}

.btn-secondary:hover {
    background: rgba(0, 217, 255, 0.2);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

/* ============================================================
   TARJETAS Y CONTENEDORES
   ============================================================ */
.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-cyan);
}

.stat-card,
.chart-container,
.integration-card,
.settings-section {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(15px);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    padding: 20px;
}

.stat-card:hover,
.chart-container:hover,
.integration-card:hover,
.settings-section:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
    border-color: rgba(0, 217, 255, 0.4);
}

/* ============================================================
   FORMULARIOS
   ============================================================ */
input, textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-cyan);
    background: rgba(0, 217, 255, 0.05);
    box-shadow: 0 0 8px rgba(0, 217, 255, 0.2);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 16px;
}

/* ============================================================
   TABLAS
   ============================================================ */
table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--light-bg);
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background: rgba(0, 217, 255, 0.05);
}

/* ============================================================
   MODALES
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 24px;
    max-width: 600px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
}

/* ============================================================
   ALERTAS Y NOTIFICACIONES
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success-color);
    color: #065f46;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    color: #7f1d1d;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning-color);
    color: #78350f;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--info-color);
    color: #1e3a8a;
}

/* ============================================================
   SCROLLBARS
   ============================================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 217, 255, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-cyan);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan-alt);
}

/* ============================================================
   UTILIDADES
   ============================================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

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

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        height: calc(100vh - 20px);
    }

    main {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .header {
        padding: 12px 16px;
        margin: 10px;
    }

    .nav-tabs {
        flex-wrap: wrap;
    }

    .modal-content {
        width: 95%;
        max-height: 80vh;
    }
}
