/* ============================================
   SISTEMA SEGURO - ESTILOS MODERNOS
   Colores: Azul, Negro, Blanco, Gris
   ============================================ */

/* Reset y Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Paleta de colores principal */
    --primary-blue: #1e3a5f;
    --secondary-blue: #2c5f7f;
    --accent-blue: #3d7fa6;
    --dark-blue: #0d1b2a;
    --light-blue: #e8f1f8;
    
    /* Grises */
    --light-gray: #FAF9F7;
    --medium-gray: #94a3b8;
    --dark-gray: #334155;
    --border-gray: #e2e8f0;
    
    /* Colores funcionales */
    --white: #ffffff;
    --black: #0a0a0a;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* Sombras */
    --shadow-sm: 0 2px 8px rgba(30, 58, 95, 0.08);
    --shadow-md: 0 4px 16px rgba(30, 58, 95, 0.12);
    --shadow-lg: 0 10px 40px rgba(30, 58, 95, 0.15);
    --shadow-xl: 0 20px 60px rgba(30, 58, 95, 0.2);
    
    /* Transiciones */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-gray);
    background-color: var(--light-gray);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   PÁGINA DE AUTENTICACIÓN
   ============================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--light-gray);
}

/* Formas geométricas animadas de fondo */
.shapes-background {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 0;
}

.shape {
    position: absolute;
    border: 2px solid;
    opacity: 0.15;
    animation: float-shape 6s ease-in-out infinite;
}

.shape-1 {
    width: 40px;
    height: 40px;
    border-color: var(--primary-blue);
    top: 10%;
    left: 10%;
    transform: rotate(45deg);
    animation-delay: 0s;
}

.shape-2 {
    width: 30px;
    height: 30px;
    border-color: var(--secondary-blue);
    top: 20%;
    right: 15%;
    border-radius: 50%;
    animation-delay: 0.5s;
}

.shape-3 {
    width: 35px;
    height: 35px;
    border-color: var(--accent-blue);
    bottom: 20%;
    left: 12%;
    transform: rotate(15deg);
    animation-delay: 1s;
}

.shape-4 {
    width: 25px;
    height: 25px;
    border-color: var(--dark-blue);
    bottom: 15%;
    right: 18%;
    border-radius: 50%;
    animation-delay: 0.3s;
}

.shape-5 {
    width: 32px;
    height: 32px;
    border-color: var(--primary-blue);
    top: 60%;
    left: 5%;
    transform: rotate(30deg);
    animation-delay: 0.7s;
}

.shape-6 {
    width: 28px;
    height: 28px;
    border-color: var(--secondary-blue);
    top: 12%;
    right: 40%;
    border-radius: 50%;
    animation-delay: 1.2s;
}

/* Círculos decorativos grandes */
.circle-decor {
    position: fixed;
    border: 2px solid rgba(30, 58, 95, 0.06);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.circle-1 {
    width: 400px;
    height: 400px;
    top: -100px;
    right: -100px;
    animation: pulse-circle 8s ease-in-out infinite;
}

.circle-2 {
    width: 350px;
    height: 350px;
    bottom: -80px;
    left: -80px;
    animation: pulse-circle 7s ease-in-out infinite 1s;
}

.circle-3 {
    width: 200px;
    height: 200px;
    top: 25%;
    left: 8%;
    animation: pulse-circle 6s ease-in-out infinite 0.5s;
}

/* Animaciones */
@keyframes float-shape {
    0%, 100% {
        transform: translateY(0) rotate(var(--rotation, 45deg));
        opacity: 0.15;
    }
    50% {
        transform: translateY(-20px) rotate(var(--rotation, 45deg));
        opacity: 0.25;
    }
}

@keyframes pulse-circle {
    0%, 100% {
        transform: scale(1);
        opacity: 0.06;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.1;
    }
}

/* Wrapper de autenticación */
.auth-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    padding: 20px;
}

/* Tarjeta moderna */
.auth-card-modern {
    background: var(--white);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: slideUp 0.6s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Botón volver */
.back-button {
    margin-bottom: 24px;
}

.back-button a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--medium-gray);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-fast);
}

.back-button a:hover {
    color: var(--primary-blue);
}

.back-button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Header de autenticación */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-circle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: var(--shadow-md);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.logo-icon {
    width: 40px;
    height: 40px;
    fill: var(--white);
}

.auth-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 8px;
}

.auth-header p {
    font-size: 15px;
    color: var(--medium-gray);
}

/* Formulario moderno */
.auth-form-modern {
    margin-top: 32px;
}

.form-group-modern {
    margin-bottom: 24px;
}

