@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #008002;
    --primary-dark: #006B02;
    --primary-light: #12A614;
    --secondary: #FFC107;
    --accent: #FC9E21;
    --gold: #FFC107;
    --bg-white: #FFFFFF;
    --bg-warm: #F1F4F8;
    --bg-light: #E8F5E9;
    --text-dark: #161C2D;
    --text-medium: #384C74;
    --text-light: #869AB8;
    --border: #C6D3E6;
    --border-light: #E4EAF2;
    --shadow: rgba(0, 128, 2, 0.15);
    --shadow-strong: rgba(0, 128, 2, 0.25);
    --danger: #C1002B;
    --success: #00A004;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-white);
    color: var(--text-dark);
    line-height: 1.6;
}

/* HEADER */
.header {
    background: var(--bg-white);
    border-bottom: 3px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 15px var(--shadow);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-dark);
}

.logo-section img {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    object-fit: cover;
}

.logo-text h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.2;
}

.logo-text span {
    font-size: 0.7rem;
    color: var(--text-light);
    font-weight: 400;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-medium);
    transition: all 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    background: var(--bg-light);
    color: var(--primary-dark);
}

.nav-links a.btn-admin {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.nav-links a.btn-admin:hover {
    background: var(--primary-dark);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary);
    cursor: pointer;
}

/* HERO BANNER */
.hero-banner {
    --hero-bg-desktop: none;
    --hero-bg-mobile: none;
    background:
        linear-gradient(120deg, rgba(0,128,2,0.85) 0%, rgba(18,166,20,0.75) 55%, rgba(232,245,233,0.55) 100%),
        var(--hero-bg-desktop),
        linear-gradient(120deg, var(--primary) 0%, var(--primary-light) 55%, #E8F5E9 100%);
    background-size: cover, cover, cover;
    background-position: center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat;
    padding: 24px 20px 40px;
    color: white;
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .hero-banner {
        background:
            linear-gradient(180deg, rgba(0,128,2,0.85) 0%, rgba(18,166,20,0.75) 60%, rgba(232,245,233,0.65) 100%),
            var(--hero-bg-mobile),
            linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 60%, #E8F5E9 100%);
        background-size: cover, cover, cover;
        background-position: center, center, center;
        background-repeat: no-repeat, no-repeat, no-repeat;
    }
}

.hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: center;
}

.hero-copy {
    text-align: left;
    position: relative;
    z-index: 3;
}

.hero-copy h2 {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1.1;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
    margin-bottom: 8px;
}

.hero-copy .subtitle {
    font-size: 1rem;
    font-weight: 500;
    color: var(--secondary);
    margin-bottom: 12px;
}

.hero-copy .fecha {
    font-size: 1rem;
    opacity: 0.95;
    margin-bottom: 14px;
}

.hero-copy .premio-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.premio-badge {
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(10px);
    padding: 6px 16px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.25);
}

/* MONITOR + BUBBLES */
.hero-stage {
    position: relative;
    aspect-ratio: 1 / 1;
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
}

.monitor-frame {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 88%;
    aspect-ratio: 400 / 320;
    z-index: 2;
    filter: drop-shadow(0 12px 25px rgba(0,0,0,0.25));
}

.monitor-frame svg {
    width: 100%;
    height: 100%;
    display: block;
    position: absolute;
    inset: 0;
}

/* Pantalla del monitor con slider — coincide exactamente con el rect x=28 y=28 w=344 h=224 del SVG */
.monitor-screen {
    position: absolute;
    top: 8.75%;   /* 28/320 */
    left: 7%;     /* 28/400 */
    width: 86%;   /* 344/400 */
    height: 70%;  /* 224/320 */
    border-radius: 6px;
    overflow: hidden;
    z-index: 3;
    background: linear-gradient(135deg, #12A614, #008002 60%, #006B02);
}

.monitor-screen .slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.monitor-screen .slide.active {
    opacity: 1;
}

.monitor-screen .screen-gloss {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 45%);
    pointer-events: none;
    z-index: 5;
}

.bubbles-stage {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18), inset 0 0 0 3px rgba(255,255,255,0.75);
    animation-name: float-drift;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-direction: alternate;
    will-change: transform;
}

.bubble img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

.bubble.size-lg { width: 74px; height: 74px; }
.bubble.size-md { width: 58px; height: 58px; }
.bubble.size-sm { width: 44px; height: 44px; }

@keyframes float-drift {
    0%   { transform: translate(0, 0) rotate(0deg); }
    50%  { transform: translate(6px, -14px) rotate(4deg); }
    100% { transform: translate(-6px, 12px) rotate(-4deg); }
}

@keyframes float-swing {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(-10px, -8px) scale(1.05); }
    100% { transform: translate(10px, 6px) scale(0.97); }
}

@keyframes float-orbit {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(8px, -10px); }
    50%  { transform: translate(0, -18px); }
    75%  { transform: translate(-8px, -10px); }
    100% { transform: translate(0, 0); }
}

.bubble.anim-1 { animation-name: float-drift; animation-duration: 5.2s; }
.bubble.anim-2 { animation-name: float-swing; animation-duration: 6.4s; }
.bubble.anim-3 { animation-name: float-orbit; animation-duration: 7.1s; animation-direction: normal; }

/* Screen glow behind the monitor */
.hero-stage::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 45%;
    width: 70%;
    height: 60%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 65%);
    filter: blur(10px);
    z-index: 1;
    pointer-events: none;
}

/* CONTROLS */
.controls-bar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 20px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.controls-bar h3 {
    font-size: 1.1rem;
    color: var(--text-dark);
    font-weight: 600;
}

