@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Color Principal por defecto (Lo sobreescribe PHP) */
    --brand-color: #4f46e5;
    
    /* PALETA OSCURA (Predeterminada) */
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --alert-text: #f8fafc;
    --result-bg: rgba(0, 0, 0, 0.15);
    --code-text: #f8fafc;
    --code-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    --btn-theme-bg: rgba(30, 41, 59, 0.7);
}

[data-theme="light"] {
    /* PALETA CLARA */
    --bg-gradient: linear-gradient(135deg, #f6f8fd 0%, #f1f5f9 100%);
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: rgba(0, 0, 0, 0.1);
    --alert-text: #1e293b;
    --result-bg: rgba(255, 255, 255, 0.5);
    --code-text: var(--brand-color);
    --code-shadow: none;
    --btn-theme-bg: rgba(255, 255, 255, 0.9);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--bg-gradient);
    color: var(--text-main);
    transition: all 0.4s ease;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    width: 40vw;
    height: 40vw;
    background: var(--brand-color);
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    animation: float 10s infinite ease-in-out alternate;
    z-index: -1;
}

@keyframes float {
    0% { transform: translate(-5%, -5%); }
    100% { transform: translate(5%, 5%); }
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    opacity: 0;
    animation: slideUp 0.6s ease-out forwards;
}

@keyframes slideUp {
    to { transform: translateY(0); opacity: 1; }
}

.brand-header { text-align: center; margin-bottom: 2rem; }
.brand-logo { max-height: 60px; margin-bottom: 1rem; border-radius: 12px; }
.brand-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--text-main), var(--brand-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.brand-subtitle { color: var(--text-muted); font-size: 0.95rem; }

.alert-box {
    background: rgba(var(--brand-color-rgb), 0.1);
    border-left: 4px solid var(--brand-color);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    color: var(--alert-text);
    animation: fadeIn 0.8s ease-in;
}
.alert-box i { color: var(--brand-color); font-size: 1.2rem; margin-top: 2px; }

.result-display {
    background: var(--result-bg);
    border: 1px dashed var(--border-color);
    border-radius: 1rem;
    padding: 2.5rem 1rem;
    text-align: center;
    margin-top: 2rem;
    transition: all 0.4s ease;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.result-display.active-code { border-style: solid; border-color: var(--brand-color); background: rgba(var(--brand-color-rgb), 0.05); box-shadow: inset 0 0 20px rgba(var(--brand-color-rgb), 0.1); }
.result-display.active-link { border-style: solid; border-color: #10b981; background: rgba(16, 185, 129, 0.05); }

.code-numbers {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--code-text);
    text-shadow: var(--code-shadow);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.action-btn {
    display: inline-block;
    background: #10b981;
    color: white;
    padding: 1rem 2rem;
    border-radius: 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
    transition: all 0.3s ease;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.action-btn:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 20px 25px -5px rgba(16, 185, 129, 0.4); }

.time-badge { margin-top: 1.5rem; font-size: 0.85rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.5rem; }

@keyframes popIn { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.spinner { width: 40px; height: 40px; border: 3px solid rgba(var(--brand-color-rgb), 0.2); border-top-color: var(--brand-color); border-radius: 50%; animation: spin 1s infinite linear; }
@keyframes spin { 100% { transform: rotate(360deg); } }