/**
 * =====================================================
 * WALLET360 - ESTILOS GLOBALES
 * =====================================================
 * Archivo: assets/css/style.css
 * Descripción: Estilos globales del sistema
 * Versión: 1.0
 * Fecha: 20 de Noviembre 2024
 * =====================================================
 */

/* =====================================================
   VARIABLES CSS
   ===================================================== */
:root {
    /* Colores Dinámicos desde Config (se sobrescriben en header.php) */
    --color-primary: #ff1744;
    --color-secondary: #34495e;
    --color-accent: #ff5252;

    /* Colores Principales - Usar variables dinámicas */
    --primary-color: var(--color-primary);
    --primary-dark: color-mix(in srgb, var(--color-primary) 80%, black);
    --primary-light: color-mix(in srgb, var(--color-primary) 80%, white);
    --secondary-color: #ffffff;
    --secondary-dark: #f0f2f7;
    --accent-color: var(--color-accent);
    --accent-dark: color-mix(in srgb, var(--color-accent) 80%, black);

    /* Colores de Estado */
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;

    /* Colores Neutros */
    --white: #ffffff;
    --light-gray: #f8f9fa;
    --gray: #6c757d;
    --dark-gray: #343a40;
    --black: #000000;

    /* Sombras */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.2);

    /* Border Radius */
    --radius-sm: 5px;
    --radius-md: 10px;
    --radius-lg: 15px;
    --radius-xl: 20px;

    /* Transiciones */
    --transition: all 0.3s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-gray);
    background: #f7f9fd;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =====================================================
   TIPOGRAFÍA
   ===================================================== */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--dark-gray);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* =====================================================
   CONTAINERS Y LAYOUTS
   ===================================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-sm {
    max-width: 600px;
}

.container-lg {
    max-width: 1400px;
}

/* Centrar contenido verticalmente */
.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -10px;
}

.col {
    flex: 1;
    padding: 10px;
}

.col-2 { flex: 0 0 50%; max-width: 50%; }
.col-3 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-4 { flex: 0 0 25%; max-width: 25%; }

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    margin-bottom: 20px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    transform: translateY(-2px);
}

.card-header {
    padding: 20px 30px;
    background: var(--primary-color);
    color: var(--white);
    border-bottom: 2px solid rgba(255,255,255,0.2);
}

.card-header h1,
.card-header h2,
.card-header h3 {
    color: var(--white);
    margin-bottom: 0;
}

.card-body {
    padding: 30px;
}

.card-footer {
    padding: 20px 30px;
    background: var(--light-gray);
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

/* Card con tamaño específico */
.card-auth {
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
}

.card-dashboard {
    width: 100%;
}

/* =====================================================
   FORMULARIOS
   ===================================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-gray);
    font-size: 0.95rem;
}

.form-label .required {
    color: var(--error-color);
    margin-left: 3px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control::placeholder {
    color: #aaa;
}

.form-control:disabled {
    background: var(--light-gray);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Input con icono */
.input-group {
    position: relative;
}

.input-group .input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 1.2rem;
}

.input-group .form-control {
    padding-left: 45px;
}

/* Select personalizado */
select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

/* Checkbox y Radio */
.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
}

.form-check label {
    cursor: pointer;
    user-select: none;
}

/* Texto de ayuda */
.form-text {
    display: block;
    margin-top: 5px;
    font-size: 0.875rem;
    color: var(--gray);
}

/* Estados de validación */
.form-control.is-valid {
    border-color: var(--success-color);
}

.form-control.is-invalid {
    border-color: var(--error-color);
}

.valid-feedback,
.invalid-feedback {
    display: block;
    margin-top: 5px;
    font-size: 0.875rem;
}

.valid-feedback {
    color: var(--success-color);
}

.invalid-feedback {
    color: var(--error-color);
}

/* =====================================================
   BOTONES
   ===================================================== */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.5;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Botón primario */
.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

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

/* Botón secundario */
.btn-secondary {
    background: var(--gray);
    color: var(--white);
}

