/* ============================
   The Cork - Wine Cellar App
   iOS Human Interface Guidelines
   Redesign
   ============================ */

:root {
    /* System-inspired colors */
    --system-blue: #007AFF;
    --system-red: #FF3B30;
    --system-green: #34C759;
    --system-orange: #FF9500;

    /* Wine accent colors */
    --wine-primary: #722F37;
    --wine-secondary: #8B4553;
    --wine-tertiary: #A65D6A;

    /* Backgrounds - iOS style */
    --bg-primary: #F2F2F7;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F2F2F7;
    --bg-grouped: #FFFFFF;

    /* Text colors - iOS standard */
    --label-primary: #000000;
    --label-secondary: #3C3C43;
    --label-tertiary: #3C3C4399;
    --label-quaternary: #3C3C434D;

    /* Separators */
    --separator: #3C3C4349;
    --separator-opaque: #C6C6C8;

    /* Wine type colors */
    --red-wine: #722F37;
    --white-wine: #E8D5A0;
    --rose-wine: #E8B4B8;
    --sparkling-wine: #F5E6C8;
    --dessert-wine: #C4956A;

    /* iOS Typography scale */
    --font-large-title: 34px;
    --font-title1: 28px;
    --font-title2: 22px;
    --font-title3: 20px;
    --font-headline: 17px;
    --font-body: 17px;
    --font-callout: 16px;
    --font-subhead: 15px;
    --font-footnote: 13px;
    --font-caption1: 12px;
    --font-caption2: 11px;

    /* Spacing - 8pt grid */
    --space-4: 4px;
    --space-8: 8px;
    --space-12: 12px;
    --space-16: 16px;
    --space-20: 20px;
    --space-24: 24px;
    --space-32: 32px;
    --space-44: 44px;

    /* iOS corner radii */
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-card: 12px;
    --radius-modal: 12px;

    /* System fonts */
    --font-system: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', system-ui, sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;

    /* Shadows - iOS style */
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-system);
    background: var(--bg-primary);
    color: var(--label-primary);
    line-height: 1.47;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ============================
   Navigation Bar (Header)
   iOS: 44pt content + safe area
   ============================ */

.header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(242, 242, 247, 0.94);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--separator);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 44px;
    padding: 0 var(--space-16);
    max-width: 600px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    height: 44px;
}

.logo-icon {
    height: 28px;
    width: auto;
}

.header-stats {
    font-size: var(--font-footnote);
    font-weight: 500;
    color: var(--label-secondary);
    background: rgba(60, 60, 67, 0.08);
    padding: 6px 12px;
    border-radius: 100px;
}

/* Sync Status Indicator */
.sync-status {
    font-size: var(--font-caption2);
    padding: 4px 8px;
    border-radius: 100px;
    margin-left: var(--space-8);
}

.sync-status .status-local {
    color: var(--label-tertiary);
}

.sync-status .status-connecting,
.sync-status .status-syncing {
    color: var(--system-orange);
}

.sync-status .status-synced {
    color: var(--system-green);
}

.sync-status .status-error {
    color: var(--system-red);
}

.sync-status .status-disconnected {
    color: var(--label-tertiary);
}

/* Header Icon Buttons - 44pt touch target */
.header-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--wine-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-icon-btn:first-of-type {
    margin-left: auto;
}

.header-icon-btn svg {
    width: 22px;
    height: 22px;
}

.header-icon-btn:active {
    opacity: 0.6;
}

/* Legacy support */
.settings-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--wine-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.settings-btn svg {
    width: 24px;
    height: 24px;
}

.settings-btn:active {
    opacity: 0.6;
}

/* ============================
   Main Content
   ============================ */

.main-content {
    flex: 1;
    padding: var(--space-16);
    padding-bottom: 100px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* ============================
   Search Bar - iOS Style
   ============================ */

/* ============================
   Filter Bar (Sticky)
   ============================ */

.filter-bar {
    position: sticky;
    top: 44px;
    z-index: 100;
    background: var(--bg-primary);
    padding: var(--space-12) 0 var(--space-16) 0;
    margin-bottom: var(--space-8);
    border-bottom: 1px solid var(--separator);
}

.filter-bar.hidden {
    display: none;
}

.filter-controls {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-8);
    margin-top: var(--space-12);
}

.control-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    height: 36px;
    padding: 0 var(--space-16);
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--label-primary);
    font-size: var(--font-footnote);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: var(--bg-tertiary);
}

.control-btn svg {
    width: 18px;
    height: 18px;
}

.control-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: var(--space-8);
    background: var(--bg-secondary);
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-12);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}

.control-dropdown.hidden {
    display: none;
}

.filter-section {
    padding: var(--space-8) 0;
    border-bottom: 1px solid var(--separator);
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-section h4 {
    font-size: var(--font-caption1);
    font-weight: 600;
    color: var(--label-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--space-8) var(--space-16);
    margin: 0;
}

.control-option {
    width: 100%;
    padding: var(--space-12) var(--space-16);
    border: none;
    background: transparent;
    text-align: left;
    font-size: var(--font-body);
    color: var(--label-primary);
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--space-8);
}

.control-option:hover {
    background: var(--bg-tertiary);
}

.control-option.active {
    color: var(--wine-primary);
    font-weight: 600;
}

