/* ==========================================================================
   SISTEMA DE DISEÑO - AZURACAST SUBSCRIPTIONS
   ========================================================================== */

:root {
    /* Colores base */
    --bg-main: #090d16;
    --bg-surface: rgba(22, 28, 45, 0.5);
    --bg-surface-hover: rgba(22, 28, 45, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(139, 92, 246, 0.4);
    
    /* Colores de marca y estado */
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.35);
    --primary-dark: #7c3aed;
    --secondary: #6366f1;
    --accent: #d946ef;
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);

    /* Texto */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Tipografía y sombras */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --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.25), 0 10px 10px -5px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px var(--primary-glow);
    
    /* Bordes */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transiciones */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   ESTILOS GENERALES
   ========================================================================== */

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ==========================================================================
   VISTA DE AUTENTICACIÓN (LOGIN)
   ========================================================================== */

.auth-page {
    background: radial-gradient(circle at center, #131230 0%, #060813 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-wrapper {
    position: relative;
    width: 100%;
    max-width: 440px;
    padding: 1.5rem;
    z-index: 10;
}

/* Efectos de brillo de fondo */
.auth-glow-1 {
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    top: -100px;
    left: -100px;
    z-index: -1;
    filter: blur(40px);
    pointer-events: none;
}

.auth-glow-2 {
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(217, 70, 239, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
    bottom: -100px;
    right: -100px;
    z-index: -1;
    filter: blur(40px);
    pointer-events: none;
}

/* Tarjeta Glassmorphic */
.auth-card {
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-xl);
    transition: var(--transition);
}

.auth-card:hover {
    border-color: rgba(139, 92, 246, 0.25);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(139, 92, 246, 0.05);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: var(--shadow-glow);
    margin-bottom: 1.25rem;
}

.auth-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Alertas */
.auth-alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
}

.auth-alert.error {
    background: var(--danger-bg);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.2);
}

.auth-alert.success {
    background: var(--success-bg);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.2);
}

/* Formularios */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    transition: var(--transition);
    pointer-events: none;
}

.input-icon-wrapper input,
.input-icon-wrapper select,
.input-icon-wrapper textarea,
.form-control {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    transition: var(--transition);
    outline: none;
}

.input-icon-wrapper input {
    padding-left: 2.75rem;
}

.input-icon-wrapper input:focus,
.input-icon-wrapper select:focus,
.input-icon-wrapper textarea:focus,
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.25);
    background: rgba(15, 23, 42, 0.8);
}

.input-icon-wrapper input:focus + .input-icon,
.input-icon-wrapper input:focus ~ .input-icon {
    color: var(--primary);
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-sans);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #ffffff;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.5);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: var(--danger-bg);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.btn-success {
    background: var(--success-bg);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: var(--success);
    color: white;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.btn-block {
    display: flex;
    width: 100%;
}

/* ==========================================================================
   ESTRUCTURA DE APLICACIÓN (DASHBOARD & INTERIOR)
   ========================================================================== */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Barra Lateral (Sidebar) */
.sidebar {
    width: 280px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: var(--shadow-glow);
}

.sidebar-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}

.sidebar-title span {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-secondary);
    display: block;
}

.sidebar-menu {
    list-style: none;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-item a:hover {
    background: rgba(255, 255, 255, 0.03);
    color: white;
}

.sidebar-item.active a {
    background: rgba(139, 92, 246, 0.15);
    color: white;
    border: 1px solid rgba(139, 92, 246, 0.25);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.05);
}

.sidebar-item a svg {
    transition: var(--transition);
}

.sidebar-item.active a svg {
    color: var(--primary);
    filter: drop-shadow(0 0 4px var(--primary-glow));
}

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

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-glow);
    border: 1px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info {
    line-height: 1.2;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Área Principal (Main Content) */
.main-content {
    margin-left: 280px;
    flex-grow: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

/* Encabezado Principal (Topbar) */
.topbar {
    background: rgba(9, 13, 22, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Indicador de Conexión a Azuracast */
.azuracast-status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

.status-dot.warning {
    background-color: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Botón Hamburguesa Móvil */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

/* Contenedor del Contenido */
.content-body {
    padding: 2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ==========================================================================
   COMPONENTES DEL DASHBOARD & MÓDULOS
   ========================================================================== */

/* Grid de Estadísticas (Mini Cards) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    background: var(--bg-surface-hover);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}

.stat-change {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

.stat-icon-box {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: var(--transition);
}

.stat-card:hover .stat-icon-box {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

/* Grid de Secciones Medias */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

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

/* Tarjetas Contenedoras (Módulos grandes) */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: var(--transition);
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title svg {
    color: var(--primary);
}

/* Tablas Modernas */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th {
    padding: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 2px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    padding: 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tr {
    transition: var(--transition);
}

.table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

.table tr:last-child td {
    border-bottom: none;
}

/* Badges de Estados */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.badge-active {
    background: var(--success-bg);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.2);
}

.badge-suspended {
    background: var(--warning-bg);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.2);
}

.badge-expired {
    background: var(--danger-bg);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}

/* Lista de Alertas */
.alert-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.alert-item:hover {
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.03);
}

.alert-icon-box {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-item.danger .alert-icon-box {
    background: var(--danger-bg);
    color: #f87171;
}

.alert-item.warning .alert-icon-box {
    background: var(--warning-bg);
    color: #fbbf24;
}

.alert-details {
    flex-grow: 1;
    line-height: 1.4;
}

.alert-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
}

.alert-subtext {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Estilos de Modales */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 550px;
    box-shadow: var(--shadow-xl);
    transform: translateY(-20px);
    transition: var(--transition);
    overflow: hidden;
}

.modal.open .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: white;
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.01);
}

/* ==========================================================================
   ESTILOS DE PESTAÑAS, BOTONES DE ACCION & ACCESORIOS
   ========================================================================== */

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon.edit:hover {
    background: var(--info-bg);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
}

.btn-icon.delete:hover {
    background: var(--danger-bg);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-icon.suspend:hover {
    background: var(--warning-bg);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}

/* Módulo de Búsqueda y Filtros */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.search-box {
    flex-grow: 1;
    max-width: 400px;
}

/* Estilos de Vista de Estación Azuracast vinculada en Subscripción */
.station-preview-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(139, 92, 246, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-md);
    margin-top: 0.5rem;
}

.station-preview-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.station-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.station-meta h4 {
    font-size: 0.9rem;
    color: white;
    margin-bottom: 0.15rem;
}

.station-meta p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.station-controls {
    display: flex;
    gap: 0.5rem;
}

/* ==========================================================================
   ESTILOS RESPONSIVOS
   ========================================================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .topbar {
        padding: 1rem;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .content-body {
        padding: 1rem;
        gap: 1rem;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: none;
    }
}