.btn-secondary:hover {
    background: var(--dark-gray);
    color: var(--white);
}

/* Botón success */
.btn-success {
    background: var(--success-color);
    color: var(--white);
}

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

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

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

/* Tamaños de botones */
.btn-sm {
    padding: 8px 20px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 15px 40px;
    font-size: 1.125rem;
}

/* Botón de bloque completo */
.btn-block {
    display: block;
    width: 100%;
}

/* =====================================================
   ALERTAS Y MENSAJES
   ===================================================== */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    animation: slideInDown 0.3s ease;
}

.alert-icon {
    font-size: 1.5rem;
    margin-right: 15px;
}

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

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

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

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: var(--info-color);
}

/* Flash messages */
.flash-message {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    z-index: 9999;
    animation: slideInRight 0.3s ease;
}

/* =====================================================
   BADGES Y ETIQUETAS
   ===================================================== */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: var(--primary-color);
    color: var(--white);
}

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

.badge-warning {
    background: var(--warning-color);
    color: var(--dark-gray);
}

.badge-info {
    background: var(--info-color);
    color: var(--white);
}

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

/* Badges de categoría */
.badge-cat-1 { background: #95a5a6; color: var(--white); }
.badge-cat-2 { background: #3498db; color: var(--white); }
.badge-cat-3 { background: #9b59b6; color: var(--white); }
.badge-cat-4 { background: #e74c3c; color: var(--white); }
.badge-cat-5 { background: #f39c12; color: var(--white); }
.badge-cat-6 { background: #16a085; color: var(--white); }
.badge-cat-7 { background: #c0392b; color: var(--white); }
.badge-cat-8 { background: #2c3e50; color: var(--white); }

/* =====================================================
   TABLAS
   ===================================================== */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table thead {
    background: var(--primary-color);
    color: var(--white);
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
}

.table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--light-gray);
}

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

/* Tabla responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* =====================================================
   ESTADÍSTICAS Y STATS CARDS
   ===================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border-top: 4px solid var(--primary-color);
}

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

.stat-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-gray);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* =====================================================
   NAVEGACIÓN
   ===================================================== */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow-md);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 25px;
}

.navbar-nav a {
    color: var(--dark-gray);
    font-weight: 500;
    padding: 8px 15px;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.navbar-nav a:hover {
    background: var(--light-gray);
    text-decoration: none;
}

.navbar-nav a.active {
    background: var(--primary-color);
    color: var(--white);
}

/* =====================================================
   UTILIDADES
   ===================================================== */

/* Espaciado */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* Texto */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-error { color: var(--error-color); }
.text-muted { color: var(--gray); }

.text-bold { font-weight: 700; }
.text-small { font-size: 0.875rem; }
.text-large { font-size: 1.25rem; }

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

/* Flex utilities */
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }

/* Divider */
.divider {
    height: 1px;
    background: #e0e0e0;
    margin: 30px 0;
}

/* =====================================================
   ANIMACIONES
   ===================================================== */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* =====================================================
   LOADING SPINNER
   ===================================================== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.btn .spinner {
    margin-right: 8px;
    vertical-align: middle;
}

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */

/* Tablets */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }

    .card-body {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .col-2,
    .col-3,
    .col-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

        .navbar .container {
        flex-direction: column;
        gap: 10px;
    }

    .navbar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }

    .navbar-nav a {
        padding: 8px 10px;
        font-size: 0.95rem;
    }


    .flash-message {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* Móviles */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .card-body {
        padding: 15px;
    }

    .btn {
        padding: 10px 20px;
    }

    .form-control {
        padding: 10px 12px;
    }
}

/* =====================================================
   FIN DE ESTILOS
   ===================================================== */
#app {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.page-auth {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    min-height: calc(100vh - 140px);
    background: radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.15), transparent 40%),
                radial-gradient(circle at 90% 0%, rgba(255, 23, 68, 0.15), transparent 45%),
                linear-gradient(135deg, #050d24 0%, #0f1e3f 100%);
    overflow: hidden;
}

.page-auth::before,
.page-auth::after {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    pointer-events: none;
}

.page-auth::before {
    background: rgba(255, 23, 68, 0.4);
    top: -120px;
    left: -160px;
}

.page-auth::after {
    background: rgba(38, 198, 218, 0.35);
    bottom: -160px;
    right: -140px;
}

.auth-wrapper {
    position: relative;
    width: 100%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    z-index: 2;
}

.card-auth {
    border-radius: 26px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 40px 70px rgba(7, 12, 32, 0.4);
    backdrop-filter: blur(6px);
}

.card-auth .card-body {
    padding: 34px;
}

.auth-card-header {
    background: linear-gradient(145deg, #fefefe 0%, #e6ebf5 100%);
    border-bottom: 4px solid var(--primary-color);
    padding: 32px 32px 22px;
}

.auth-card-header h2 {
    margin-bottom: 6px;
    font-weight: 700;
    color: #1f2a37;
}

.auth-card-header p {
    margin: 0;
    font-size: 0.95rem;
    color: #6b7280;
}

.auth-header-brand {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.auth-header-logo {
    width: 180px;
    height: auto;
    object-fit: contain;
}

.card-auth .form-text {
    color: #6b7280;
}

.input-group-icon .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-group-icon .form-control {
    padding-left: 50px;
}

.password-group {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.password-toggle svg {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.password-toggle .icon-eye-off {
    opacity: 0;
    transform: scale(0.8);
}

.password-toggle.visible .icon-eye {
    opacity: 0;
    transform: scale(0.8);
}

.password-toggle.visible .icon-eye-off {
    opacity: 1;
    transform: scale(1);
}

.password-toggle .hide-label,
.password-toggle .show-label {
    display: none;
}

.input-icon svg {
    vertical-align: middle;
    color: var(--primary-color);
}

.card-auth .form-control {
    border: 1.5px solid #e3e7ef;
    border-radius: 14px;
    background: #fcfcff;
}

.card-auth .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 23, 68, 0.15);
}

.auth-submit {
    margin-top: 10px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%) !important;
    border: none !important;
    box-shadow: 0 18px 30px rgba(255, 65, 108, 0.35);
    color: #fff !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 35px rgba(255, 65, 108, 0.45);
}

.auth-card-footer {
    background: #fafbff;
    border-top: 1px solid rgba(15, 25, 45, 0.08);
    font-size: 0.95rem;
    color: #6b7280;
}

.auth-card-footer a {
    font-weight: 600;
}

.auth-credits {
    margin-top: 12px;
    font-size: 0.92rem;
    color: #1f2a37;
    background: linear-gradient(120deg, rgba(255, 65, 108, 0.12), rgba(22, 31, 58, 0.12));
    border-radius: 999px;
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.02em;
}


.auth-credits .credits-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #ff416c;
    letter-spacing: 0.15em;
}

.auth-credits strong {
    color: #111727;
    font-weight: 700;
}

.auth-extras {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 6px;
}

.auth-highlight {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px 20px;
    color: #f6f8ff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
}

.auth-highlight strong {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #ffd166;
    margin-bottom: 4px;
}

.auth-badges {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.auth-badges div {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 14px;
    text-align: center;
    color: #e2e7ff;
    font-size: 0.85rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.auth-badges span {
    display: block;
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.auth-tip {
    background: rgba(0, 0, 0, 0.35);
    color: #fefefe;
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 0.9rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.auth-tip strong {
    color: #8ce0ff;
}

/* Asegurar que SweetAlert funcione correctamente */
.swal2-popup {
    z-index: 99999 !important;
}

.swal2-container {
    z-index: 99998 !important;
}

@media (max-width: 768px) {
    .page-auth {
        padding: 32px 16px;
        min-height: auto;
    }

    .card-auth .card-body {
        padding: 26px;
    }
}