.control-option.active::before {
    content: '✓';
    font-weight: 600;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: var(--label-tertiary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 36px;
    padding: 0 36px;
    border: none;
    border-radius: 10px;
    font-size: var(--font-body);
    font-family: var(--font-system);
    color: var(--label-primary);
    background: rgba(118, 118, 128, 0.12);
    -webkit-appearance: none;
}

.search-input:focus {
    outline: none;
}

.search-input::placeholder {
    color: var(--label-tertiary);
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(60, 60, 67, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.clear-search-btn svg {
    width: 12px;
    height: 12px;
}

.clear-search-btn.hidden {
    display: none;
}

.search-results {
    margin-top: var(--space-8);
    padding: 0 var(--space-4);
    font-size: var(--font-footnote);
    color: var(--label-secondary);
}

.search-results.hidden {
    display: none;
}

/* No Results State */
.no-results {
    text-align: center;
    padding: var(--space-44) var(--space-24);
    color: var(--label-tertiary);
}

.no-results svg {
    width: 44px;
    height: 44px;
    margin-bottom: var(--space-12);
    opacity: 0.4;
}

.no-results p {
    font-size: var(--font-subhead);
}

/* Search Highlight */
.wine-card-name mark,
.wine-card-producer mark,
.wine-card-meta mark {
    background: rgba(114, 47, 55, 0.2);
    color: var(--wine-primary);
    padding: 0 2px;
    border-radius: 2px;
}

/* ============================
   Empty State
   ============================ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-44) var(--space-24);
    min-height: 60vh;
}

.empty-illustration {
    margin-bottom: var(--space-24);
}

.empty-illustration .empty-logo {
    width: 280px;
    height: auto;
    opacity: 0.8;
}

.empty-state h2 {
    font-size: var(--font-title2);
    font-weight: 700;
    color: var(--label-primary);
    margin-bottom: var(--space-8);
    letter-spacing: -0.4px;
}

.empty-state p {
    color: var(--label-secondary);
    font-size: var(--font-body);
}

.empty-state.hidden {
    display: none;
}

/* ============================
   Wine List - iOS Table Style
   ============================ */

.wine-list {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: var(--radius-card);
    overflow: hidden;
}

.wine-card {
    background: var(--bg-secondary);
    padding: var(--space-12) var(--space-16);
    display: flex;
    gap: var(--space-12);
    cursor: pointer;
    position: relative;
    min-height: 88px;
    align-items: center;
}

.wine-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 94px;
    right: 0;
    height: 0.5px;
    background: var(--separator);
}

.wine-card:last-child::after {
    display: none;
}

.wine-card:active {
    background: rgba(60, 60, 67, 0.06);
}

.wine-card-image {
    width: 66px;
    height: 66px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.wine-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #ffffff;
}

.wine-card-image .placeholder-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.wine-card-image .placeholder-image.red { background: linear-gradient(135deg, var(--red-wine), #4a1c22); }
.wine-card-image .placeholder-image.white { background: linear-gradient(135deg, var(--white-wine), #c9bc6a); }
.wine-card-image .placeholder-image.rosé { background: linear-gradient(135deg, var(--rose-wine), #d98a91); }
.wine-card-image .placeholder-image.sparkling { background: linear-gradient(135deg, var(--sparkling-wine), #e8d5a3); }
.wine-card-image .placeholder-image.dessert { background: linear-gradient(135deg, var(--dessert-wine), #a67844); }

.wine-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.wine-card-name {
    font-size: var(--font-body);
    font-weight: 600;
    color: var(--label-primary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.4px;
}

.wine-card-producer {
    font-size: var(--font-subhead);
    font-weight: 400;
    color: var(--wine-primary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wine-card-meta {
    font-size: var(--font-footnote);
    color: var(--label-secondary);
}

.wine-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-4);
}

.wine-type-tag {
    font-size: var(--font-caption2);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 3px 8px;
    border-radius: 4px;
}

.wine-type-tag.red { background: rgba(114, 47, 55, 0.12); color: var(--red-wine); }
.wine-type-tag.white { background: rgba(200, 180, 100, 0.25); color: #7a6f2e; }
.wine-type-tag.rosé { background: rgba(232, 180, 184, 0.35); color: #9e5a60; }
.wine-type-tag.sparkling { background: rgba(245, 230, 200, 0.5); color: #8a7645; }
.wine-type-tag.dessert { background: rgba(196, 149, 106, 0.25); color: #8b6239; }

.wine-quantity {
    font-size: var(--font-footnote);
    color: var(--label-secondary);
}

/* Disclosure indicator */
.wine-card::before {
    content: '';
    position: absolute;
    right: var(--space-16);
    width: 8px;
    height: 13px;
    background-image: url("data:image/svg+xml,%3Csvg width='8' height='13' viewBox='0 0 8 13' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6.5 6.5L1 12' stroke='%23C7C7CC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

/* ============================
   FAB (Floating Action Button)
   iOS style
   ============================ */

.fab {
    position: fixed;
    bottom: var(--space-24);
    right: var(--space-24);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--wine-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(114, 47, 55, 0.4);
    transition: transform 0.2s ease;
    z-index: 90;
}

.fab svg {
    width: 24px;
    height: 24px;
    stroke-width: 2.5;
}

.fab:active {
    transform: scale(0.94);
}

/* Wine Card Enriching Indicator */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.wine-enriching-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-caption2);
    color: var(--wine-secondary);
    font-weight: 500;
}

.enriching-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 1.5px solid var(--separator-opaque);
    border-top-color: var(--wine-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================
   Modal Sheets - iOS Style
   ============================ */

.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-modal) var(--radius-modal) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.modal.active .modal-content {
    transform: translateY(0);
}

/* Modal handle indicator */
.modal-content::before {
    content: '';
    display: block;
    width: 36px;
    height: 5px;
    background: rgba(60, 60, 67, 0.3);
    border-radius: 2.5px;
    margin: 6px auto var(--space-8);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-8) var(--space-16) var(--space-12);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
}

.modal-header h2 {
    font-size: var(--font-headline);
    font-weight: 600;
    letter-spacing: -0.4px;
}

.close-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(60, 60, 67, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--label-secondary);
}

.close-btn svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.5;
}

.close-btn:active {
    background: rgba(60, 60, 67, 0.2);
}

.modal-body {
    padding: var(--space-16);
}

/* ============================
   Settings Modal
   ============================ */

.settings-modal .modal-body {
    padding: 0 var(--space-16) var(--space-24);
}

.settings-section {
    margin-bottom: var(--space-32);
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: var(--font-footnote);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--label-secondary);
    margin-bottom: var(--space-8);
    padding: 0 var(--space-4);
}

.settings-description {
    font-size: var(--font-subhead);
    color: var(--label-secondary);
    line-height: 1.4;
    margin-bottom: var(--space-12);
    padding: 0 var(--space-4);
}

.settings-description a {
    color: var(--system-blue);
    text-decoration: none;
}

.api-key-status {
    margin-bottom: var(--space-12);
    padding: var(--space-12) var(--space-16);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: var(--font-subhead);
}

.status-connected {
    color: var(--system-green);
    font-weight: 500;
}

.status-disconnected {
    color: var(--label-tertiary);
}

.api-key-input-group {
    display: flex;
    gap: var(--space-8);
    margin-bottom: var(--space-12);
}

.api-key-input {
    flex: 1;
    height: 44px;
    padding: 0 var(--space-12);
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-md);
    font-size: var(--font-body);
    font-family: ui-monospace, monospace;
    background: var(--bg-secondary);
}

.api-key-input:focus {
    outline: none;
    border-color: var(--wine-primary);
}

.save-key-btn {
    height: 44px;
    padding: 0 var(--space-20);
    border: none;
    border-radius: var(--radius-md);
    background: var(--wine-primary);
    color: white;
    font-size: var(--font-body);
    font-weight: 600;
    cursor: pointer;
}

.save-key-btn:active {
    opacity: 0.8;
}

/* Google Sign-In Button */
.google-sign-in-btn {
    width: 100%;
    height: 50px;
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-md);
    background: white;
    color: var(--label-primary);
    font-size: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-12);
    margin-bottom: var(--space-12);
    transition: background 0.2s;
}

.google-sign-in-btn:hover {
    background: var(--bg-tertiary);
}

.google-sign-in-btn:active {
    background: rgba(60, 60, 67, 0.1);
}

.clear-key-btn {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--label-secondary);
    font-size: var(--font-body);
    cursor: pointer;
}

.clear-key-btn:active {
    background: rgba(60, 60, 67, 0.12);
}

/* ============================
   Upload Section
   ============================ */

.upload-section {
    margin-bottom: var(--space-20);
}

.image-preview {
    width: 100%;
    aspect-ratio: 4/3;
    border-radius: var(--radius-lg);
    border: 2px dashed var(--separator-opaque);
    overflow: hidden;
    position: relative;
    background: var(--bg-tertiary);
    cursor: pointer;
}

.image-preview:active {
    border-color: var(--wine-tertiary);
}

.image-preview.has-image {
    border-style: solid;
    border-color: transparent;
}

.upload-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    color: var(--label-tertiary);
}

.upload-placeholder svg {
    width: 44px;
    height: 44px;
    opacity: 0.5;
}

.upload-placeholder span {
    font-size: var(--font-subhead);
}

.image-preview.has-image .upload-placeholder {
    display: none;
}

#previewImg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.image-preview.has-image #previewImg {
    display: block;
}

.upload-buttons {
    display: flex;
    gap: var(--space-12);
    margin-top: var(--space-12);
}

.upload-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    height: 44px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--bg-tertiary);
    color: var(--label-primary);
    font-size: var(--font-body);
    font-weight: 500;
    cursor: pointer;
}

.upload-btn svg {
    width: 20px;
    height: 20px;
}

.upload-btn:active {
    background: rgba(60, 60, 67, 0.12);
}

/* ============================
   Scanning Indicator
   ============================ */

.scanning-indicator {
    padding: var(--space-20);
    text-align: center;
    margin-bottom: var(--space-16);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
}

.scanning-indicator.hidden {
    display: none;
}

.scanning-animation {
    width: 100%;
    height: 3px;
    background: rgba(60, 60, 67, 0.1);
    border-radius: 1.5px;
    overflow: hidden;
    margin-bottom: var(--space-12);
}

.scan-line {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--wine-primary), transparent);
    animation: scan 1.5s ease-in-out infinite;
}

@keyframes scan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

.scanning-indicator p {
    font-size: var(--font-subhead);
    color: var(--label-secondary);
}

/* ============================
   Wine Form - iOS Style
   ============================ */

.wine-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-20);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.form-group label {
    font-size: var(--font-footnote);
    font-weight: 500;
    color: var(--label-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding-left: var(--space-4);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    height: 44px;
    padding: 0 var(--space-12);
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-md);
    font-size: var(--font-body);
    font-family: var(--font-system);
    color: var(--label-primary);
    background: var(--bg-secondary);
    -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--wine-primary);
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%233C3C43' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-group textarea {
    height: auto;
    min-height: 88px;
    padding: var(--space-12);
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-12);
}