.form-group-modern label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark-gray);
    font-weight: 600;
    font-size: 14px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    width: 20px;
    height: 20px;
    fill: var(--medium-gray);
    pointer-events: none;
    z-index: 1;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--border-gray);
    border-radius: 12px;
    font-size: 15px;
    transition: var(--transition-fast);
    background: var(--white);
    color: var(--dark-gray);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.08);
}

.input-wrapper input::placeholder {
    color: var(--medium-gray);
}

/* Input de código */
.code-input-wrapper {
    display: flex;
    justify-content: center;
}

.code-input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border-gray);
    border-radius: 12px;
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 12px;
    font-family: 'Courier New', monospace;
    transition: var(--transition-fast);
}

.code-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.08);
}

/* Toggle password moderno */
.toggle-password-modern {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: var(--transition-fast);
}

.toggle-password-modern:hover {
    background: var(--light-blue);
}

.toggle-password-modern svg {
    width: 22px;
    height: 22px;
    fill: var(--medium-gray);
}

/* Indicador de fuerza de contraseña */
.password-strength {
    margin-top: 12px;
}

.strength-bar {
    height: 6px;
    background: var(--border-gray);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.strength-progress {
    height: 100%;
    width: 0;
    transition: all 0.3s ease;
    border-radius: 3px;
}

.strength-progress.weak {
    width: 33%;
    background: var(--error);
}

.strength-progress.medium {
    width: 66%;
    background: var(--warning);
}

.strength-progress.strong {
    width: 100%;
    background: var(--success);
}

.strength-text {
    font-size: 13px;
    font-weight: 600;
}

.strength-text.weak {
    color: var(--error);
}

.strength-text.medium {
    color: var(--warning);
}

.strength-text.strong {
    color: var(--success);
}

.form-hint-modern {
    display: block;
    margin-top: 8px;
    color: var(--medium-gray);
    font-size: 13px;
}

.form-footer {
    margin: 16px 0;
    text-align: right;
}

.link-modern {
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition-fast);
}

.link-modern:hover {
    color: var(--secondary-blue);
    text-decoration: underline;
}

/* Botones modernos */
.btn-modern {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-normal);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-modern:hover::before {
    width: 300px;
    height: 300px;
}

.btn-modern span {
    position: relative;
    z-index: 1;
}

.btn-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    position: relative;
    z-index: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.btn-secondary:hover {
    background: var(--light-blue);
    transform: translateY(-2px);
}

/* Alertas */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    fill: currentColor;
    margin-top: 2px;
}

.alert ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.alert li {
    margin: 4px 0;
}

.alert p {
    margin: 0;
    line-height: 1.5;
}

.alert-error {
    background: #fee;
    border-left: 4px solid var(--error);
    color: #c41e3a;
}

.alert-success {
    background: #e6f9f0;
    border-left: 4px solid var(--success);
    color: #0d7a4a;
}

.alert-info {
    background: #e8f1f8;
    border-left: 4px solid var(--info);
    color: var(--primary-blue);
}

.alert-warning {
    background: #fff8e6;
    border-left: 4px solid var(--warning);
    color: #b45309;
}

/* Divisor */
.auth-divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-gray);
}

.auth-divider span {
    position: relative;
    background: var(--white);
    padding: 0 16px;
    color: var(--medium-gray);
    font-size: 14px;
}

/* Footer de autenticación */
.auth-footer-modern {
    text-align: center;
    margin-top: 24px;
}

.auth-footer-modern p {
    color: var(--medium-gray);
    font-size: 14px;
}

.auth-footer-modern a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-fast);
}

.auth-footer-modern a:hover {
    color: var(--secondary-blue);
    text-decoration: underline;
}

/* ============================================
   NAVEGACIÓN
   ============================================ */

.navbar {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--dark-blue) 100%);
    color: var(--white);
    padding: 16px 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h2 {
    font-size: 24px;
    font-weight: 700;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 8px;
}

.nav-menu a {
    color: var(--white);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    transition: var(--transition-fast);
    font-weight: 500;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255, 255, 255, 0.15);
}

/* ============================================
   DASHBOARD
   ============================================ */

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.dashboard-header {
    margin-bottom: 32px;
}

