/* Estilos personalizados para The Love Stack - Fluid Design System */

/* Variables CSS Fluidas */
:root {
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --typing-speed: 50ms;
    --line-delay: 1.5s;
    
    /* Escala Tipográfica Fluida con clamp() */
    --text-xs-fluid: clamp(0.75rem, 2vw, 0.875rem);
    --text-sm-fluid: clamp(0.875rem, 2.5vw, 1rem);
    --text-base-fluid: clamp(1rem, 3vw, 1.125rem);
    --text-lg-fluid: clamp(1.125rem, 3.5vw, 1.25rem);
    --text-xl-fluid: clamp(1.25rem, 4vw, 1.5rem);
    --text-2xl-fluid: clamp(1.5rem, 5vw, 2rem);
    --text-3xl-fluid: clamp(1.875rem, 6vw, 2.5rem);
    --text-4xl-fluid: clamp(2.25rem, 7vw, 3rem);
    --text-5xl-fluid: clamp(2.5rem, 8vw, 3.5rem);
    --text-6xl-fluid: clamp(3rem, 9vw, 4rem);
    
    /* Contenedores Adaptativos */
    --container-max-width: clamp(280px, 90vw, 1400px);
    --card-min-width: clamp(280px, 35vw, 350px);
    --gap-fluid: clamp(1rem, 3vw, 2rem);
    
    /* Espaciado Fluida */
    --padding-xs-fluid: clamp(0.5rem, 2vw, 1rem);
    --padding-sm-fluid: clamp(0.75rem, 2.5vw, 1.5rem);
    --padding-md-fluid: clamp(1rem, 3vw, 2rem);
    --padding-lg-fluid: clamp(1.5rem, 4vw, 3rem);
}

/* Glassmorphism base */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    overflow: hidden; /* Prevenir overflow horizontal */
}

/* Contenedor Principal Adaptativo */
.container-fluid {
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--padding-sm-fluid);
}

/* Grid Inteligente para Galería */
.poems-grid-fluid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--card-min-width), 1fr));
    gap: var(--gap-fluid);
    width: 100%;
    padding: var(--padding-sm-fluid);
}

/* Header Premium con Centrado Absoluto */
.header {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem 1rem;
    text-align: center;
}

/* Contenedor Uptime con Wrapping Inteligente */
.uptime-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Uptime Display con Flex Wrap y Gap Controlado */
.uptime-display {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    font-family: 'Courier New', monospace;
    max-width: 100%;
}

/* Items individuales del uptime */
.uptime-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: fit-content;
    flex-shrink: 0;
}

.uptime-item-fluid {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: fit-content;
}

/* Tarjetas de Poemas con Aspect Ratio Encadenado */
.poem-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: clamp(0.75rem, 2vw, 1rem);
    padding: clamp(1rem, 3vw, 1.5rem);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    aspect-ratio: 3/4;
    width: 100%;
    max-width: clamp(280px, 25vw, 350px);
    display: flex;
    flex-direction: column;
}

/* Grid con Aspect Ratio Encadenado y Escalado Automático */
.poems-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: clamp(1rem, 3vw, 1.5rem);
    width: 100%;
    max-width: clamp(600px, 90vw, 1400px);
    padding: 0 clamp(1rem, 3vw, 1.5rem);
    justify-items: center;
    justify-content: center;
}

/* Responsive con Escalado Encadenado */
@media (min-width: 1200px) {
    .poems-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .poems-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {
    .poems-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .poems-grid {
        grid-template-columns: 1fr;
        max-width: 90%;
    }
}

/* Títulos Principales con Clamp() Fluid */
.title-main {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #a78bfa, #ec4899, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-uptime {
    font-size: clamp(0.875rem, 2vw, 1rem);
    font-weight: 600;
    color: #e5e7eb;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

/* Texto Secundario Responsive */
.subtitle {
    font-size: clamp(1.125rem, 3vw, 1.25rem);
    color: #d1d5db;
    margin-bottom: 1.5rem;
}

/* Line Clamp para títulos largos - Compatibilidad Total */
.line-clamp-2 {
    display: -webkit-box;
    display: box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive Breakpoints para ajustes específicos */
@media (max-width: 640px) {
    .uptime-display {
        font-size: clamp(0.75rem, 1.5vw, 0.875rem);
        gap: 0.5rem;
    }
    
    .uptime-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.25rem;
    }
    
    .poem-card {
        padding: 1rem;
        height: 300px;
    }
    
    .header {
        padding: 1.5rem 1rem;
    }
}

@media (min-width: 1920px) {
    :root {
        --container-max-width: 1600px;
        --card-min-width: 380px;
    }
}

/* Animated background patterns */
@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-20px) rotate(2deg); }
    66% { transform: translateY(10px) rotate(-1deg); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(168, 85, 247, 0.3); }
    50% { box-shadow: 0 0 40px rgba(168, 85, 247, 0.6); }
}

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

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

/* Fade transitions */
.fade-out {
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.5s ease-out;
}

.fade-in {
    opacity: 1;
    transform: scale(1);
    transition: all 0.5s ease-in;
}

/* Card hover effects */
.poem-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.poem-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(236, 72, 153, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.poem-card:hover::before {
    opacity: 1;
}

.poem-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 25px 50px rgba(168, 85, 247, 0.4), 0 0 30px rgba(168, 85, 247, 0.2);
}

.poem-card:active {
    transform: translateY(-4px) scale(1.01);
}

/* File type icons styling */
.file-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
}

.file-icon.html { background: linear-gradient(135deg, #e34c26, #f06529); }
.file-icon.js { background: linear-gradient(135deg, #f7df1e, #ffeb3b); color: #000; }
.file-icon.py { background: linear-gradient(135deg, #3776ab, #4b8bbe); }
.file-icon.default { background: linear-gradient(135deg, #6b7280, #9ca3af); }

/* Typing effect styles */
.poem-content {
    font-family: 'Playfair Display', serif;
    line-height: 1.8;
}

.typing-line {
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid #a855f7;
    margin-bottom: 1rem;
    animation: 
        typing var(--typing-duration) steps(40, end) var(--typing-delay) forwards,
        blink-caret 0.75s step-end var(--blink-count) var(--typing-delay);
}

/* Cursor blinking animation */
@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #a855f7; }
}

/* Typing animation */
@keyframes typing {
    from { 
        width: 0; 
        opacity: 1; 
    }
    to { 
        width: 100%; 
        opacity: 1; 
    }
}

/* Code highlighting for programming poems */
.code-snippet {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background: rgba(26, 32, 44, 0.8);
    border: 1px solid rgba(75, 85, 99, 0.3);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
}

.code-snippet .comment { color: #6b7280; }
.code-snippet .keyword { color: #f59e0b; }
.code-snippet .variable { color: #a78bfa; }
.code-snippet .string { color: #34d399; }
.code-snippet .function { color: #60a5fa; }
.code-snippet .number { color: #f87171; }

/* Loading states */
.loading-skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 100%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .glass-card {
        border-radius: 12px;
        margin: 1rem;
    }
    
    .poem-card:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    .typing-line {
        font-size: 1.1rem;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 85, 247, 0.7);
}

/* Focus states for accessibility */
button:focus-visible,
input:focus-visible {
    outline: 2px solid #a855f7;
    outline-offset: 2px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Text selection */
::selection {
    background: rgba(168, 85, 247, 0.3);
    color: white;
}

/* Performance optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Animation utilities */
.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}