/* Characteristics Section */
.characteristics-section {
    background: var(--bg-tertiary);
    padding: var(--space-16);
    border-radius: var(--radius-lg);
    margin: var(--space-4) 0;
}

.characteristics-section h3 {
    font-size: var(--font-footnote);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--label-secondary);
    margin-bottom: var(--space-16);
}

.characteristic-slider {
    margin-bottom: var(--space-20);
}

.characteristic-slider:last-child {
    margin-bottom: 0;
}

.characteristic-slider label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-subhead);
    font-weight: 500;
    color: var(--label-primary);
    margin-bottom: var(--space-8);
    text-transform: none;
    letter-spacing: 0;
    padding: 0;
}

.char-value {
    background: var(--wine-primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-caption1);
    font-weight: 600;
}

.characteristic-slider input[type="range"] {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(60, 60, 67, 0.12);
    -webkit-appearance: none;
    margin-bottom: var(--space-4);
}

.characteristic-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-caption2);
    color: var(--label-tertiary);
}

/* Quantity Control */
.quantity-control {
    display: flex;
    align-items: center;
    height: 44px;
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.quantity-control input {
    width: 50px;
    text-align: center;
    border: none !important;
    height: 42px !important;
    padding: 0 !important;
    font-weight: 600;
    -moz-appearance: textfield;
}

.quantity-control input::-webkit-outer-spin-button,
.quantity-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.qty-btn {
    width: 44px;
    height: 42px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--wine-primary);
    font-size: 1.5rem;
    font-weight: 400;
    cursor: pointer;
}

