/**
 * Estilos Personalizados
 * Sistema de Gestión de Suscripciones
 * Diseño responsive y profesional con animaciones
 */

/* ============================================
   VARIABLES CSS
   ============================================ */
:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-color: #f8f9fc;
    --dark-color: #5a5c69;
    
    --sidebar-width: 250px;
    --header-height: 60px;
    
    --transition-speed: 0.3s;
    --box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    --box-shadow-hover: 0 0.25rem 2.5rem 0 rgba(58, 59, 69, 0.25);
}

/* ============================================
   ESTILOS GENERALES
   ============================================ */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.95rem;
    background-color: #f8f9fc;
    color: #5a5c69;
    overflow-x: hidden;
}

.main-content {
    min-height: calc(100vh - var(--header-height));
    padding-top: 20px;
}

/* ============================================
   NAVEGACIÓN Y HEADER
   ============================================ */
.navbar {
    height: var(--header-height);
    box-shadow: var(--box-shadow);
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
}

.navbar-brand {
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all var(--transition-speed);
}

.navbar-brand:hover {
    transform: scale(1.05);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 0;
    box-shadow: var(--box-shadow);
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fc 100%);
}

.sidebar-sticky {
    position: relative;
    top: 0;
    height: calc(100vh - var(--header-height));
    padding-top: 0.5rem;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar .nav-link {
    font-weight: 500;
    color: #5a5c69;
    padding: 0.75rem 1rem;
    transition: all var(--transition-speed);
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover {
    color: var(--primary-color);
    background-color: #f8f9fc;
    border-left-color: var(--primary-color);
    transform: translateX(5px);
}

.sidebar .nav-link.active {
    color: var(--primary-color);
    background-color: #e3e6f0;
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
    width: 20px;
    text-align: center;
}

.sidebar-heading {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 0.75rem 1rem 0.25rem;
}

/* ============================================
   TARJETAS DE ESTADÍSTICAS
   ============================================ */
.stat-card {
    border: none;
    border-left: 4px solid;
    box-shadow: var(--box-shadow);
    transition: all var(--transition-speed);
    overflow: hidden;
    position: relative;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 100%);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-hover);
}

.stat-card-success {
    border-left-color: var(--success-color);
}

.stat-card-info {
    border-left-color: var(--info-color);
}

.stat-card-warning {
    border-left-color: var(--warning-color);
}

.stat-card-danger {
    border-left-color: var(--danger-color);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.3;
}

.stat-card-success .stat-icon {
    color: var(--success-color);
}

.stat-card-info .stat-icon {
    color: var(--info-color);
}

.stat-card-warning .stat-icon {
    color: var(--warning-color);
}

.stat-card-danger .stat-icon {
    color: var(--danger-color);
}

/* ============================================
   TARJETAS DE ALERTA
   ============================================ */
.alert-card-danger {
    border-left: 4px solid var(--danger-color);
    box-shadow: var(--box-shadow);
    animation: pulse-danger 2s infinite;
}

.alert-card-warning {
    border-left: 4px solid var(--warning-color);
    box-shadow: var(--box-shadow);
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-danger {
    0%, 100% {
        box-shadow: 0 0.15rem 1.75rem 0 rgba(231, 74, 59, 0.15);
    }
    50% {
        box-shadow: 0 0.25rem 2.5rem 0 rgba(231, 74, 59, 0.35);
    }
}

@keyframes pulse-warning {
    0%, 100% {
        box-shadow: 0 0.15rem 1.75rem 0 rgba(246, 194, 62, 0.15);
    }
    50% {
        box-shadow: 0 0.25rem 2.5rem 0 rgba(246, 194, 62, 0.35);
    }
}

/* ============================================
   TABLAS
   ============================================ */
.table {
    color: #5a5c69;
}

.table thead th {
    background: linear-gradient(135deg, #f8f9fc 0%, #e3e6f0 100%);
    color: #5a5c69;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e3e6f0;
    padding: 1rem;
}

.table tbody tr {
    transition: all var(--transition-speed);
}

.table tbody tr:hover {
    background-color: #f8f9fc;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ============================================
   BOTONES
   ============================================ */
.btn {
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.35rem;
    transition: all var(--transition-speed);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    font-weight: 600;
    padding: 0.35em 0.65em;
    border-radius: 0.25rem;
    letter-spacing: 0.5px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    border: none;
    box-shadow: var(--box-shadow);
    border-radius: 0.5rem;
    overflow: hidden;
    transition: all var(--transition-speed);
}

.card:hover {
    box-shadow: var(--box-shadow-hover);
}

.card-header {
    background: linear-gradient(135deg, #f8f9fc 0%, #e3e6f0 100%);
    border-bottom: 2px solid #e3e6f0;
    font-weight: 700;
    padding: 1rem 1.25rem;
}

/* ============================================
   MODALES
   ============================================ */
.modal-content {
    border: none;
    box-shadow: 0 0.5rem 3rem rgba(0, 0, 0, 0.25);
    border-radius: 0.5rem;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #224abe 100%);
    color: white;
    border-bottom: none;
    border-radius: 0.5rem 0.5rem 0 0;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-footer {
    border-top: 2px solid #e3e6f0;
    background-color: #f8f9fc;
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form-control,
.form-select {
    border: 1px solid #d1d3e2;
    border-radius: 0.35rem;
    padding: 0.6rem 0.75rem;
    transition: all var(--transition-speed);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.form-label {
    font-weight: 600;
    color: #5a5c69;
    margin-bottom: 0.5rem;
}

/* ============================================
   ALERTAS
   ============================================ */
.alert {
    border: none;
    border-left: 4px solid;
    border-radius: 0.35rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background-color: #f8f9fc;
    border-top: 1px solid #e3e6f0;
    margin-top: 3rem;
}

/* ============================================
   ANIMACIONES PERSONALIZADAS
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablets */
@media (max-width: 991.98px) {
    .sidebar {
        position: static;
        height: auto;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
}

/* Móviles */
@media (max-width: 767.98px) {
    body {
        font-size: 0.875rem;
    }
    
    .navbar-brand {
        font-size: 0.9rem;
    }
    
    .h2 {
        font-size: 1.5rem;
    }
    
    .table {
        font-size: 0.8rem;
    }
    
    .btn-group-sm .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
    
    .stat-card .h2 {
        font-size: 1.25rem;
    }
    
    .stat-icon {
        font-size: 1.75rem;
    }
    
    /* Tabla responsive con scroll horizontal */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

/* Móviles pequeños */
@media (max-width: 575.98px) {
    .main-content {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
}

/* ============================================
   UTILIDADES
   ============================================ */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Loader */
.loader {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}
