/* ===== CSS Variables ===== */
:root {
    --color-bg: #1a1a2e;
    --color-bg-light: #16213e;
    --color-primary: #c41e3a;
    --color-primary-dark: #a01830;
    --color-accent: #ffd700;
    --color-white: #ffffff;
    --color-text: #e8e8e8;
    --color-text-muted: #a0a0a0;
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Open Sans', sans-serif;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.4);
    --radius: 12px;
    --transition: all 0.3s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    color-scheme: dark;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* ===== Canvas for Snowflakes ===== */
#snowCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    z-index: 10;
}

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    z-index: 100;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    user-select: none;
    -webkit-user-select: none; /* Safari */
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--color-white);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none; /* iOS specific */
    -webkit-user-drag: none;
}

.logo-icon {
    font-size: 2rem;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-white), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-accent);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--color-accent);
}

.nav-link:hover::after {
    width: 100%;
}

/* ===== Hero Section ===== */
.hero {
    /* Use stable viewport height set by JS to prevent layout shift on mobile */
    min-height: 100vh; /* fallback */
    min-height: calc(var(--stable-vh, 1vh) * 100);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 120px 20px 80px;
    background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-light) 100%);
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, rgba(196, 30, 58, 0.1) 0%, transparent 70%);
}

.hero .container {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--color-white), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: var(--color-text-muted);
    max-width: 600px;
    margin: 0 auto 40px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 15px 40px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: var(--color-white);
    box-shadow: 0 4px 15px rgba(196, 30, 58, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(196, 30, 58, 0.5);
}

/* ===== Section Titles ===== */
.section-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 700;
    text-align: center;
    margin-bottom: 15px;
    color: var(--color-white);
}

.section-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    max-width: 500px;
    margin: 0 auto 50px;
}

/* ===== Stores Section ===== */
.stores {
    padding: 100px 0;
    background: var(--color-bg-light);
    position: relative;
    z-index: 2;
}

.stores::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(to bottom, transparent, var(--color-bg));
    pointer-events: none;
    z-index: 1;
}

/* ===== City Selector ===== */
.city-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.city-btn {
    padding: 12px 30px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.city-btn:hover {
    color: var(--color-white);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 215, 0, 0.3);
}

.city-btn.active {
    color: var(--color-white);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border-color: var(--color-primary);
    box-shadow: 0 4px 15px rgba(196, 30, 58, 0.3);
}

.stores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 50px;
}

.store-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.store-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    transition: var(--transition);
}

.store-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 215, 0, 0.4);
    box-shadow: var(--shadow-hover);
}

.store-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.store-name {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--color-white);
    margin-bottom: 10px;
}

.store-address {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-bottom: 10px;
    user-select: text;
    -webkit-user-select: text;
}

.store-hours {
    color: var(--color-accent);
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===== Not Open Stores ===== */
.store-card.not-open {
    opacity: 0.6;
}

.store-card.not-open .store-icon {
    opacity: 0.5;
}

.store-card.not-open .store-name {
    color: var(--color-text-muted);
}

.store-card.not-open .store-address {
    opacity: 0.7;
}

.store-opening-date {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0.6;
}

/* ===== Order Section ===== */
.order {
    padding: 100px 0;
    background: var(--color-bg);
    position: relative;
    z-index: 2;
    overflow-x: hidden;
}

.order-form {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: var(--radius);
    padding: 40px;
    overflow: hidden;
    box-sizing: border-box;
}

.form-group {
    margin-bottom: 25px;
    max-width: 100%;
    min-width: 0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 25px; /* Add margin to the row itself instead of items */
}

.form-row .form-group {
    margin-bottom: 0px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--color-text);
}

.form-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 14px 18px;
    height: 52px; /* Fixed height for consistency */
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-white);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    line-height: normal; /* Fix for vertical alignment */
}

.form-input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

/* Date and Time inputs placeholder styling */
input[type="date"].form-input,
input[type="time"].form-input {
    color: var(--color-text-muted);
    min-height: 52px; /* Ensure height match */
}

input[type="date"].form-input.has-value,
input[type="time"].form-input.has-value {
    color: var(--color-white);
}

/* Fix for WebKit date input placeholder color if needed */
input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="time"]::-webkit-datetime-edit-fields-wrapper {
    /* inherit color from input */
    display: block;
}

.form-textarea {
    min-height: 120px;
    height: auto;
    resize: vertical;
}

select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23ffd700' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
}

.select-wrapper {
    position: relative;
    width: 100%;
}

.select-placeholder {
    position: absolute;
    left: 19px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
    font-size: 1rem;
    font-family: var(--font-body);
    display: none; /* Hidden by default */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    right: 40px; /* Avoid arrow */
}

/* Show placeholder when select is "empty" (handled by JS class) */
.select-wrapper.empty .select-placeholder {
    display: block;
}

select.form-input option {
    background: var(--color-bg);
    color: var(--color-text);
}

.btn-submit {
    width: 100%;
    padding: 18px;
    font-size: 1.1rem;
    margin-top: 10px;
}

/* ===== Footer ===== */
.footer {
    background: var(--color-bg-light);
    padding: 50px 0 30px;
    border-top: 1px solid rgba(255, 215, 0, 0.2);
    position: relative;
    z-index: 2;
}

.footer-content {
    text-align: center;
    margin-bottom: 30px;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.footer-text {
    color: var(--color-text-muted);
    margin-bottom: 10px;
}

.footer-contact {
    color: var(--color-accent);
    font-weight: 500;
}

.footer-copyright {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--color-bg-light);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: var(--radius);
    padding: 50px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.8rem;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--color-white);
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--color-white);
    margin-bottom: 15px;
}

.modal-text {
    color: var(--color-text-muted);
    margin-bottom: 30px;
}

.modal-btn {
    padding: 12px 40px;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 15px;
    }

    .nav {
        gap: 20px;
    }

    .hero {
        padding: 140px 20px 60px;
    }

    .form-row {
        display: flex;
        flex-direction: column;
        gap: 25px;
    }

    .order-form {
        width: 100%;
        padding: 24px 16px;
    }

    .stores-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .logo-text {
        font-size: 1.1rem;
    }

    .btn {
        padding: 12px 30px;
        font-size: 0.95rem;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .modal-content {
        padding: 30px 20px;
    }

    .order-form {
        width: 100%;
        padding: 18px 12px;
    }

    .form-input {
        padding: 12px 10px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-width: 0;
    }
}

/* Принудительное наследование цвета для всех частей даты и времени */
::-webkit-datetime-edit,
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-year-field,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-minute-field,
::-webkit-datetime-edit-ampm-field {
    color: inherit;
}