.qty-btn:active {
    background: rgba(60, 60, 67, 0.12);
}

/* Submit Button - iOS style */
.submit-btn {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--wine-primary);
    color: white;
    font-size: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    margin-top: var(--space-8);
}

.submit-btn:active {
    opacity: 0.8;
}

/* ============================
   Detail Modal
   ============================ */

.detail-modal {
    display: flex;
    flex-direction: column;
}

.detail-modal::before {
    display: none;
}

.detail-close {
    position: absolute;
    top: var(--space-12);
    right: var(--space-12);
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
}

.detail-header {
    position: relative;
}

.detail-image {
    width: 100%;
    height: 280px;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-modal) var(--radius-modal) 0 0;
}

.detail-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--bg-tertiary);
}

.detail-image .placeholder-bg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-image .placeholder-bg.red { background: linear-gradient(135deg, var(--red-wine), #4a1c22); }
.detail-image .placeholder-bg.white { background: linear-gradient(135deg, var(--white-wine), #c9bc6a); }
.detail-image .placeholder-bg.rosé { background: linear-gradient(135deg, var(--rose-wine), #d98a91); }
.detail-image .placeholder-bg.sparkling { background: linear-gradient(135deg, var(--sparkling-wine), #e8d5a3); }
.detail-image .placeholder-bg.dessert { background: linear-gradient(135deg, var(--dessert-wine), #a67844); }

.wine-type-badge {
    position: absolute;
    bottom: var(--space-12);
    left: var(--space-12);
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    border-radius: 100px;
    font-size: var(--font-caption1);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--wine-primary);
}

.detail-body {
    padding: var(--space-20);
}

.detail-title-section {
    margin-bottom: var(--space-20);
}

.detail-title-section h2 {
    font-size: var(--font-title2);
    font-weight: 700;
    color: var(--label-primary);
    margin-bottom: var(--space-4);
    letter-spacing: -0.4px;
}

.detail-producer {
    font-size: var(--font-body);
    font-weight: 500;
    color: var(--wine-primary);
    margin-bottom: var(--space-4);
}

.detail-region {
    font-size: var(--font-subhead);
    color: var(--label-secondary);
}

.detail-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-8);
    padding: var(--space-16);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-20);
}

.meta-item {
    text-align: center;
}

.meta-label {
    display: block;
    font-size: var(--font-caption2);
    font-weight: 500;
    color: var(--label-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: var(--space-4);
}

.meta-value {
    font-size: var(--font-body);
    font-weight: 600;
    color: var(--label-primary);
}

.detail-store {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    padding: var(--space-12) var(--space-16);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-20);
}

.detail-store .store-icon {
    font-size: 1.2rem;
}

.detail-store #detailStore {
    font-size: var(--font-subhead);
    color: var(--label-primary);
    font-weight: 500;
}

.detail-characteristics {
    margin-bottom: var(--space-20);
}

.detail-characteristics h3 {
    font-size: var(--font-footnote);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--label-secondary);
    margin-bottom: var(--space-12);
}

.char-bars {
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
}

.char-bar-item {
    display: flex;
    align-items: center;
    gap: var(--space-12);
}

.char-label {
    width: 70px;
    font-size: var(--font-subhead);
    color: var(--label-secondary);
}

.char-bar {
    flex: 1;
    height: 6px;
    background: rgba(60, 60, 67, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.char-fill {
    height: 100%;
    background: var(--wine-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.detail-notes {
    margin-bottom: var(--space-20);
    padding: var(--space-16);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.detail-notes h3 {
    font-size: var(--font-footnote);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--label-secondary);
    margin-bottom: var(--space-8);
}

.detail-notes p {
    font-size: var(--font-body);
    color: var(--label-primary);
    line-height: 1.5;
}

.detail-quantity-section {
    text-align: center;
    padding: var(--space-20);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-20);
}

.detail-quantity-section h3 {
    font-size: var(--font-footnote);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--label-secondary);
    margin-bottom: var(--space-16);
}

.detail-quantity-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-24);
}

.qty-btn.large {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--separator-opaque);
    color: var(--wine-primary);
}

.qty-btn.large:active {
    background: rgba(60, 60, 67, 0.08);
}

.detail-qty-value {
    font-size: 44px;
    font-weight: 700;
    color: var(--wine-primary);
    min-width: 60px;
    letter-spacing: -1px;
}

.bottles-label {
    display: block;
    font-size: var(--font-subhead);
    color: var(--label-secondary);
    margin-top: var(--space-8);
}

.detail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-12);
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    height: 50px;
    border-radius: var(--radius-md);
    font-size: var(--font-body);
    font-weight: 600;
    cursor: pointer;
}

.action-btn svg {
    width: 18px;
    height: 18px;
}

.edit-btn {
    background: var(--bg-tertiary);
    border: none;
    color: var(--label-primary);
}

.edit-btn:active {
    background: rgba(60, 60, 67, 0.12);
}

.delete-btn {
    background: rgba(255, 59, 48, 0.1);
    border: none;
    color: var(--system-red);
}

.delete-btn:active {
    background: rgba(255, 59, 48, 0.2);
}

/* ============================
   Delete Modal - iOS Alert Style
   ============================ */

.delete-modal {
    border-radius: 14px;
    margin: var(--space-16);
    padding: var(--space-20);
    text-align: center;
    max-width: 270px;
}

.delete-modal::before {
    display: none;
}

.delete-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-16);
    color: var(--system-red);
}

