/* ============================================
   BASE THEME - SIIL (Sistema Integral de Información del Litio)
   Estilos institucionales SENER/GobMX
   ============================================ */

/* Colores Institucionales GobMX/SENER */
:root {
    /* Colores Principales */
    --gobmx-guinda: #9B2247;
    --gobmx-guinda-dark: #7a1b38;
    --gobmx-verde: #1E5B4F;
    --gobmx-verde-dark: #163d34;
    --gobmx-dorado: #A57F2C;
    --gobmx-dorado-dark: #8a6923;
    --gobmx-gris: #98989A;
    --gobmx-gris-claro: #E5E5E5;
    
    /* Colores Funcionales */
    --color-text-primary: #1F2937;
    --color-text-secondary: #6B7280;
    --color-text-muted: #9CA3AF;
    --color-bg: #FFFFFF;
    --color-bg-light: #F8F9FA;
    --color-bg-gray: #F3F4F6;
    --color-border: #E5E7EB;
    --color-border-light: #F3F4F6;
    
    /* Tipografía */
    --font-sans: 'Noto Sans', system-ui, -apple-system, sans-serif;
    --font-serif: 'Merriweather', serif;
    --font-heading: 'Merriweather', serif;
    
    /* Espaciado */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Bordes y Sombras */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text-primary);
    background-color: var(--color-bg-light);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Tipografía */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-text-primary);
}

h1 { font-size: 2.25rem; font-weight: 800; }
h2 { font-size: 1.875rem; font-weight: 700; }
h3 { font-size: 1.5rem; font-weight: 700; }
h4 { font-size: 1.25rem; font-weight: 600; }
h5 { font-size: 1.125rem; font-weight: 600; }
h6 { font-size: 1rem; font-weight: 600; }

p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

a {
    color: var(--gobmx-guinda);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--gobmx-guinda-dark);
}

/* Botones Base */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.btn-primary {
    background: var(--gobmx-guinda);
    color: white;
    box-shadow: 0 2px 8px rgba(155, 34, 71, 0.25);
}

.btn-primary:hover {
    background: var(--gobmx-guinda-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(155, 34, 71, 0.35);
    color: white;
}

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

.btn-secondary {
    background: white;
    color: var(--color-text-primary);
    border: 2px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg-gray);
    border-color: var(--gobmx-guinda);
    color: var(--gobmx-guinda);
}

.btn-success {
    background: #10B981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    color: white;
}

.btn-danger {
    background: #EF4444;
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
    color: white;
}

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

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--color-text-primary);
    background: white;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-muted);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--color-text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--gobmx-guinda);
    box-shadow: 0 0 0 3px rgba(155, 34, 71, 0.1);
}

.form-input-icon {
    position: relative;
}

.form-input-icon input {
    padding-left: 3rem;
}

.form-input-icon .icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 1rem;
    pointer-events: none;
    transition: color 0.3s;
}

.form-input-icon input:focus + .icon {
    color: var(--gobmx-guinda);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-error {
    border-color: #EF4444;
    background: #FEF2F2;
}

.form-error-message {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #DC2626;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
    overflow: hidden;
    transition: all 0.3s;
}

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

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border-light);
    font-weight: 700;
    color: var(--color-text-primary);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background: var(--color-bg-gray);
    border-top: 1px solid var(--color-border-light);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-primary {
    background: rgba(155, 34, 71, 0.1);
    color: var(--gobmx-guinda);
}

.badge-success {
    background: #D1FAE5;
    color: #065F46;
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-danger {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-info {
    background: #DBEAFE;
    color: #1E40AF;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    margin-bottom: 1rem;
}

.alert-success {
    background: #D1FAE5;
    border-color: #6EE7B7;
    color: #065F46;
}

.alert-warning {
    background: #FEF3C7;
    border-color: #FCD34D;
    color: #92400E;
}

.alert-danger {
    background: #FEE2E2;
    border-color: #FCA5A5;
    color: #991B1B;
}

.alert-info {
    background: #DBEAFE;
    border-color: #93C5FD;
    color: #1E40AF;
}

/* Utilidades */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--gobmx-guinda); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }

.bg-primary { background-color: var(--gobmx-guinda); }
.bg-light { background-color: var(--color-bg-light); }
.bg-white { background-color: white; }

.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; }

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.95);
    }
}

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

.animate-slideDown {
    animation: slideDown 0.3s ease-out;
}

/* ============================================
   PRELOADER GLOBAL
   ============================================ */

.preloader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.preloader-overlay.active {
    display: flex;
    opacity: 1;
}

.preloader-content {
    text-align: center;
    color: white;
}

.preloader-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    position: relative;
}

.preloader-spinner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--gobmx-guinda);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.preloader-spinner::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--gobmx-dorado);
    border-radius: 50%;
    animation: spin 1.2s linear infinite reverse;
}

.preloader-text {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.5rem;
}

.preloader-subtext {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Preloader dots animation */
.preloader-dots {
    display: inline-flex;
    gap: 0.25rem;
}

.preloader-dots span {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 1.4s ease-in-out infinite;
}

.preloader-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.preloader-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ============================================
   MODAL SYSTEM
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-container {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 480px;
    width: 100%;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.modal-icon.warning {
    background: #FEF3C7;
    color: #92400E;
}

.modal-icon.danger {
    background: #FEE2E2;
    color: #991B1B;
}

.modal-icon.success {
    background: #D1FAE5;
    color: #065F46;
}

.modal-icon.info {
    background: #DBEAFE;
    color: #1E40AF;
}

.modal-header-text {
    flex: 1;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 0.25rem;
}

.modal-subtitle {
    font-size: 0.875rem;
    color: #6B7280;
}

.modal-body {
    padding: 1.5rem;
}

.modal-message {
    font-size: 0.9375rem;
    color: #374151;
    line-height: 1.6;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background: #F9FAFB;
    border-top: 1px solid #E5E7EB;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.modal-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-btn-cancel {
    background: white;
    color: #374151;
    border: 2px solid #E5E7EB;
}

.modal-btn-cancel:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
}

.modal-btn-confirm {
    background: var(--gobmx-guinda);
    color: white;
}

.modal-btn-confirm:hover {
    background: #8B1F3E;
    box-shadow: 0 4px 12px rgba(155, 34, 71, 0.25);
}

.modal-btn-confirm.danger {
    background: #DC2626;
}

.modal-btn-confirm.danger:hover {
    background: #B91C1C;
}

/* Responsive */
@media (max-width: 640px) {
    .modal-container {
        max-width: 100%;
        margin: 0 1rem;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .modal-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Button loading state */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}


/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-light);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    h1 { font-size: 1.875rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .container {
        padding: 0 1rem;
    }
}
