/* ============================================================
   CONTA3 - SISTEMA ERP
   Archivo de estilos principal
   ============================================================ */

/* ============================================================
   1. VARIABLES CSS
   ============================================================ */
:root {
    /* Colores Primarios */
    --color-primary: #FF4D4C;
    --color-primary-dark: #ff3635;
    --color-primary-light: #ff6b6a;
    --color-primary-lighter: #ffb3b3;
    --color-primary-lightest: #ffc4c4;

    /* Colores de Estado */
    --color-success: #28a745;
    --color-success-light: #20c997;
    --color-success-lighter: #e8f5e9;
    --color-info: #17a2b8;
    --color-warning: #ffc107;
    --color-danger: #dc3545;

    /* Colores de Fondo */
    --color-bg-light: #f8f9fa;
    --color-bg-lighter: #e9ecef;
    --color-bg-white: #ffffff;

    /* Colores de Texto */
    --color-text-primary: #212529;
    --color-text-secondary: #6c757d;
    --color-text-muted: #adb5bd;

    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, #FF4D4C 0%, #ff6b6a 100%);
    --gradient-primary-hover: linear-gradient(135deg, #ff3635 0%, #ff5555 100%);
    --gradient-success: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    --gradient-bg: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);

    /* Sombras */
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --shadow-primary: 0 4px 8px rgba(255, 77, 76, 0.3);

    /* Bordes */
    --border-radius-sm: 6px;
    --border-radius-md: 8px;
    --border-radius-lg: 10px;
    --border-radius-xl: 12px;

    /* Transiciones */
    --transition-base: all 0.3s ease;
    --transition-fast: all 0.2s ease;
    --transition-slow: all 0.4s ease;

    /* Espaciado */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--color-text-primary);
    background-color: var(--color-bg-light);
}

/* ============================================================
   3. COMPONENTES GLOBALES
   ============================================================ */

/* Header con gradiente rojo */
.bg-topbar {
    background: var(--gradient-primary);
    color: white;
}

.bg-gradient-custom {
    background: var(--gradient-primary);
    color: white;
}

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

/* ============================================================
   4. BOTONES
   ============================================================ */

/* Botón Principal (Rojo) */
.btn-topbar {
    background: var(--gradient-primary);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-md);
    transition: var(--transition-base);
    font-weight: 500;
}

.btn-topbar:hover {
    background: var(--gradient-primary-hover);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}

.btn-topbar:disabled {
    background: linear-gradient(135deg, var(--color-primary-lighter) 0%, var(--color-primary-lightest) 100%);
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

/* Botón Outline Primario */
.btn-outline-primary-custom {
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
    background: transparent;
    transition: var(--transition-base);
}

.btn-outline-primary-custom:hover {
    background: var(--color-primary);
    color: white;
}

/* ============================================================
   5. CARDS
   ============================================================ */

/* Card Base */
.card-custom {
    border: none;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    overflow: hidden;
}

.card-custom:hover {
    box-shadow: var(--shadow-md);
}

/* Stats Card */
.stats-card {
    border: none;
    border-radius: var(--border-radius-lg);
    transition: var(--transition-base);
    cursor: pointer;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stats-card .icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Plan Card */
.plan-card {
    transition: var(--transition-base);
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    border: 2px solid transparent;
}

.plan-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}

.plan-upgrade-card {
    border: 2px solid transparent;
    border-radius: var(--border-radius-xl);
    transition: var(--transition-base);
}

.plan-upgrade-card:hover {
    border-color: var(--color-success);
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1.5rem rgba(40, 167, 69, 0.2);
}

/* Suscripción Activa Card */
.suscripcion-activa-card {
    border-left: 5px solid var(--color-success);
    border-radius: var(--border-radius-lg);
}

/* ============================================================
   6. BADGES Y ETIQUETAS
   ============================================================ */

.badge-custom {
    padding: 0.35rem 0.65rem;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
}

.badge-success-subtle {
    background-color: var(--color-success-lighter);
    color: var(--color-success);
    border: 1px solid var(--color-success);
}

.feature-badge {
    padding: 0.5rem 0.75rem;
    background: var(--color-success-lighter);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* ============================================================
   7. FORMULARIOS
   ============================================================ */

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(255, 77, 76, 0.25);
}

.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(255, 77, 76, 0.25);
}