.delete-icon svg {
    width: 100%;
    height: 100%;
}

.delete-modal h3 {
    font-size: var(--font-headline);
    font-weight: 600;
    margin-bottom: var(--space-8);
    letter-spacing: -0.4px;
}

.delete-modal p {
    font-size: var(--font-footnote);
    color: var(--label-secondary);
    margin-bottom: var(--space-20);
    line-height: 1.4;
}

.delete-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.cancel-btn {
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--system-blue);
    font-size: var(--font-body);
    font-weight: 600;
    cursor: pointer;
}

.cancel-btn:active {
    background: rgba(60, 60, 67, 0.12);
}

.confirm-delete-btn {
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--system-red);
    color: white;
    font-size: var(--font-body);
    font-weight: 600;
    cursor: pointer;
}

.confirm-delete-btn:active {
    opacity: 0.8;
}

/* ============================
   Toast Notification - iOS style
   ============================ */

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    color: white;
    padding: var(--space-12) var(--space-20);
    border-radius: 100px;
    font-size: var(--font-subhead);
    font-weight: 500;
    box-shadow: var(--shadow-elevated);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    z-index: 300;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ============================
   Utilities
   ============================ */

.hidden {
    display: none !important;
}

/* ============================
   Desktop Enhancements
   ============================ */

@media (min-width: 600px) {
    .modal-content {
        border-radius: var(--radius-modal);
        margin: auto;
        max-height: 85vh;
    }

    .delete-modal {
        margin: auto;
    }

    .wine-card:hover {
        background: rgba(60, 60, 67, 0.03);
    }

    .fab:hover {
        transform: scale(1.05);
    }
}

/* ============================
   Safe Area (iOS)
   ============================ */

@supports (padding: max(0px)) {
    .header {
        padding-top: env(safe-area-inset-top);
    }

    .filter-bar {
        top: calc(44px + env(safe-area-inset-top));
    }

    .fab {
        bottom: max(var(--space-24), calc(env(safe-area-inset-bottom) + var(--space-16)));
    }

    .main-content {
        padding-bottom: max(100px, calc(env(safe-area-inset-bottom) + 100px));
    }
}

/* ============================
   Archive Modal Styles
   ============================ */

.archive-modal {
    max-height: 85vh;
}

.archive-wine-name {
    font-size: var(--font-title3);
    font-weight: 600;
    color: var(--wine-primary);
    text-align: center;
    margin-bottom: var(--space-24);
    padding: var(--space-12);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.archive-section {
    margin-bottom: var(--space-24);
}

.archive-section label {
    display: block;
    font-size: var(--font-subhead);
    font-weight: 500;
    color: var(--label-primary);
    margin-bottom: var(--space-12);
    text-align: center;
}

/* Star Rating - 5 Stars */
.star-rating {
    display: flex;
    justify-content: center;
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}

.star-rating .star {
    font-size: 2.5rem;
    color: var(--separator-opaque);
    cursor: pointer;
    transition: color 0.15s, transform 0.15s;
    line-height: 1;
}

.star-rating .star:active {
    transform: scale(1.2);
}

.star-rating .star.active {
    color: #FFD700;
}

.star-rating .star.hover {
    color: #FFD700;
    opacity: 0.7;
}

.rating-label {
    display: block;
    text-align: center;
    font-size: var(--font-footnote);
    color: var(--label-tertiary);
}

/* Rebuy Options */
.rebuy-options {
    display: flex;
    gap: var(--space-12);
    justify-content: center;
}

.rebuy-btn {
    flex: 1;
    max-width: 100px;
    padding: var(--space-16) var(--space-12);
    border: 2px solid var(--separator-opaque);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-8);
    transition: border-color 0.2s, background 0.2s;
}

.rebuy-btn .rebuy-icon {
    font-size: 1.5rem;
}

.rebuy-btn span:last-child {
    font-size: var(--font-caption1);
    font-weight: 500;
    color: var(--label-secondary);
}

.rebuy-btn:active {
    background: var(--bg-tertiary);
}

.rebuy-btn.active {
    border-color: var(--wine-primary);
    background: rgba(114, 47, 55, 0.08);
}

.rebuy-btn.active span:last-child {
    color: var(--wine-primary);
    font-weight: 600;
}