.date-picker-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-picker-group input[type="date"] {
    padding: 8px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.3s;
}

.date-picker-group input[type="date"]:focus {
    border-color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: none;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-strong);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--primary-dark);
}

.btn-secondary:hover {
    background: var(--border);
}

/* RESULTS GRID */
.results-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px 40px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 10px;
}

.result-card {
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    border-radius: 16px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.result-card:hover {
    border-color: var(--primary-light);
    box-shadow: 0 8px 25px var(--shadow);
    transform: translateY(-3px);
}

.result-card .sorteo-time {
    font-size: 0.72rem;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-card .animal-icon {
    width: 65px;
    height: 65px;
    margin: 0 auto 6px;
    border-radius: 50%;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    border: 3px solid var(--border);
    overflow: hidden;
}

.result-card .animal-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-card .animal-result-line {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
}

.result-card .animal-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1;
}

.result-card .animal-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
}

.result-card .premio {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
}

.result-card .premio strong {
    color: var(--success);
}

/* PENDING CARD */
.result-card.pending {
    border-style: dashed;
    border-color: var(--border);
    opacity: 0.6;
}

.result-card.pending .animal-icon {
    background: var(--bg-warm);
    font-size: 1.5rem;
    color: var(--text-light);
}

.result-card.pending .animal-number {
    color: var(--text-light);
    font-size: 1.2rem;
}

/* ANIMALS TABLE */
.animals-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 20px 60px;
}

.animals-section h3 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: var(--text-dark);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.animals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.animal-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-warm);
    border-radius: 10px;
    font-size: 0.8rem;
    border: 1px solid var(--border-light);
    transition: all 0.2s;
}

.animal-mini:hover {
    background: var(--bg-light);
    border-color: var(--primary-light);
}

.animal-mini .num {
    font-weight: 700;
    color: var(--primary-dark);
    min-width: 22px;
}

.animal-mini .name {
    color: var(--text-medium);
    font-weight: 500;
}

/* NO RESULTS */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.no-results .icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.no-results p {
    font-size: 1rem;
    font-weight: 500;
}

/* FOOTER */
.footer {
    background: var(--text-dark);
    color: rgba(255,255,255,0.7);
    padding: 35px 20px;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.footer-col-center {
    align-items: center;
    gap: 14px;
}

.footer .brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer .brand img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
}

.footer .brand span {
    font-weight: 600;
    color: white;
    font-size: 0.95rem;
}

.footer-tagline {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.footer .info {
    font-size: 0.72rem;
    text-align: right;
    line-height: 1.5;
}

.social-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    transition: all 0.3s;
    text-decoration: none;
}

.social-icon:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.btn-reglamento {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 22px;
    background: transparent;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    border-radius: 8px;
    border: 1.5px solid rgba(255,255,255,0.25);
    font-family: 'Poppins', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-reglamento:hover {
    border-color: var(--primary);
    color: white;
    background: rgba(0,128,2,0.15);
}

/* SEPARATOR */
.section-divider {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-divider hr {
    border: none;
    border-top: 2px solid var(--border-light);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
    }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        padding-top: 10px;
        border-top: 1px solid var(--border-light);
        margin-top: 10px;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links a {
        width: 100%;
        text-align: center;
    }

    .mobile-menu-btn {
        display: block;
    }

    .hero-inner {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-copy {
        text-align: center;
    }

    .hero-copy h2 {
        font-size: 1.6rem;
    }

    .hero-copy .premio-info {
        justify-content: center;
    }

    .hero-stage {
        max-width: 340px;
        order: 2;
    }

    .bubble.size-lg { width: 54px; height: 54px; }
    .bubble.size-md { width: 42px; height: 42px; }
    .bubble.size-sm { width: 34px; height: 34px; }

    .controls-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .result-card {
        padding: 10px;
    }

    .result-card .animal-icon {
        width: 55px;
        height: 55px;
        font-size: 1.8rem;
    }

    .result-card .animal-number {
        font-size: 1.2rem;
    }

    .result-card .animal-name {
        font-size: 0.8rem;
    }

    .animals-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .footer-col {
        align-items: center;
    }

    .footer .info {
        text-align: center;
    }

    .logo-text h1 {
        font-size: 1rem;
    }

    .logo-section img {
        width: 42px;
        height: 42px;
    }
}

@media (max-width: 480px) {
    .results-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .result-card .animal-icon {
        width: 45px;
        height: 45px;
        font-size: 1.4rem;
    }

    .result-card .animal-number {
        font-size: 1rem;
    }

    .result-card .animal-name {
        font-size: 0.75rem;
    }
}

/* ANIMATIONS */
.result-card {
    animation: fadeInUp 0.4s ease-out both;
}

.result-card:nth-child(1) { animation-delay: 0.05s; }
.result-card:nth-child(2) { animation-delay: 0.1s; }
.result-card:nth-child(3) { animation-delay: 0.15s; }
.result-card:nth-child(4) { animation-delay: 0.2s; }
.result-card:nth-child(5) { animation-delay: 0.25s; }
.result-card:nth-child(6) { animation-delay: 0.3s; }
.result-card:nth-child(7) { animation-delay: 0.35s; }
.result-card:nth-child(8) { animation-delay: 0.4s; }
.result-card:nth-child(9) { animation-delay: 0.45s; }
.result-card:nth-child(10) { animation-delay: 0.5s; }
.result-card:nth-child(11) { animation-delay: 0.55s; }
.result-card:nth-child(12) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-warm); }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* LOADING */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading-spinner::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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