/* ===================================
   Ema's Wineyard - Design System v2
   Fedele ai mockup IANUA
   =================================== */

:root {
    /* Colori - Esattamente come mockup */
    --bg-primary: #FFFFFF;
    --bg-cream: #FAF8F5;
    --text-dark: #2C1810;
    --text-wine: #722F37;
    --text-muted: #9A8A7B;
    --text-light: #B5A89A;
    --accent-gold: #C9A227;
    --border-light: #E8E4DC;

    /* Typography */
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-sans: 'Inter', -apple-system, sans-serif;

    /* Layout */
    --header-height: 56px;
    --nav-height: 64px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-dark);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ===================================
   Header - Esatto come mockup
   =================================== */

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-img {
    height: 36px;
    width: auto;
}

.logo-text {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    color: var(--text-dark);
}

.theme-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-gold);
    background: none;
    border: none;
    cursor: pointer;
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

/* ===================================
   Top Tabs - Nascoste (usare bottom nav)
   =================================== */

.top-tabs {
    display: none;
}

/* ===================================
   Main Content
   =================================== */

.main-content {
    padding-top: var(--header-height);
    padding-bottom: calc(var(--nav-height) + 20px);
    min-height: 100vh;
    background: var(--bg-primary);
}

/* ===================================
   Bottom Navigation - Come mockup
   =================================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.55rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.5;
}

.nav-btn.active {
    color: var(--accent-gold);
}

/* ===================================
   Page Title Section
   =================================== */

.page-header {
    text-align: center;
    padding: 40px 24px 24px;
}

.page-header h1 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.page-header p {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ===================================
   Search Bar - Come mockup
   =================================== */

.search-container {
    padding: 0 24px 32px;
    max-width: 500px;
    margin: 0 auto;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-cream);
    border: none;
    border-radius: 24px;
}

.search-bar svg {
    width: 16px;
    height: 16px;
    color: var(--text-light);
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    border: none;
    background: none;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-dark);
    outline: none;
}

.search-bar input::placeholder {
    color: var(--text-light);
}

/* ===================================
   Altitude Divider - ESATTO come mockup
   Cerchio oro con bordo, testo uppercase
   =================================== */

.altitude-section {
    padding: 32px 24px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.altitude-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent-gold);
    background: var(--bg-primary);
    flex-shrink: 0;
}

.altitude-title {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dark);
}

/* ===================================
   Winery Label
   =================================== */

.winery-label {
    padding: 16px 24px 8px;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-light);
}

/* ===================================
   Wine Card - ESATTO come mockup
   Sfondo bianco, bordo sottile, layout preciso
   =================================== */

.wine-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 16px 8px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.wine-card:hover {
    background: var(--bg-cream);
}

.wine-card-image {
    width: 40px;
    height: 56px;
    background: #F5F3F0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.wine-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wine-card-image .placeholder {
    font-size: 0.5rem;
    color: var(--text-light);
    text-align: center;
    line-height: 1.2;
}

.wine-card-content {
    flex: 1;
    min-width: 0;
}

.wine-card-name {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-wine);
    margin-bottom: 2px;
}

.wine-card-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.wine-card-arrow {
    color: var(--text-light);
    flex-shrink: 0;
}

.wine-card-arrow svg {
    width: 16px;
    height: 16px;
}

/* ===================================
   Winery Card
   =================================== */

.winery-card {
    margin: 0 16px 12px;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.winery-card:hover {
    background: var(--bg-cream);
}

.winery-card-name {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.winery-card-location {
    font-size: 0.75rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.winery-card-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.winery-card-wines-count {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

/* ===================================
   Menu Section
   =================================== */

.menu-section {
    padding: 0 24px 32px;
}

.menu-category {
    margin-bottom: 32px;
}

.menu-category-title {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 400;
    font-style: italic;
    color: var(--text-dark);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.menu-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
}

.menu-item-name {
    font-size: 0.9rem;
    color: var(--text-dark);
    flex: 1;
}

.menu-item-price {
    font-size: 0.85rem;
    color: var(--accent-gold);
    font-weight: 500;
    white-space: nowrap;
}

/* ===================================
   Glossary
   =================================== */

.glossary-list {
    padding: 0 24px;
}

.glossary-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-light);
}

.glossary-term {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 500;
    font-style: italic;
    color: var(--text-wine);
    margin-bottom: 6px;
}

.glossary-definition {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ===================================
   Modal - Wine/Winery Detail
   =================================== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-primary);
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.4s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-cream);
    border: none;
    color: var(--text-dark);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: 85vh;
}

/* Wine Detail */
.wine-detail-header {
    text-align: center;
    padding-bottom: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}

.wine-detail-name {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text-wine);
    margin-bottom: 8px;
}

.wine-detail-winery {
    font-size: 0.8rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.wine-detail-section {
    margin-bottom: 24px;
}

.wine-detail-section h4 {
    font-size: 0.7rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.wine-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.wine-detail-item {
    background: var(--bg-cream);
    padding: 12px;
    border-radius: 8px;
}

.wine-detail-item label {
    font-size: 0.65rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 4px;
}

.wine-detail-item span {
    font-size: 0.9rem;
    color: var(--text-dark);
}

.wine-tasting-notes {
    background: var(--bg-cream);
    padding: 16px;
    border-radius: 12px;
}

.wine-tasting-row {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.wine-tasting-row:last-child {
    margin-bottom: 0;
}

.wine-tasting-label {
    font-size: 0.7rem;
    color: var(--text-light);
    text-transform: uppercase;
    width: 60px;
    flex-shrink: 0;
}

.wine-tasting-value {
    font-size: 0.85rem;
    color: var(--text-dark);
}

/* ===================================
   Admin
   =================================== */

.admin-section {
    padding: 24px;
}

.admin-card {
    background: var(--bg-cream);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.admin-card h4 {
    font-size: 0.9rem;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.admin-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-dark);
    background: var(--bg-primary);
    margin-bottom: 12px;
}

.admin-input:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.admin-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent-gold);
    color: #FFF;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
}

.admin-btn:hover {
    background: var(--text-wine);
}

/* ===================================
   Offline Indicator
   =================================== */

.offline-indicator {
    position: fixed;
    bottom: calc(var(--nav-height) + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--text-dark);
    color: var(--bg-primary);
    border-radius: 20px;
    font-size: 0.75rem;
    z-index: 101;
    opacity: 0;
    transition: all 0.3s;
}

.offline-indicator.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.offline-indicator svg {
    width: 14px;
    height: 14px;
}

/* ===================================
   Dark Theme
   =================================== */

[data-theme="dark"] {
    --bg-primary: #1A1714;
    --bg-cream: #242019;
    --text-dark: #F5F3F0;
    --text-wine: #D4A8AC;
    --text-muted: #9A8A7B;
    --text-light: #6B5D50;
    --border-light: #3A342C;
}

/* ===================================
   Scrollbar
   =================================== */

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 2px;
}