.archive-section textarea {
    width: 100%;
    min-height: 60px;
    padding: var(--space-12);
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-md);
    font-size: var(--font-body);
    font-family: var(--font-system);
    resize: vertical;
}

.archive-section textarea:focus {
    outline: none;
    border-color: var(--wine-primary);
}

/* Archive Actions */
.archive-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
    margin-top: var(--space-8);
}

.skip-archive-btn {
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--label-secondary);
    font-size: var(--font-body);
    cursor: pointer;
}

.skip-archive-btn:active {
    background: rgba(60, 60, 67, 0.12);
}

.confirm-archive-btn {
    height: 50px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--wine-primary);
    color: white;
    font-size: var(--font-body);
    font-weight: 600;
    cursor: pointer;
}

.confirm-archive-btn:active {
    opacity: 0.8;
}

/* ============================
   Year Input Modal
   ============================ */

.year-modal {
    max-height: 320px;
}

.year-modal .modal-body p {
    margin-bottom: var(--space-12);
    color: var(--label-secondary);
    font-size: var(--font-body);
    line-height: 1.4;
}

.year-modal .modal-body input[type="number"] {
    width: 100%;
    height: 44px;
    padding: 0 var(--space-12);
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-md);
    font-size: var(--font-body);
    font-family: var(--font-system);
    color: var(--label-primary);
    background: var(--bg-secondary);
    -webkit-appearance: none;
}

.year-modal .modal-body input[type="number"]:focus {
    outline: none;
    border-color: var(--wine-primary);
}

.year-modal-buttons {
    display: flex;
    gap: var(--space-12);
    margin-top: var(--space-16);
}

.year-modal-buttons button {
    flex: 1;
}

.year-modal-buttons .btn-secondary {
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--label-secondary);
    font-size: var(--font-body);
    cursor: pointer;
}

.year-modal-buttons .btn-secondary:active {
    background: rgba(60, 60, 67, 0.12);
}

.year-modal-buttons .btn-primary {
    height: 44px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--wine-primary);
    color: white;
    font-size: var(--font-body);
    font-weight: 600;
    cursor: pointer;
}

.year-modal-buttons .btn-primary:active {
    opacity: 0.8;
}

/* ============================
   Archive List Modal Styles
   ============================ */

.archive-list-modal {
    max-height: 90vh;
}

.archive-search-container {
    margin-bottom: var(--space-12);
}

.archive-filters {
    display: flex;
    gap: var(--space-8);
    margin-bottom: var(--space-12);
}

.archive-filter-select {
    flex: 1;
    height: 36px;
    padding: 0 var(--space-12);
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-md);
    font-size: var(--font-subhead);
    font-family: var(--font-system);
    color: var(--label-primary);
    background: var(--bg-secondary);
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%233C3C43' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.archive-filter-select:focus {
    outline: none;
    border-color: var(--wine-primary);
}

.archive-stats {
    padding: var(--space-8) 0;
    font-size: var(--font-footnote);
    color: var(--label-secondary);
    border-bottom: 0.5px solid var(--separator);
    margin-bottom: var(--space-12);
}

/* Archive Empty State */
.archive-empty-state {
    text-align: center;
    padding: var(--space-44) var(--space-24);
}

.archive-empty-state.hidden {
    display: none;
}

.archive-empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--space-16);
}

.archive-empty-state p {
    font-size: var(--font-body);
    font-weight: 600;
    color: var(--label-primary);
    margin-bottom: var(--space-8);
}

.archive-empty-hint {
    font-size: var(--font-footnote);
    color: var(--label-tertiary);
}

/* Archive List */
.archive-list {
    display: flex;
    flex-direction: column;
}

.archive-card {
    padding: var(--space-12) 0;
    display: flex;
    gap: var(--space-12);
    cursor: pointer;
    position: relative;
    align-items: center;
    border-bottom: 0.5px solid var(--separator);
}

.archive-card:last-child {
    border-bottom: none;
}

.archive-card:active {
    background: rgba(60, 60, 67, 0.06);
    margin: 0 calc(-1 * var(--space-16));
    padding: var(--space-12) var(--space-16);
}

.archive-card-image {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.archive-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--bg-tertiary);
}

.archive-card-image .placeholder-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.archive-card-info {
    flex: 1;
    min-width: 0;
}

.archive-card-name {
    font-size: var(--font-subhead);
    font-weight: 600;
    color: var(--label-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.archive-card-producer {
    font-size: var(--font-footnote);
    color: var(--wine-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.archive-card-meta {
    display: flex;
    align-items: center;
    gap: var(--space-8);
}

.archive-card-stars {
    color: #FFD700;
    font-size: var(--font-caption1);
    letter-spacing: -1px;
}

.archive-card-rebuy {
    font-size: var(--font-caption2);
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(114, 47, 55, 0.1);
    color: var(--wine-primary);
}

.archive-card-rebuy.yes {
    background: rgba(52, 199, 89, 0.15);
    color: var(--system-green);
}

.archive-card-rebuy.maybe {
    background: rgba(255, 149, 0, 0.15);
    color: var(--system-orange);
}

.archive-card-rebuy.no {
    background: rgba(255, 59, 48, 0.1);
    color: var(--system-red);
}

/* Archive Detail Additions */
.archive-rating-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-16);
    padding: var(--space-16);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-20);
}

.rating-stars {
    font-size: 1.5rem;
    color: #FFD700;
    letter-spacing: 2px;
}

.rating-stars .empty {
    color: var(--separator-opaque);
}

.rebuy-badge {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-8) var(--space-12);
    border-radius: 100px;
    font-size: var(--font-footnote);
    font-weight: 600;
}

