/* Wine Tracker - Main Styles */
:root {
    --primary: #722f37;
    --primary-light: #9c4f59;
    --primary-dark: #4a1f24;
    --secondary: #f5f0e8;
    --accent: #c9a959;
    --text: #2d2d2d;
    --text-light: #666;
    --border: #ddd;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --white: #fff;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --radius: 8px;
    --radius-lg: 12px;
}

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

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

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

/* Header */
header {
    background: var(--primary);
    color: var(--white);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

nav {
    display: flex;
    gap: 24px;
}

nav a {
    color: var(--white);
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.2s;
    font-weight: 500;
}

nav a:hover, nav a.active {
    opacity: 1;
}

/* Main content */
main {
    padding: 32px 0;
    min-height: calc(100vh - 140px);
}

/* Page titles */
h1 {
    font-size: 2rem;
    margin-bottom: 24px;
    color: var(--primary-dark);
}

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

h3 {
    font-size: 1.25rem;
    margin-bottom: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

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

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

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

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

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn-icon {
    padding: 8px;
    border-radius: 50%;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

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

input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

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

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

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

/* Wine Card */
.wine-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

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

.wine-card-image {
    height: 200px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

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

.wine-card-placeholder {
    font-size: 4rem;
    opacity: 0.3;
    color: var(--white);
}

.wine-card-type {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.6);
    color: var(--white);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.wine-card-content {
    padding: 16px;
}

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

.wine-card-winery {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.wine-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.wine-card-vintage {
    color: var(--text-light);
}

.wine-card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
    font-weight: 600;
}

.wine-card-quantity {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: var(--white);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Search */
.search-container {
    margin-bottom: 32px;
}

.search-box {
    display: flex;
    gap: 12px;
    max-width: 600px;
}

.search-box input {
    flex: 1;
}

.search-results {
    margin-top: 24px;
}

/* Filters */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    margin: 0;
    font-size: 0.875rem;
}

.filter-group select {
    width: auto;
    padding: 8px 12px;
}

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

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
}

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

.stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Rating stars */
.rating {
    display: flex;
    gap: 2px;
}

.rating-star {
    color: #ddd;
    font-size: 1.25rem;
}

.rating-star.filled {
    color: var(--accent);
}

.rating-input {
    display: flex;
    gap: 4px;
}

.rating-input label {
    cursor: pointer;
    font-size: 1.5rem;
    color: #ddd;
    transition: color 0.2s;
}

.rating-input input {
    display: none;
}

.rating-input label:hover,
.rating-input label.active {
    color: var(--accent);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Login */
.login-container {
    max-width: 400px;
    margin: 80px auto;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    text-align: center;
}

.login-card h1 {
    color: var(--primary);
    margin-bottom: 8px;
}

.login-card p {
    color: var(--text-light);
    margin-bottom: 32px;
}

.pin-input {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
}

.pin-input input {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1100;
}

.toast {
    background: var(--text);
    color: var(--white);
    padding: 16px 24px;
    border-radius: var(--radius);
    margin-top: 12px;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

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

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    padding: 40px;
}

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

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text);
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    nav {
        gap: 16px;
    }

    nav a {
        font-size: 0.9rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .wine-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

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

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

    .filters {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    header .container {
        flex-direction: column;
        gap: 12px;
    }

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

    .search-box {
        flex-direction: column;
    }
}

/* Priority badges */
.priority-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.priority-1 {
    background: #fee2e2;
    color: #991b1b;
}

.priority-2 {
    background: #fef3c7;
    color: #92400e;
}

.priority-3 {
    background: #e0e7ff;
    color: #3730a3;
}

/* Tasting list */
.tasting-list {
    list-style: none;
}

.tasting-item {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

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

.tasting-date {
    font-weight: 600;
    color: var(--primary);
}

.tasting-notes {
    margin-top: 8px;
    color: var(--text-light);
}

/* Wine detail */
.wine-detail {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 32px;
}

.wine-detail-image {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
    border-radius: var(--radius-lg);
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wine-detail-image img {
    max-height: 380px;
    max-width: 100%;
    object-fit: contain;
}

.wine-detail-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wine-detail-name {
    font-size: 2rem;
    color: var(--primary-dark);
}

.wine-detail-winery {
    font-size: 1.25rem;
    color: var(--text-light);
}

.wine-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.meta-item {
    padding: 12px;
    background: var(--secondary);
    border-radius: var(--radius);
}

.meta-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
}

.meta-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

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

    .wine-detail-image {
        height: 300px;
    }
}

/* Charts container */
.chart-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.chart-container h3 {
    margin-bottom: 16px;
}

/* Quantity controls */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quantity-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: var(--white);
    color: var(--primary);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

.quantity-value {
    font-size: 1.5rem;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}