.dashboard-header h1 {
    color: var(--primary-blue);
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.dashboard-header p {
    color: var(--medium-gray);
    font-size: 16px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.dashboard-card {
    background: var(--white);
    padding: 32px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
    animation: fadeIn 0.6s ease;
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.dashboard-card.full-width {
    grid-column: 1 / -1;
}

.dashboard-card h2 {
    color: var(--primary-blue);
    margin-bottom: 24px;
    font-size: 22px;
    font-weight: 700;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-gray);
}

.info-group {
    margin-bottom: 16px;
}

.info-group label {
    display: block;
    color: var(--medium-gray);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-group p {
    color: var(--dark-gray);
    font-weight: 600;
    font-size: 15px;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: var(--light-blue);
    border-radius: 16px;
    transition: var(--transition-fast);
}

.stat-item:hover {
    transform: scale(1.05);
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 8px;
}

.stat-label {
    color: var(--medium-gray);
    font-size: 13px;
    font-weight: 600;
}

.activity-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.activity-table thead {
    background: var(--light-blue);
}

.activity-table th {
    padding: 12px 16px;
    text-align: left;
    color: var(--primary-blue);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-table th:first-child {
    border-radius: 8px 0 0 8px;
}

.activity-table th:last-child {
    border-radius: 0 8px 8px 0;
}

.activity-table td {
    padding: 16px;
    background: var(--white);
    border-top: 1px solid var(--border-gray);
    border-bottom: 1px solid var(--border-gray);
}

.activity-table tbody tr {
    transition: var(--transition-fast);
}

.activity-table tbody tr:hover td {
    background: var(--light-blue);
}

.activity-table td:first-child {
    border-left: 1px solid var(--border-gray);
    border-radius: 8px 0 0 8px;
}

.activity-table td:last-child {
    border-right: 1px solid var(--border-gray);
    border-radius: 0 8px 8px 0;
}

/* Footer */
.footer {
    background: var(--dark-blue);
    color: var(--white);
    padding: 24px 0;
    text-align: center;
    margin-top: 48px;
}

.footer p {
    font-size: 14px;
    opacity: 0.9;
}

/* Animación fade in */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .auth-card-modern {
        padding: 32px 24px;
        border-radius: 20px;
    }
    
    .nav-container {
        flex-direction: column;
        gap: 16px;
    }
    
    .nav-menu {
        flex-direction: column;
        width: 100%;
        gap: 4px;
    }
    
    .nav-menu a {
        text-align: center;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .shape-1, .shape-3, .shape-5 {
        left: 5%;
    }
    
    .shape-2, .shape-4, .shape-6 {
        right: 5%;
    }
}

@media (max-width: 480px) {
    .auth-wrapper {
        padding: 12px;
    }
    
    .auth-card-modern {
        padding: 24px 20px;
    }
    
    .auth-header h1 {
        font-size: 24px;
    }
    
    .logo-circle {
        width: 64px;
        height: 64px;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
    }
    
    .dashboard-container {
        padding: 20px 16px;
    }
    
    .dashboard-card {
        padding: 20px;
    }
}

/* Mejoras de accesibilidad */
a:focus,
button:focus,
input:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Prevención de selección en botones */
.btn-modern,
.toggle-password-modern {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Loading state para botones */
.btn-modern.loading {
    pointer-events: none;
    position: relative;
}

.btn-modern.loading span {
    opacity: 0;
}

.btn-modern.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   ESTILOS PARA TEXTAREA - DISEÑO MODERNO
   ============================================ */
.textarea-wrapper {
    position: relative;
}

textarea {
    width: 100%;
    padding: 16px 18px;
    border: 2px solid var(--border-gray);
    border-radius: 12px;
    font-size: 15px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--dark-gray);
    background-color: var(--white);
    transition: all var(--transition-fast);
    resize: vertical;
    min-height: 140px;
    line-height: 1.6;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.08);
    background-color: var(--white);
}

textarea::placeholder {
    color: var(--medium-gray);
    opacity: 0.7;
}

textarea:disabled {
    background-color: var(--light-gray);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Estilos mejorados para alertas con iconos */
.alert {
    display: flex;
    align-items: flex-start;
    padding: 18px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    animation: slideDown 0.3s ease;
    border: 2px solid;
}

.alert-success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #86efac;
    color: #065f46;
}

.alert-error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #fca5a5;
    color: #991b1b;
}

.alert-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #93c5fd;
    color: #1e40af;
}

.alert svg.alert-icon {
    flex-shrink: 0;
    margin-right: 14px;
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.alert div,
.alert p {
    margin: 0;
    line-height: 1.5;
}

.alert p + p {
    margin-top: 6px;
    opacity: 0.9;
    font-size: 14px;
}

.alert ul {
    margin: 0;
    padding-left: 20px;
    list-style: none;
}

.alert li {
    margin: 6px 0;
    position: relative;
    padding-left: 20px;
}

.alert li::before {
    content: "•";
    position: absolute;
    left: 0;
    font-weight: bold;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Botón secundario moderno */
.btn-modern.btn-secondary {
    background: linear-gradient(135deg, var(--medium-gray) 0%, var(--dark-gray) 100%);
    color: var(--white);
    border: none;
}

.btn-modern.btn-secondary:hover {
    background: linear-gradient(135deg, var(--dark-gray) 0%, var(--medium-gray) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(51, 65, 85, 0.3);
}

/* Botón moderno sin icono */
.btn-modern span:only-child {
    margin: 0;
}