.rebuy-badge.yes {
    background: rgba(52, 199, 89, 0.15);
    color: var(--system-green);
}

.rebuy-badge.maybe {
    background: rgba(255, 149, 0, 0.15);
    color: var(--system-orange);
}

.rebuy-badge.no {
    background: rgba(255, 59, 48, 0.15);
    color: var(--system-red);
}

.archive-review {
    background: rgba(114, 47, 55, 0.06);
    border-left: 3px solid var(--wine-primary);
}

.archive-date {
    display: block;
    margin-top: var(--space-8);
    font-size: var(--font-caption2);
    color: var(--label-tertiary);
}

/* Restore Button */
.restore-btn {
    background: rgba(52, 199, 89, 0.1);
    border: none;
    color: var(--system-green);
}

.restore-btn:active {
    background: rgba(52, 199, 89, 0.2);
}

/* ============================
   Login Screen
   ============================ */

.login-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-screen.hidden {
    display: none;
}

.login-content {
    text-align: center;
    padding: var(--space-32);
    max-width: 360px;
}

.login-logo {
    width: 240px;
    height: auto;
    margin-bottom: var(--space-24);
}

.login-content h1 {
    font-size: var(--font-title2);
    font-weight: 700;
    color: var(--label-primary);
    margin-bottom: var(--space-12);
    letter-spacing: -0.4px;
}

.login-content p {
    font-size: var(--font-body);
    color: var(--label-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-32);
}

.google-sign-in-btn.large {
    width: 100%;
    height: 56px;
    font-size: var(--font-body);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================
   Email Authentication Form
   ============================ */

.email-auth-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
    margin-bottom: var(--space-12);
}

.email-auth-form .form-group {
    margin: 0;
}

.auth-input {
    width: 100%;
    height: 50px;
    padding: 0 var(--space-16);
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-md);
    font-size: var(--font-body);
    font-family: var(--font-system);
    color: var(--label-primary);
    background: var(--bg-secondary);
    -webkit-appearance: none;
}

.auth-input:focus {
    outline: none;
    border-color: var(--wine-primary);
}

.auth-input::placeholder {
    color: var(--label-tertiary);
}

.email-sign-in-btn {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--wine-primary);
    color: white;
    font-size: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.email-sign-in-btn:active {
    opacity: 0.8;
}

.toggle-auth-btn {
    width: 100%;
    padding: var(--space-8);
    border: none;
    background: transparent;
    color: var(--label-secondary);
    font-size: var(--font-subhead);
    cursor: pointer;
}

.toggle-auth-btn span {
    color: var(--wine-primary);
    font-weight: 600;
}

.forgot-password-btn {
    width: 100%;
    padding: var(--space-4);
    border: none;
    background: transparent;
    color: var(--label-tertiary);
    font-size: var(--font-footnote);
    cursor: pointer;
    margin-bottom: var(--space-8);
}

.forgot-password-btn:hover {
    color: var(--wine-primary);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: var(--space-16) 0;
    width: 100%;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--separator-opaque);
}

.auth-divider span {
    padding: 0 var(--space-16);
    color: var(--label-tertiary);
    font-size: var(--font-footnote);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================
   Swipe-to-Delete / Swipe-to-Archive
   iOS-style swipe gestures
   ============================ */

.swipe-container {
    position: relative;
    overflow: hidden;
    background: var(--bg-secondary);
}

/* Separator line moves to container (not card) so it doesn't swipe */
.swipe-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 94px;
    right: 0;
    height: 0.5px;
    background: var(--separator);
    z-index: 5;
}

.swipe-container:last-child::after {
    display: none;
}

/* Remove separator from cards when inside swipe container */
.swipe-container .wine-card::after,
.swipe-container .archive-card::after {
    display: none;
}

/* The swipeable content (the card itself) */
.swipe-content {
    position: relative;
    z-index: 2;
    background: var(--bg-secondary);
    will-change: transform;
    touch-action: pan-y;
}

.swipe-content.swipe-transitioning {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Action button behind the card */
.swipe-action {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--font-subhead);
    font-weight: 600;
    z-index: 1;
}

.swipe-action--archive {
    background: var(--wine-primary);
}

.swipe-action--delete {
    background: var(--system-red);
}

.swipe-action-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
}

.swipe-action-content svg {
    width: 22px;
    height: 22px;
}

.swipe-action-content span {
    font-size: var(--font-caption1);
}

/* Collapse animation when item is deleted/archived */
.swipe-collapsing {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 0;
}

/* Prevent text selection during swipe */
.swipe-container.swiping {
    user-select: none;
    -webkit-user-select: none;
}

/* Adjust wine card when inside swipe container - remove disclosure indicator */
.swipe-container .wine-card::before {
    display: none;
}

/* Archive card in swipe container */
.swipe-container .archive-card {
    padding: var(--space-12) var(--space-16);
    border-bottom: none;
}

.swipe-container .archive-card:active {
    margin: 0;
    padding: var(--space-12) var(--space-16);
}

/* ============================
   Sort Bar
   ============================ */

/* Old sort-bar styles removed - now using filter-bar */

/* ============================
   Drink Window Form
   ============================ */

.drink-window-row {
    display: flex;
    align-items: center;
    gap: var(--space-8);
}

