:root {
    --color-primary: #C41E3A;
    --color-secondary: #FFF9EB;
    --color-tertiary: #165B33;
    --color-accent: #D4AF37;
    --color-button: #165B33;
    --color-button-hover: #0f4024;
    --color-text: #2C1810;
    --color-white: #FFFFFF;
    --color-snow: #E8F4F8;
}

/* Custom Scrollbar Styles */
/* For Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: linear-gradient(to bottom, var(--color-secondary), #f0e6d2);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--color-primary), var(--color-tertiary));
    border-radius: 10px;
    border: 2px solid var(--color-secondary);
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #a01830, #0f4024);
    border-color: var(--color-accent);
}

::-webkit-scrollbar-thumb:active {
    background: var(--color-tertiary);
}

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

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

body {
    height: 100vh;
    background: linear-gradient(135deg, #C41E3A 0%, #8B1428 50%, #165B33 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Page Container with Advertisement Spaces */
.page-container {
    display: flex;
    width: 100%;
    height: 100%;
    gap: 0;
}

/* Advertisement Spaces */
.ad-space {
    width: 200px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ad-space.hidden {
    width: 0;
    border: none;
    overflow: hidden;
}

.ad-left {
    border-right: none;
}

.ad-right {
    border-left: none;
}

.ad-placeholder {
    padding: 20px;
    text-align: center;
    color: var(--color-white);
    font-family: "Inter", sans-serif;
    font-size: 14px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

/* Advertisement Toggle Button */
.ad-toggle-button {
    position: fixed;
    top: 20px;
    left: 20px;
    background: linear-gradient(135deg, var(--color-accent), #FFD700);
    border: 2px solid var(--color-white);
    border-radius: 25px;
    padding: 10px 20px;
    font-family: "Inter", sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--color-text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

.ad-toggle-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.main-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
    min-width: 0;
}

/* Banner */
.header-banner {
    flex: 40%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px 0;
    position: relative;
}

/* Sección de entrada */
.input-section {
    flex: 60%;
    background-color: var(--color-secondary);
    border: 1px solid #000;
    border-radius: 64px 64px 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    width: 100%;
    overflow-y: auto;
}

/* Títulos */
.main-title {
    font-size: 48px;
    font-family: "Merriweather", serif;
    font-weight: 900;
    font-style: italic;
    color: var(--color-white);
    text-shadow: 2px 2px 8px rgba(212, 175, 55, 0.6), 0 0 20px rgba(255, 255, 255, 0.3);
    text-align: center;
}

.section-title {
    font-family: "Inter", serif;
    font-size: 36px;
    font-weight: 700;
    color: var(--color-primary);
    margin: 10px 0;
    text-align: center;
}

/* Contenedores de entrada y botón */
.input-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 600px;
    margin-top: 20px;
}

.input-name {
    width: 100%;
    padding: 10px;
    border: 2px solid #000;
    border-radius: 25px 0 0 25px;
    font-size: 16px;
}

.button-container {
    width: 300px;
    justify-content: center;
}

/* Estilos de entrada de texto */
.input-title {
    flex: 1;
    padding: 10px 15px;
    font-size: 16px;
    border: 2px solid #333;
    border-right: none;
    border-radius: 25px 0 0 25px;
    font-family: "Merriweather", serif;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Estilos de botón */
button {
    padding: 15px 30px;
    font-family: "Inter", sans-serif;
    font-size: 16px;
    border: 2px solid #000;
    border-radius: 25px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.button-add {
    background-color: var(--color-tertiary);
    color: var(--color-text);
    border-radius: 0 25px 25px 0;
}

.button-add:hover {
    background-color: #a1a1a1;
}

/* Listas */
ul {
    list-style-type: none;
    color: var(--color-text);
    font-family: "Inter", sans-serif;
    font-size: 18px;
    margin: 20px 0;
}

.result-list {
    margin-top: 15px;
    color: #05DF05;
    font-size: 22px;
    font-weight: bold;
    text-align: center;
}

/* Botón de sortear título */
.button-draw {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 40px;
    color: var(--color-white);
    background-color: var(--color-button);
    font-size: 16px;
}

.button-draw img {
    margin-right: 40px;
}

.button-draw:hover {
    background-color: var(--color-button-hover);
}

/* Contenedor de fiestas */
.party-container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 30px;
}

/* Tarjetas de fiesta */
.party-card {
    background-color: var(--color-white);
    border: 2px solid #000;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.party-name {
    font-family: "Merriweather", serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 10px;
    text-align: center;
}

.party-info {
    font-family: "Inter", sans-serif;
    font-size: 14px;
    color: #666;
    text-align: center;
    margin-bottom: 15px;
    font-style: italic;
}

/* Estados de amigos - Cuadros */
.friends-box-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
    justify-content: center;
}

.friend-box {
    padding: 12px 20px;
    border-radius: 8px;
    font-family: "Inter", sans-serif;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid #000;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.friend-box-red {
    background-color: #ff4444;
    color: var(--color-white);
}

.friend-box-gray {
    background-color: #808080;
    color: var(--color-white);
}

.friend-box-gray:hover {
    background-color: #666666;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Botón Sortear */
.button-sortear {
    width: 100%;
    margin-top: 15px;
    background-color: var(--color-button);
    color: var(--color-white);
    font-weight: 700;
    font-size: 18px;
}

.button-sortear:hover {
    background-color: var(--color-button-hover);
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
}

.modal-overlay.modal-visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--color-white);
    padding: 40px 60px;
    border-radius: 20px;
    border: 3px solid var(--color-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    max-width: 600px;
    text-align: center;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content p {
    font-family: "Inter", sans-serif;
    font-size: 24px;
    color: var(--color-primary);
    margin: 0;
    line-height: 1.5;
}

.modal-content strong {
    color: var(--color-button);
    font-weight: 700;
}

/* Countdown Timer */
.countdown-timer {
    position: absolute;
    top: 15px;
    right: 15px;
}

.countdown-circle-bg {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 4;
}

.countdown-circle {
    fill: none;
    stroke: var(--color-button);
    stroke-width: 4;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    stroke-dasharray: 157;
    /* 2 * PI * 25 */
    stroke-dashoffset: 0;
}

@keyframes countdown {
    from {
        stroke-dashoffset: 0;
    }

    to {
        stroke-dashoffset: 157;
    }
}

/* Error Modal */
.modal-overlay.modal-error .modal-content {
    border-color: #ff4444;
    background-color: #fff5f5;
}

.modal-overlay.modal-error .modal-content p {
    color: #cc0000;
}



/* Language Container */
.language-container {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--color-accent), #FFD700);
    border: 2px solid var(--color-white);
    border-radius: 25px;
    padding: 10px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.language-container:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.language-label {
    font-family: "Inter", sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--color-text);
    margin: 0;
}

.language-dropdown {
    background-color: var(--color-white);
    border: 2px solid var(--color-text);
    border-radius: 15px;
    padding: 5px 10px;
    font-family: "Inter", sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text);
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.language-dropdown:hover {
    background-color: var(--color-secondary);
}

.language-dropdown:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(196, 30, 58, 0.2);
}

/* Snowflakes Animation */
.snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.snowflake {
    position: absolute;
    top: -10%;
    color: var(--color-white);
    font-size: 1.5em;
    opacity: 0.8;
    animation: fall linear infinite;
}

.snowflake:nth-child(1) {
    left: 10%;
    animation-duration: 10s;
    animation-delay: 0s;
}

.snowflake:nth-child(2) {
    left: 20%;
    animation-duration: 12s;
    animation-delay: 2s;
    font-size: 2em;
}

.snowflake:nth-child(3) {
    left: 30%;
    animation-duration: 8s;
    animation-delay: 4s;
}

.snowflake:nth-child(4) {
    left: 40%;
    animation-duration: 14s;
    animation-delay: 1s;
    font-size: 1.8em;
}

.snowflake:nth-child(5) {
    left: 50%;
    animation-duration: 11s;
    animation-delay: 3s;
}

.snowflake:nth-child(6) {
    left: 60%;
    animation-duration: 9s;
    animation-delay: 5s;
    font-size: 2.2em;
}

.snowflake:nth-child(7) {
    left: 70%;
    animation-duration: 13s;
    animation-delay: 2.5s;
}

.snowflake:nth-child(8) {
    left: 80%;
    animation-duration: 10.5s;
    animation-delay: 4.5s;
    font-size: 1.6em;
}

@keyframes fall {
    0% {
        top: -10%;
        opacity: 0.8;
    }

    100% {
        top: 110%;
        opacity: 0.3;
    }
}

/* ========================================
   RESPONSIVE DESIGN - MEDIA QUERIES
   ======================================== */

/* Prevent horizontal scrolling */
body {
    overflow-x: hidden;
}

/* Tablet Styles (768px - 1024px) */
@media screen and (max-width: 1024px) {

    /* Reduce advertisement width */
    .ad-space {
        width: 120px;
    }

    .ad-placeholder {
        font-size: 12px;
        padding: 15px;
    }

    /* Adjust main title size */
    .main-title {
        font-size: 40px;
    }

    .section-title {
        font-size: 30px;
    }

    /* Adjust header banner */
    .header-banner {
        padding: 30px 15px 0;
    }

    /* Adjust input section */
    .input-section {
        padding: 15px;
    }

    /* Adjust party container */
    .party-container {
        max-width: 700px;
    }

    /* Adjust modal content */
    .modal-content {
        padding: 30px 40px;
        max-width: 500px;
    }

    .modal-content p {
        font-size: 20px;
    }
}

/* Mobile Styles (< 768px) */
@media screen and (max-width: 768px) {

    /* Reposition advertisements as horizontal rectangles on mobile */
    .ad-space {
        width: 100%;
        height: 80px;
        border: 2px solid rgba(255, 255, 255, 0.3);
    }

    .ad-left {
        order: -1;
        /* Move to top */
        border-right: 2px solid rgba(255, 255, 255, 0.3);
        border-bottom: none;
    }

    .ad-right {
        order: 1;
        /* Move to bottom */
        border-left: 2px solid rgba(255, 255, 255, 0.3);
        border-top: none;
    }

    .ad-placeholder {
        writing-mode: horizontal-tb;
        text-orientation: mixed;
        padding: 10px;
        font-size: 12px;
    }

    /* Adjust page container for mobile */
    .page-container {
        flex-direction: column;
    }

    .main-content {
        width: 100%;
        order: 0;
        /* Keep in the middle */
    }

    /* Adjust ad toggle button for mobile */
    .ad-toggle-button {
        top: 10px;
        left: 10px;
        padding: 8px 15px;
        font-size: 12px;
        border-radius: 20px;
    }

    /* Adjust language container for mobile */
    .language-container {
        top: 10px;
        right: 10px;
        padding: 8px 15px;
        border-radius: 20px;
        gap: 8px;
    }

    .language-label {
        font-size: 12px;
    }

    .language-dropdown {
        padding: 4px 8px;
        font-size: 12px;
        border-radius: 12px;
    }

    /* Adjust header banner */
    .header-banner {
        flex: 30%;
        padding: 20px 10px 0;
    }

    /* Adjust main title */
    .main-title {
        font-size: 28px;
        text-shadow: 1px 1px 6px rgba(212, 175, 55, 0.6), 0 0 15px rgba(255, 255, 255, 0.3);
    }

    /* Adjust input section */
    .input-section {
        flex: 70%;
        border-radius: 40px 40px 0 0;
        padding: 15px 10px;
    }

    .section-title {
        font-size: 24px;
        margin: 5px 0;
    }

    /* Adjust input wrapper */
    .input-wrapper {
        max-width: 100%;
        margin-top: 15px;
    }

    .input-name {
        font-size: 14px;
        padding: 12px;
    }

    /* Ensure buttons are touch-friendly (minimum 44px height) */
    button {
        padding: 12px 20px;
        font-size: 14px;
        min-height: 44px;
    }

    .button-add {
        padding: 12px 20px;
    }

    /* Adjust party container */
    .party-container {
        max-width: 100%;
        gap: 20px;
        margin-top: 20px;
    }

    /* Adjust party cards */
    .party-card {
        padding: 20px 15px;
        border-radius: 15px;
    }

    .party-name {
        font-size: 22px;
        margin-bottom: 8px;
    }

    .party-info {
        font-size: 12px;
        margin-bottom: 12px;
    }

    /* Adjust friend boxes */
    .friends-box-container {
        gap: 8px;
        margin: 15px 0;
    }

    .friend-box {
        padding: 10px 16px;
        font-size: 14px;
    }

    /* Adjust sortear button */
    .button-sortear {
        font-size: 16px;
        margin-top: 12px;
    }

    /* Adjust modal for mobile */
    .modal-content {
        padding: 25px 30px;
        max-width: 90%;
        margin: 0 15px;
        border-radius: 15px;
    }

    .modal-content p {
        font-size: 18px;
        line-height: 1.4;
    }

    /* Adjust countdown timer */
    .countdown-timer {
        top: 10px;
        right: 10px;
        width: 50px;
        height: 50px;
    }

    .countdown-timer circle {
        r: 20;
        cx: 25;
        cy: 25;
    }

    /* Reduce snowflake size on mobile */
    .snowflake {
        font-size: 1.2em;
    }

    .snowflake:nth-child(2),
    .snowflake:nth-child(4),
    .snowflake:nth-child(6) {
        font-size: 1.5em;
    }

    /* Mobile scrollbar - thinner for touch devices */
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }

    ::-webkit-scrollbar-thumb {
        border: 1px solid var(--color-secondary);
    }
}

/* Extra Small Mobile (< 375px) */
@media screen and (max-width: 375px) {
    .main-title {
        font-size: 24px;
    }

    .section-title {
        font-size: 20px;
    }

    .modal-content p {
        font-size: 16px;
    }

    .party-name {
        font-size: 20px;
    }

    .friend-box {
        padding: 8px 12px;
        font-size: 13px;
    }
}