/**
 * Main Stylesheet - Just Dev It
 * Orquesta todos los estilos del sitio web
 * 
 * Importaciones en orden de especificidad:
 * 1. Core (reset, variables, typography)
 * 2. Layouts (grid, sections)
 * 3. Components (navigation, hero, cards, forms, footer)
 * 4. Pages (específicos si se requieren)
 * 5. Utilities (helpers de última instancia)
 */

/* ===== IMPORTS ===== */
@import url('components/footer.css');

/* ===== UTILITIES & HELPERS ===== */

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Visibility */
.visible { visibility: visible; }
.invisible { visibility: hidden; }

/* Opacity */
.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* Pointer Events */
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.cursor-wait { cursor: wait; }

/* User Select */
.select-none { user-select: none; }
.select-text { user-select: text; }
.select-all { user-select: all; }

/* ===== GLOBAL STYLES ===== */

/* Smooth scrolling behavior */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* Para navegación fija */
}

/* Loading state para body */
body.loading {
    overflow: hidden;
}

body.loading::after {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeOut 0.5s ease-out 0.5s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        pointer-events: none;
    }
}

/* ===== LOADER / SPINNER ===== */
.loader {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(155, 97, 164, 0.2);
    border-top-color: var(--color-brand-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Loader container */
.loader-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* ===== OVERLAY ===== */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 26, 0.9);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    background: var(--bg-secondary);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    z-index: var(--z-modal);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-base);
    overflow-y: auto;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.modal-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--color-neutral-lightest);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    color: var(--color-neutral-light);
}

.modal-close:hover {
    background-color: rgba(155, 97, 164, 0.1);
    color: var(--color-neutral-lightest);
}

.modal-body {
    color: var(--color-neutral-light);
    line-height: var(--leading-relaxed);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-4);
    margin-top: var(--space-8);
}

/* ===== BADGE ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

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

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

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

.badge-outline {
    background: transparent;
    border: 1px solid currentColor;
}

/* ===== TOOLTIP ===== */
.tooltip {
    position: relative;
}

.tooltip::before,
.tooltip::after {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.tooltip::before {
    content: attr(data-tooltip);
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-tertiary);
    color: var(--color-neutral-lightest);
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
    white-space: nowrap;
    z-index: var(--z-tooltip);
}

.tooltip::after {
    content: '';
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--bg-tertiary);
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
}

/* ===== DIVIDER ===== */
.divider {
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(155, 97, 164, 0.3),
        transparent
    );
    margin: var(--space-12) 0;
}

.divider-vertical {
    width: 1px;
    height: 100%;
    background: linear-gradient(
        180deg,
        transparent,
        rgba(155, 97, 164, 0.3),
        transparent
    );
}

/* ===== ALERT ===== */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--color-success);
    color: var(--color-success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--color-error);
    color: var(--color-error);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--color-warning);
    color: var(--color-warning);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--color-info);
    color: var(--color-info);
}

/* ===== SCROLL TO TOP ===== */
.scroll-to-top {
    position: fixed;
    bottom: var(--space-8);
    right: var(--space-8);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all var(--transition-base);
    z-index: var(--z-fixed);
    box-shadow: var(--shadow-brand);
}

.scroll-to-top.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

.scroll-to-top:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.scroll-to-top::before {
    content: '↑';
    font-size: var(--text-2xl);
    color: white;
    font-weight: bold;
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--gradient-secondary);
    transform-origin: left;
    transform: scaleX(0);
    transition: transform var(--transition-fast);
    z-index: var(--z-fixed);
}

/* ===== ANIMATIONS ===== */

/* Pulse effect */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Bounce effect */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.animate-bounce {
    animation: bounce 1s ease-in-out infinite;
}

/* Ping effect */
@keyframes ping {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    75%, 100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.animate-ping {
    animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* Shake effect */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

/* ===== PRINT STYLES ===== */
@media print {
    .no-print,
    .site-header,
    .scroll-to-top,
    .modal,
    .overlay {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    a {
        text-decoration: underline;
    }
    
    .section {
        page-break-inside: avoid;
    }
}

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 12px;
}

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

::-webkit-scrollbar-thumb {
    background: linear-gradient(
        180deg,
        var(--color-brand-primary),
        var(--color-brand-secondary)
    );
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        180deg,
        var(--color-brand-accent),
        var(--color-brand-primary)
    );
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-brand-primary) var(--bg-primary);
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* Will-change para elementos animados */
.hero-section,
.card:hover,
.btn:hover {
    will-change: transform;
}

/* Contenido de lazy loading */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity var(--transition-base);
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */

/* Focus visible para teclado */
:focus-visible {
    outline: 2px solid var(--color-brand-secondary);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--color-brand-primary);
    }
    
    .btn-primary {
        border: 2px solid white;
    }
}