.drink-window-row input {
    flex: 1;
    height: 44px;
    padding: 0 var(--space-12);
    border: 1px solid var(--separator-opaque);
    border-radius: var(--radius-md);
    font-size: var(--font-body);
    font-family: var(--font-system);
    color: var(--label-primary);
    background: var(--bg-secondary);
    -webkit-appearance: none;
    text-align: center;
}

.drink-window-row input:focus {
    outline: none;
    border-color: var(--wine-primary);
}

.drink-window-separator {
    color: var(--label-tertiary);
    font-size: var(--font-body);
}

/* ============================
   Drink Window Display (Wine Card)
   ============================ */

.wine-card-footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-8);
    margin-top: var(--space-4);
}

.wine-quantity-badge {
    font-size: var(--font-caption2);
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(114, 47, 55, 0.12);
    color: var(--wine-primary);
    display: inline-flex;
    align-items: center;
}

.wine-price-tag {
    font-size: var(--font-caption2);
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 122, 255, 0.12);
    color: var(--system-blue);
}

.wine-drink-status {
    font-size: var(--font-caption2);
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.wine-drink-status.status-perfect {
    background: rgba(52, 199, 89, 0.15);
    color: var(--system-green);
}

.wine-drink-status.status-soon {
    background: rgba(255, 149, 0, 0.15);
    color: var(--system-orange);
}

.wine-drink-status.status-early {
    background: rgba(0, 122, 255, 0.12);
    color: var(--system-blue);
}

.wine-drink-status.status-past {
    background: rgba(255, 59, 48, 0.1);
    color: var(--system-red);
}

/* ============================
   Drink Window Display (Detail Modal)
   ============================ */

.detail-drink-window {
    padding: var(--space-16);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-20);
}

.drink-window-header {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}

.drink-window-icon {
    font-size: 1rem;
}

.drink-window-label {
    font-size: var(--font-footnote);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--label-secondary);
}

.drink-window-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-12);
}

.drink-window-years {
    font-size: var(--font-title3);
    font-weight: 600;
    color: var(--label-primary);
}

.drink-status-badge {
    font-size: var(--font-caption1);
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 100px;
}

.drink-status-badge.status-perfect {
    background: rgba(52, 199, 89, 0.15);
    color: var(--system-green);
}

.drink-status-badge.status-soon {
    background: rgba(255, 149, 0, 0.15);
    color: var(--system-orange);
}

.drink-status-badge.status-early {
    background: rgba(0, 122, 255, 0.12);
    color: var(--system-blue);
}

.drink-status-badge.status-past {
    background: rgba(255, 59, 48, 0.1);
    color: var(--system-red);
}

/* Verify Button */
.verify-btn {
    background: var(--bg-tertiary);
    border: none;
    color: var(--label-primary);
}

.verify-btn:active {
    opacity: 0.7;
}

/* Verify Modal */
.verify-modal {
    max-width: 600px;
}

.verify-header {
    padding: var(--space-24) var(--space-24) var(--space-16);
    border-bottom: 1px solid var(--separator);
}

.verify-header h2 {
    margin: 0 0 var(--space-8) 0;
    font-size: var(--font-title2);
    font-weight: 600;
    color: var(--label-primary);
}

.verify-subtitle {
    margin: 0;
    font-size: var(--font-subheadline);
    color: var(--label-secondary);
}

.verify-body {
    padding: var(--space-24);
}

.verify-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-16);
}

.verify-label {
    display: block;
    font-size: var(--font-footnote);
    font-weight: 600;
    color: var(--label-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: var(--space-8);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-12);
}

.verify-analyze-btn {
    margin-top: var(--space-8);
    width: 100%;
    background: var(--wine-primary);
    border: none;
    color: white;
}

.verify-analyze-btn:active {
    opacity: 0.8;
}

/* Verify Loading */
.verify-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-48) var(--space-24);
    text-align: center;
}

.verify-loading p {
    margin-top: var(--space-20);
    font-size: var(--font-body);
    color: var(--label-secondary);
}

/* Verify Results */
.verify-results {
    animation: slideUp 0.3s ease-out;
}

.verify-results h3 {
    margin: 0 0 var(--space-20) 0;
    font-size: var(--font-title3);
    font-weight: 600;
    color: var(--wine-primary);
}

.verify-results-content {
    background: var(--fill-quaternary);
    border-radius: var(--radius-12);
    padding: var(--space-16);
    margin-bottom: var(--space-24);
}

.verify-result-photo {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-16);
    padding-bottom: var(--space-16);
    border-bottom: 1px solid var(--separator);
}

.verify-result-photo img {
    max-width: 200px;
    max-height: 300px;
    border-radius: var(--radius-12);
    object-fit: contain;
    background: white;
}

.verify-result-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--space-12) 0;
    border-bottom: 1px solid var(--separator);
}

.verify-result-item:last-child {
    border-bottom: none;
}

.verify-result-label {
    font-size: var(--font-footnote);
    font-weight: 600;
    color: var(--label-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
    width: 100px;
}

.verify-result-value {
    font-size: var(--font-body);
    color: var(--label-primary);
    font-weight: 500;
    text-align: right;
    flex: 1;
}

.verify-result-notes {
    flex-direction: column;
    align-items: flex-start;
}

.verify-result-notes .verify-result-label {
    margin-bottom: var(--space-8);
}

.verify-result-notes .verify-result-value {
    text-align: left;
    line-height: 1.5;
}

.verify-results-actions {
    display: flex;
    gap: var(--space-12);
}

.verify-results-actions .btn {
    flex: 1;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .detail-actions {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .verify-result-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .verify-result-label {
        margin-bottom: var(--space-4);
    }

    .verify-result-value {
        text-align: left;
    }
}
