/* WineBox - Wine Cellar Management Styles */

:root {
    --primary-color: #8B1A4A;
    --primary-light: #B82860;
    --primary-dark: #5C0A2D;
    --secondary-color: #C49A3C;
    --background-color: #FAF7F2;
    --card-background: #ffffff;
    --text-color: #2c2c2c;
    --text-muted: #666666;
    --border-color: #e0dcd5;
    --success-color: #4a7c59;
    --warning-color: #c9a227;
    --error-color: #a63d40;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-logo {
    height: 32px;
    display: block;
}

nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Main Content */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dashboard Sections */
.dashboard-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-section {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.chart-list {
    max-height: 200px;
    overflow-y: auto;
}

.chart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.chart-item:last-child {
    border-bottom: none;
}

.chart-item .label {
    font-weight: 500;
}

.chart-item .value {
    background: var(--primary-light);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Activity List */
.activity-list {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.activity-icon.check-in {
    background: var(--success-color);
    color: white;
}

.activity-icon.check-out {
    background: var(--warning-color);
    color: white;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
}

.activity-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Forms */
.form-section {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.form-note {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

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

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Email input - separate rule for browser compatibility */
.form-group input[type="email"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 26, 74, 0.1);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

/* Image Upload */
.image-upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.image-upload {
    text-align: center;
}

.image-upload input[type="file"] {
    display: block;
    width: 100%;
    padding: 1rem;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}

.image-upload input[type="file"]:hover {
    border-color: var(--primary-color);
}

.image-preview {
    min-height: 150px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    padding: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

.image-preview:hover {
    border-color: var(--primary-color);
    background-color: rgba(139, 26, 74, 0.05);
}

.image-preview:active {
    background-color: rgba(139, 26, 74, 0.1);
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

/* Buttons */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--card-background);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

.btn-danger:hover {
    background: #8b3235;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--card-background);
}

.filter-bar input {
    flex: 1;
    min-width: 200px;
}

/* Wine Grid */
.wine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.wine-card {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.wine-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.wine-card-image {
    height: 180px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.wine-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.wine-card-content {
    padding: 1.25rem;
}

.wine-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.wine-card-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.wine-card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.wine-tag {
    background: var(--background-color);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.wine-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.wine-quantity {
    font-weight: 600;
    color: var(--primary-color);
}

.wine-quantity.out-of-stock {
    color: var(--text-muted);
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 2rem;
}

.modal-content.modal-small {
    max-width: 400px;
}

.modal-content.modal-large {
    max-width: 900px;
}

/* Checkin Confirmation Modal */
.checkin-confirm-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.checkin-confirm-header h3 {
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.checkin-confirm-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.checkin-confirm-content {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.checkin-confirm-image {
    width: 200px;
    height: 250px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--background-color);
}

.checkin-confirm-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.checkin-confirm-form .form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.checkin-confirm-form .form-group {
    margin-bottom: 0;
}

.checkin-confirm-form .form-group.full-width {
    grid-column: 1 / -1;
}

.checkin-confirm-form label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.checkin-confirm-form input,
.checkin-confirm-form textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
}

.checkin-confirm-form textarea {
    resize: vertical;
}

.checkin-confirm-ocr {
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.checkin-confirm-ocr .collapsible-header {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--background-color);
    border-radius: var(--radius);
}

.checkin-confirm-ocr .collapsible-header:hover {
    background: #f0ede8;
}

.checkin-confirm-ocr .collapsible-content {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.checkin-confirm-ocr .ocr-text-container {
    max-height: 200px;
    overflow-y: auto;
}

.checkin-confirm-ocr pre {
    white-space: pre-wrap;
    font-size: 0.85rem;
    background: var(--background-color);
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .checkin-confirm-content {
        grid-template-columns: 1fr;
    }

    .checkin-confirm-image {
        width: 100%;
        height: 200px;
    }

    .checkin-confirm-form .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-content.modal-large {
        max-width: 100%;
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

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

/* Wine Detail */
#wine-detail {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

@media (max-width: 600px) {
    #wine-detail {
        grid-template-columns: 1fr;
    }
}

.wine-detail-images {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.wine-detail-image {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.wine-detail-image img {
    width: 100%;
    height: auto;
}

.wine-detail-info h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.wine-detail-meta {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.wine-detail-field {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.wine-detail-field .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.wine-detail-field .value {
    font-size: 1rem;
    font-weight: 500;
}

/* Custom fields grid in detail modal */
.wine-detail-custom-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.25rem 1rem;
}

/* Card expand button for extra tags */
.wine-card-extra {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.wine-card-expand-btn {
    font-size: 0.8rem;
    color: var(--primary-color);
    cursor: pointer;
    margin-top: 0.5rem;
}

.wine-card-expand-btn:hover {
    text-decoration: underline;
}

.wine-detail-ocr {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    white-space: pre-wrap;
    max-height: 150px;
    overflow-y: auto;
}

.wine-detail-transactions {
    margin-top: 2rem;
    grid-column: 1 / -1;
}

/* Transaction List */
.transaction-list {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.transaction-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-type {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.transaction-type.check-in {
    background: rgba(74, 124, 89, 0.1);
    color: var(--success-color);
}

.transaction-type.check-out {
    background: rgba(201, 162, 39, 0.1);
    color: var(--warning-color);
}

.transaction-wine {
    font-weight: 500;
}

.transaction-wine .vintage {
    color: var(--text-muted);
    font-weight: normal;
}

.transaction-quantity {
    font-weight: 600;
}

.transaction-date {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--card-background);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    border-left: 4px solid var(--primary-color);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--error-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state h3 {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    nav {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    nav::-webkit-scrollbar {
        display: none;
    }

    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    main {
        padding: 1rem;
    }

    h2 {
        font-size: 1.5rem;
    }

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

    /* Check-in page mobile improvements */
    .form-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .form-section h3 {
        font-size: 1.1rem;
    }

    .image-upload-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .image-upload {
        margin-bottom: 0.5rem;
    }

    .image-upload label {
        font-size: 0.95rem;
        font-weight: 600;
        display: block;
        margin-bottom: 0.5rem;
    }

    .image-upload input[type="file"] {
        padding: 1.25rem 0.75rem;
        font-size: 0.9rem;
        min-height: 60px;
    }

    .image-preview {
        min-height: 120px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .form-group {
        margin-bottom: 0.75rem;
    }

    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.875rem 0.75rem;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .form-note {
        font-size: 0.85rem;
    }

    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1rem;
    }

    .btn {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
        text-align: center;
    }

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

    .transaction-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    /* Modal mobile improvements */
    .modal {
        padding: 0.5rem;
        align-items: flex-end;
    }

    .modal-content {
        padding: 1.25rem;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 95vh;
    }

    .modal-content.modal-small {
        max-width: 100%;
    }

    /* Toast mobile */
    #toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }

    .toast {
        max-width: 100%;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .header-logo {
        height: 28px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .dashboard-sections {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-bar select,
    .filter-bar input {
        width: 100%;
        min-width: unset;
    }
}

/* Login Page */
.login-page {
    display: none;
    min-height: calc(100vh - 80px);
    background: linear-gradient(135deg, var(--background-color) 0%, #f0ebe3 100%);
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-page.active {
    display: flex;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-hover);
    border: 1px solid var(--border-color);
    text-align: center;
}

.login-icon {
    display: block;
    margin: 0 auto 1rem;
}

.login-card h2 {
    font-family: 'Playfair Display', Georgia, serif;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.login-card .form-group {
    text-align: left;
}

/* Password Toggle */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    flex: 1;
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-muted);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--primary-color);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

.login-error {
    background: rgba(166, 61, 64, 0.1);
    color: var(--error-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.login-success {
    background: rgba(74, 124, 89, 0.1);
    color: var(--success-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.login-links {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.login-links a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

.login-links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.link-separator {
    color: var(--text-muted);
    margin: 0 0.75rem;
}

.form-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 1rem auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-full {
    width: 100%;
    margin-top: 0.5rem;
}

/* User Info in Header */
.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

.user-info #username-display {
    font-weight: 500;
}

.user-info .username-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.user-info .username-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.user-info .btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
}

.user-info .btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Settings Page */
.settings-section {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.settings-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Danger Zone */
.danger-zone {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow);
    border: 2px solid var(--error-color);
}

.danger-zone h3 {
    color: var(--error-color);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--error-color);
}

.danger-zone .btn-danger {
    background: var(--error-color);
    color: #fff;
    border: none;
}

.danger-zone .btn-danger:hover {
    opacity: 0.9;
}

#confirm-delete-collection-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#delete-confirm-input:focus {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

/* Hide main content when not logged in */
body.logged-out main {
    display: none;
}

body.logged-out #main-nav {
    display: none;
}

body.logged-out #user-info {
    display: none !important;
}

@media (max-width: 768px) {
    .login-card {
        padding: 1.5rem;
    }

    .login-page {
        padding: 1rem;
        align-items: flex-start;
        padding-top: 2rem;
    }

    .header-content {
        flex-wrap: wrap;
    }

    .user-info {
        width: 100%;
        justify-content: space-between;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

/* Checkin Confirmation Modal */
.checkin-confirm {
    text-align: center;
}

.checkin-confirm-header {
    margin-bottom: 1.5rem;
}

.checkin-confirm-icon {
    width: 60px;
    height: 60px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.checkin-confirm-header h3 {
    color: var(--success-color);
    margin: 0;
}

.checkin-confirm-content {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.5rem;
    text-align: left;
    margin-bottom: 1.5rem;
}

.checkin-confirm-image {
    width: 150px;
    height: 200px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--background-color);
    border: 1px solid var(--border-color);
}

.checkin-confirm-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.checkin-confirm-details h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.checkin-confirm-fields {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.checkin-confirm-field {
    background: var(--background-color);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
}

.checkin-confirm-field .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.checkin-confirm-field .value {
    font-weight: 500;
    color: var(--text-color);
}

.checkin-confirm-field .value.empty {
    color: var(--text-muted);
    font-style: italic;
    font-weight: normal;
}

.checkin-confirm-ocr {
    text-align: left;
    margin-bottom: 1.5rem;
}

.checkin-confirm-ocr h5 {
    color: var(--text-color);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.ocr-text-container {
    background: var(--background-color);
    border-radius: var(--radius);
    padding: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.ocr-section {
    margin-bottom: 1rem;
}

.ocr-section:last-child {
    margin-bottom: 0;
}

.ocr-section strong {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.ocr-section pre {
    font-family: inherit;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    color: var(--text-color);
}

.checkin-confirm .form-actions {
    justify-content: center;
}

@media (max-width: 600px) {
    .checkin-confirm-content {
        grid-template-columns: 1fr;
    }

    .checkin-confirm-image {
        width: 100%;
        height: 150px;
    }

    .checkin-confirm-fields {
        grid-template-columns: 1fr;
    }
}

/* Collapsible Sections */
.collapsible {
    margin-bottom: 1.5rem;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem 0;
    user-select: none;
}

.collapsible-header h3 {
    margin: 0;
    color: var(--text-muted);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.scan-method-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: var(--primary-color);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.collapsible-header:hover h3 {
    color: var(--primary-color);
}

.collapse-icon {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.collapsible.open .collapse-icon {
    transform: rotate(45deg);
}

.collapsible-content {
    padding-top: 1rem;
}

/* Raw OCR Text Display */
.ocr-raw-text {
    background: var(--background-color);
    border-radius: var(--radius);
    padding: 1rem;
}

.ocr-raw-section {
    margin-bottom: 1rem;
}

.ocr-raw-section:last-child {
    margin-bottom: 0;
}

.ocr-raw-section label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.ocr-raw-section pre {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.75rem;
    font-family: monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 150px;
    overflow-y: auto;
    margin: 0;
}

/* Wine Detail Label Text */
.wine-detail-label-text {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.wine-detail-label-text .collapsible-header {
    padding: 0;
}

.wine-detail-label-text .collapsible-header .label {
    font-size: 0.85rem;
    color: var(--primary-color);
    cursor: pointer;
}

.wine-detail-label-text .collapsible-header .label:hover {
    text-decoration: underline;
}

/* Auto-fill Animation */
.auto-filled {
    animation: autoFillPulse 0.5s ease;
    background-color: rgba(74, 124, 89, 0.1) !important;
}

@keyframes autoFillPulse {
    0% {
        background-color: rgba(74, 124, 89, 0.3);
    }
    100% {
        background-color: rgba(74, 124, 89, 0.1);
    }
}

/* Scanning Indicator */
.form-note.scanning {
    color: var(--primary-color);
    font-weight: 500;
}

.form-note.scanning::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

/* Footer */
#app-footer {
    background: var(--primary-dark);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 1rem 2rem;
    font-size: 0.85rem;
    margin-top: 2rem;
}

#app-footer .footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

#app-footer #app-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

#app-footer .footer-separator {
    color: rgba(255, 255, 255, 0.4);
}

#app-footer #data-credits {
    color: rgba(255, 255, 255, 0.6);
}

#app-footer #data-credits a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.2s;
}

#app-footer #data-credits a:hover {
    color: #e8c49a;
    text-decoration: underline;
}

#app-footer .version {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Autocomplete Dropdown */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.autocomplete-dropdown.active {
    display: block;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: var(--background-color);
}

.autocomplete-item-name {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.autocomplete-item-details {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.autocomplete-item-detail {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.autocomplete-item-rating {
    color: var(--warning-color);
    font-weight: 500;
}

.autocomplete-loading {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
}

.autocomplete-no-results {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* X-Wines Search Page */
.page-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: -1rem;
    margin-bottom: 1.5rem;
}

.xwines-results-header {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding-bottom: 0.5rem;
}

/* X-Wines Cards */
.xwines-card {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.xwines-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.xwines-card-header {
    padding: 0.75rem 1.25rem 0;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.xwines-card-content {
    padding: 0.5rem 1.25rem 1rem;
    flex: 1;
}

.xwines-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.xwines-card-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.xwines-card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.xwines-card-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--background-color);
}

/* X-Wines Rating */
.xwines-rating {
    color: var(--warning-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.xwines-rating-count {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.xwines-no-rating {
    color: var(--text-muted);
    font-weight: normal;
    font-style: italic;
}

/* X-Wines Type Tags */
.xwines-type-tag {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.xwines-type-red {
    background: rgba(139, 26, 74, 0.12);
    color: var(--primary-color);
}

.xwines-type-white {
    background: rgba(196, 154, 60, 0.15);
    color: #8a6d1b;
}

.xwines-type-rose {
    background: rgba(219, 112, 147, 0.15);
    color: #c4607e;
}

.xwines-type-sparkling {
    background: rgba(74, 124, 89, 0.12);
    color: var(--success-color);
}

.xwines-type-fortified {
    background: rgba(92, 10, 45, 0.12);
    color: var(--primary-dark);
}

.xwines-type-dessert {
    background: rgba(201, 162, 39, 0.15);
    color: var(--warning-color);
}

/* X-Wines Detail Modal */
.xwines-detail-layout {
    max-width: 700px;
}

.xwines-detail-header {
    margin-bottom: 1rem;
}

.xwines-detail-header h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.xwines-detail-winery {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
}

.xwines-detail-rating {
    margin-bottom: 1.5rem;
}

.xwines-detail-stars {
    color: var(--warning-color);
    font-size: 1.1rem;
    font-weight: 600;
}

.xwines-detail-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.xwines-detail-fields .wine-detail-field .value a {
    color: var(--primary-color);
    text-decoration: none;
    word-break: break-all;
}

.xwines-detail-fields .wine-detail-field .value a:hover {
    text-decoration: underline;
}

/* Export Dropdown */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
}

.export-dropdown-btn .dropdown-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.export-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.export-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 120px;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    z-index: 100;
    display: none;
    margin-top: 4px;
}

.export-dropdown.active .export-dropdown-menu {
    display: block;
}

.export-dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    transition: background-color 0.15s;
    border-bottom: 1px solid var(--border-color);
}

.export-dropdown-menu a:last-child {
    border-bottom: none;
}

.export-dropdown-menu a:hover {
    background-color: var(--background-color);
    color: var(--primary-color);
}

.export-dropdown-menu a:first-child {
    border-radius: var(--radius) var(--radius) 0 0;
}

.export-dropdown-menu a:last-child {
    border-radius: 0 0 var(--radius) var(--radius);
}

/* Mobile adjustments for export dropdown */
@media (max-width: 768px) {
    .export-dropdown {
        flex-shrink: 0;
    }

    .export-dropdown-btn {
        padding: 0.65rem 0.9rem;
        font-size: 0.9rem;
    }

    .export-dropdown-menu {
        min-width: 100px;
    }

    .export-dropdown-menu a {
        padding: 0.65rem 0.85rem;
        font-size: 0.9rem;
    }
}

/* Import Page */
.import-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.import-upload-area:hover,
.import-upload-area.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(139, 26, 74, 0.04);
}

.import-upload-icon {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.import-upload-area p {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.import-step {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.import-mapping-table,
.import-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.import-mapping-table th,
.import-mapping-table td,
.import-preview-table th,
.import-preview-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.import-mapping-table th,
.import-preview-table th {
    background: var(--background-color);
    font-weight: 600;
    white-space: nowrap;
}

.import-sample-cell {
    color: var(--text-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.import-mapping-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.import-mapping-select optgroup {
    font-weight: 700;
    color: var(--primary-color);
    font-style: normal;
}

.import-mapping-select optgroup option {
    font-weight: 400;
    color: var(--text-color);
}

.import-mapping-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.import-mapping-controls .import-mapping-select {
    flex: 1;
}

.import-skip-btn {
    white-space: nowrap;
    background: var(--card-background);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.import-skip-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-color);
}

.import-skip-btn.active {
    background: var(--text-muted);
    color: white;
    border-color: var(--text-muted);
}

.import-mapping-row.skipped .import-column-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

.import-not-mapped {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.15rem;
}

.import-custom-name {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.import-preview-table {
    margin-top: 0.5rem;
}

.import-preview-table td {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Custom Field Rows */
.custom-field-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.custom-field-row .custom-field-name,
.custom-field-row .custom-field-value {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.custom-field-row .custom-field-remove {
    padding: 0.4rem 0.6rem;
    line-height: 1;
    flex-shrink: 0;
}

/* X-Wines Toolbar */
.xwines-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--card-background);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

/* View Toggle */
.view-toggle {
    display: flex;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.view-toggle button {
    padding: 0.5rem 1rem;
    border: none;
    background: var(--card-background);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle button:first-child {
    border-right: 1px solid var(--border-color);
}

.view-toggle button:hover {
    background: var(--background-color);
    color: var(--text-color);
}

.view-toggle button.active {
    background: var(--primary-color);
    color: white;
}

/* X-Wines Table */
.xwines-table-wrapper {
    overflow-x: auto;
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.xwines-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.xwines-table th,
.xwines-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.xwines-table th {
    background: var(--background-color);
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.xwines-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s;
}

.xwines-table tbody tr:hover {
    background-color: var(--background-color);
}

.xwines-table tbody tr:last-child td {
    border-bottom: none;
}

.xwines-table-name {
    font-weight: 500;
    color: var(--primary-color);
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xwines-table-rating {
    color: var(--warning-color);
    font-weight: 500;
}

/* Cellar Wine Table */
.wine-table-wrapper {
    overflow-x: auto;
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.wine-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.wine-table th,
.wine-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.wine-table th {
    background: var(--background-color);
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.wine-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s;
}

.wine-table tbody tr:hover {
    background-color: var(--background-color);
}

.wine-table tbody tr:last-child td {
    border-bottom: none;
}

.wine-table-name {
    font-weight: 500;
    color: var(--primary-color);
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Custom field tags in card view */
.wine-tag-custom {
    background: rgba(139, 26, 74, 0.08);
    color: var(--primary-color);
    font-size: 0.75rem;
}

/* Expandable detail row in table view */
.wine-table-detail-row {
    display: none;
}

.wine-table-detail-row.expanded {
    display: table-row;
}

.wine-table-detail-row td {
    padding: 0 !important;
    border-bottom: 1px solid var(--border-color);
}

.wine-table-detail-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--background-color);
}

.wine-table-detail-field .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
}

.wine-table-detail-field .value {
    font-size: 0.875rem;
    color: var(--text-color);
}

/* Expand chevron in table */
.wine-table-expand {
    cursor: pointer;
    display: inline-block;
    width: 1.2em;
    font-size: 0.7em;
    transition: transform 0.2s;
    opacity: 0.5;
    vertical-align: middle;
}

.wine-table-expand:hover {
    opacity: 0.8;
}

.wine-table-expand.expanded {
    transform: rotate(90deg);
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
}

#xwines-page-info {
    color: var(--text-muted);
    font-size: 0.95rem;
    min-width: 120px;
    text-align: center;
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile adjustments for toolbar and table */
@media (max-width: 768px) {
    .xwines-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .view-toggle {
        width: 100%;
    }

    .view-toggle button {
        flex: 1;
    }

    .xwines-table {
        font-size: 0.85rem;
    }

    .xwines-table th,
    .xwines-table td {
        padding: 0.65rem 0.5rem;
    }

    .xwines-table-name {
        max-width: 150px;
    }

    .wine-table {
        font-size: 0.85rem;
    }

    .wine-table th,
    .wine-table td {
        padding: 0.65rem 0.5rem;
    }

    .wine-table-name {
        max-width: 150px;
    }

    .wine-table-hide-mobile {
        display: none;
    }

    .pagination-controls {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}