/* ============================================================
   8. MODALES
   ============================================================ */

.modal-content {
    border: none;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--color-bg-lighter);
    border-radius: var(--border-radius-xl) var(--border-radius-xl) 0 0;
}

.modal-footer {
    border-top: 1px solid var(--color-bg-lighter);
    border-radius: 0 0 var(--border-radius-xl) var(--border-radius-xl);
}

/* ============================================================
   9. BARRAS DE PROGRESO
   ============================================================ */

.progress {
    border-radius: var(--border-radius-lg);
    background-color: var(--color-bg-lighter);
    height: 10px;
}

.progress-bar {
    transition: width 0.6s ease;
    border-radius: var(--border-radius-lg);
}

/* ============================================================
   10. TABLAS
   ============================================================ */

.table-custom {
    border-collapse: separate;
    border-spacing: 0;
}

.table-custom thead th {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1rem;
    font-weight: 600;
}

.table-custom thead th:first-child {
    border-radius: var(--border-radius-md) 0 0 0;
}

.table-custom thead th:last-child {
    border-radius: 0 var(--border-radius-md) 0 0;
}

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

.table-custom tbody tr:hover {
    background-color: var(--color-bg-light);
}

/* ============================================================
   11. ALERTAS
   ============================================================ */

.alert-custom {
    border: none;
    border-radius: var(--border-radius-lg);
    border-left: 4px solid;
    box-shadow: var(--shadow-sm);
}

.alert-info-custom {
    background-color: #e7f3ff;
    border-left-color: var(--color-info);
    color: #004085;
}

.alert-warning-custom {
    background-color: #fff3cd;
    border-left-color: var(--color-warning);
    color: #856404;
}

.alert-danger-custom {
    background-color: #f8d7da;
    border-left-color: var(--color-danger);
    color: #721c24;
}

.alert-success-custom {
    background-color: var(--color-success-lighter);
    border-left-color: var(--color-success);
    color: #155724;
}

/* ============================================================
   12. PANELES DE INFORMACIÓN
   ============================================================ */

.info-group {
    padding: 0.75rem;
    background: var(--color-bg-light);
    border-radius: var(--border-radius-md);
    transition: var(--transition-fast);
}

.info-group:hover {
    background: var(--color-bg-lighter);
}

.precio-panel {
    background: var(--gradient-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
}

.price-annual {
    border: 2px dashed var(--color-success);
    border-radius: var(--border-radius-md);
}

/* ============================================================
   13. MOBILE CARDS
   ============================================================ */

.empresa-card-mobile {
    padding: 1rem;
    transition: var(--transition-fast);
}

.empresa-card-mobile:hover {
    background-color: var(--color-bg-light);
}

/* ============================================================
   14. UTILIDADES
   ============================================================ */

/* Text Utilities */
.text-monospace {
    font-family: 'Courier New', Courier, monospace;
}

/* Hover Effects */
.hover-lift {
    transition: var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in {
    animation: slideIn 0.4s ease-out;
}

/* ============================================================
   15. RESPONSIVE
   ============================================================ */

/* Mobile First Utilities */
@media (max-width: 767.98px) {
    .card-custom {
        border-radius: var(--border-radius-md);
    }
    
    .plan-card:hover {
        transform: none;
    }
    
    .stats-card:hover {
        transform: none;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 991.98px) {
    .card-custom {
        border-radius: var(--border-radius-lg);
    }
}

/* Desktop */
@media (min-width: 992px) {
    .card-custom {
        border-radius: var(--border-radius-xl);
    }
}

/* ============================================================
   16. LOADING STATES
   ============================================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-custom {
    width: 3rem;
    height: 3rem;
    border: 0.3rem solid var(--color-bg-lighter);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   17. DARK MODE (Opcional - Preparado para futuro)
   ============================================================ */

@media (prefers-color-scheme: dark) {
    /* Variables para modo oscuro se pueden agregar aquí */
}

/* ============================================================
   18. PRINT STYLES
   ============================================================ */

@media print {
    .no-print {
        display: none !important;
    }
    
    .card-custom {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    .btn-topbar,
    .btn {
        display: none;
    }
}

/* ============================================================
   FIN DE ESTILOS
   ============================================================ */
