/* Design tokens are imported from design-tokens.css */
/* Legacy support - these will be gradually removed */
:root {
    /* All tokens now in design-tokens.css */
}

/* Dark mode handled in design-tokens.css */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    height: 100%;
}

body {
    overflow-x: hidden;
    margin: 0;
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    /* iOS Chrome/Safari fixes */
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    /* Prevent zoom on input focus */
    touch-action: manipulation;
}

/* 
 * RobotoForN @font-face declarations moved to design-tokens.css
 * Font family stack moved to design-tokens.css
 * Font rendering optimizations moved to design-tokens.css
 */

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0 0 var(--spacing-md);
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.75rem;
}

h4 {
    font-size: 1.5rem;
}

h5 {
    font-size: 1.25rem;
}

h6 {
    font-size: 1rem;
    font-family: 'Roboto', sans-serif;
}

/* Section titles */
.section-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: left;
    margin-bottom: var(--spacing-xl);
    color: var(--color-primary);
    text-shadow: none;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 64px;
    padding: 0 var(--spacing-md);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.btn {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: 500;
    text-align: center;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-primary:not(.hero-btn-new):hover {
    background: var(--color-primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

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

/* === BUTTON SIZES === */
.btn-large {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1.125rem;
    font-family: 'Roboto', sans-serif;
    min-height: 48px;
}

.btn-small {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.875rem;
    font-family: 'Roboto', sans-serif;
}

.btn-block {
    width: 100%;
    display: block;
}

.messages {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.message {
    background: var(--color-bg);
    border-radius: 6px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    opacity: 1;
    transition: opacity var(--transition-base);
}

.message-fade-out {
    opacity: 0;
}

.message-success {
    border-left: 4px solid var(--color-success);
}

.message-error {
    border-left: 4px solid var(--color-error);
}

.message-warning {
    border-left: 4px solid var(--color-warning);
}

.message-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-light);
    padding: 0 0 0 var(--spacing-md);
    line-height: 1;
}

/* Cart header messages */
.cart-header-message {
    position: fixed;
    top: 80px;
    right: 20px;
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    z-index: 1000;
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    max-width: 300px;
    animation: slideInRight 0.3s ease;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.cart-header-message--success {
    background: var(--color-success);
}

.cart-header-message--error {
    background: var(--color-error);
}

.cart-header-message--info {
    background: var(--color-info);
}

.main {
    min-height: calc(100vh - 200px);
}

/* Modal Open - prevent body scroll */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    overscroll-behavior: contain;
    /* iOS Chrome/Safari specific - allow vertical scroll inside modals */
    -webkit-overflow-scrolling: touch;
    /* Allow vertical pan for modal content */
    touch-action: pan-y pinch-zoom;
    /* Prevent bounce effect */
    overscroll-behavior-y: contain;
}

/* iOS Chrome/Safari specific fixes */
@supports (-webkit-touch-callout: none) {

    /* iOS Safari */
    body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }

    body.modal-open {
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y pinch-zoom;
        overscroll-behavior-y: contain;
    }

    /* Prevent iOS Safari bounce */
    html,
    body {
        overscroll-behavior: contain;
    }
}

/* iOS Chrome specific */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    body.modal-open {
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y pinch-zoom;
    }
}


@media (max-width: 1024px) {

    /* Додати padding знизу для компенсації нижньої навігації */

    /* Адаптація типографіки */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

}

.form-control {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 1rem;
    font-family: 'Roboto', sans-serif;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.card {
    background: var(--color-bg);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-body {
    padding: var(--spacing-md);
}

.card-title {
    margin-bottom: var(--spacing-sm);
    font-size: 1.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.card-text {
    color: var(--color-text-light);
    margin-bottom: var(--spacing-md);
}

.grid {
    display: grid;
    gap: var(--spacing-lg);
}

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

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

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 767px) {

    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 481px) and (max-width: 1024px) {

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

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

.svg-icons-hidden {
    display: none;
}

/* Warning alerts for phone-only users */
.completion-alert--warning {
    background: linear-gradient(135deg, #ffe6e8 0%, #ffccd0 100%);
    border-left: 4px solid #E50914;
    color: #b8070f;
    padding: var(--spacing-lg);
    border-radius: 8px;
    margin-bottom: var(--spacing-lg);
}

/* Info alerts for email users */
.completion-alert--info {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    border-left: 4px solid #000000;
    color: #000000;
    padding: var(--spacing-lg);
    border-radius: 8px;
    margin-bottom: var(--spacing-lg);
}

.completion-alert--warning h3 {
    color: #b8070f;
    margin-bottom: var(--spacing-sm);
}

.completion-alert--info h3 {
    color: #000000;
    margin-bottom: var(--spacing-sm);
}

.btn--warning {
    background: linear-gradient(135deg, #E50914 0%, #b8070f 100%);
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.btn--warning:hover {
    background: linear-gradient(135deg, #b8070f 0%, #8a0509 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(229, 9, 20, 0.3);
    color: #ffffff;
    text-decoration: none;
}

.btn-group {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.btn--outline {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.btn--outline:hover {
    background: var(--color-primary);
    color: white;
    text-decoration: none;
}

/* iOS Safari specific fixes */
html.ios-safari {
    /* Fix for viewport height on iOS */
    height: -webkit-fill-available;
}

html.ios-safari body {
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* Fix for sticky positioning on iOS */
html.ios-safari .main-header,
@supports (-webkit-touch-callout: none) {
    .main-header {
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        z-index: 1000;
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
}

/* Fix for smooth scrolling on iOS */
html.ios-safari {
    -webkit-overflow-scrolling: touch;
}

/* Prevent iOS zoom on focus */
@media (max-width: 1024px) {

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="url"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px;
        font-family: 'Roboto', sans-serif;
    }
}

/* Mobile adaptations */
@media (max-width: 767px) {
    .container {
        margin: 0 auto;
        padding: 0 var(--spacing-md);
    }

    .messages {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .message {
        font-size: 0.875rem;
        font-family: 'Roboto', sans-serif;
        padding: var(--spacing-sm);
    }
}

/* Tablet specific styles (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        margin: 0 auto;
        max-width: 95%;
        padding: 0 var(--spacing-lg);
    }

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

    .hero-title {
        font-size: clamp(2rem, 4vw, 3rem);
    }

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

/* Small mobile devices */
@media (max-width: 767px) {
    .btn {
        font-size: 0.875rem;
        font-family: 'Roboto', sans-serif;
        padding: var(--spacing-xs) var(--spacing-md);
    }

    .logo {
        height: 32px;
    }

    .logo-light,
    .logo-dark {
        height: 32px;
    }

    .container {
        margin: 0 auto;
        padding: 0 var(--spacing-sm);
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }
}