/* Wine Notes — Modern tasting journal */

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --wine: #722F37;
    --wine-light: #8B3A44;
    --wine-dark: #5A252C;
    --cream: #FAF7F2;
    --cream-dark: #F0EBE3;
    --gold: #C5A55A;
    --gold-light: #D4BA7A;
    --text: #2D2A26;
    --text-secondary: #7A756D;
    --text-light: #A09A90;
    --border: #E8E3DB;
    --white: #FFFFFF;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-full: 100px;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--cream);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-weight: 400;
    line-height: 1.2;
    color: var(--text);
}

h4, h5, h6 {
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
}

a { color: var(--wine); text-decoration: none; }
a:hover { color: var(--wine-light); }

/* ===== Navigation ===== */
.top-nav {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.95);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 1.35rem;
    color: var(--wine);
    letter-spacing: -0.02em;
}

.brand:hover { color: var(--wine-dark); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-link:hover { color: var(--text); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1;
}

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

.btn-primary:hover {
    background: var(--wine-light);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--cream-dark);
    color: var(--text);
}

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

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

.btn-outline:hover {
    border-color: var(--wine);
    color: var(--wine);
}

.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; }

.btn-danger {
    background: transparent;
    border: 1.5px solid #d44;
    color: #d44;
}

.btn-danger:hover { background: #d44; color: white; }

/* ===== Main content ===== */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
    flex: 1;
}

/* ===== Footer ===== */
footer {
    text-align: center;
    padding: 2rem 1.5rem;
    color: var(--text-light);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* ===== Login ===== */
.login-card {
    max-width: 380px;
    margin: 6rem auto;
    background: var(--white);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-card h2 {
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
    color: var(--wine);
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

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

.error {
    color: #d44;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* ===== Form elements ===== */
label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.35rem;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="search"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    background: var(--white);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 1rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--wine);
    box-shadow: 0 0 0 3px rgba(114, 47, 55, 0.1);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237A756D' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.5rem;
}

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

input[type="file"] {
    padding: 0.5rem;
    font-size: 0.85rem;
}

button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 2rem;
    background: var(--wine);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

button[type="submit"]:hover {
    background: var(--wine-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ===== Grid system ===== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0 1.25rem;
}

fieldset {
    border: none;
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

legend {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--wine);
    margin-bottom: 1rem;
    padding: 0;
}

.form-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.section-title {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--wine);
    margin-bottom: 1rem;
}

/* ===== Stats bar ===== */
.stats-bar {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.stats-bar span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stats-bar strong {
    color: var(--text);
}

/* ===== Search bar ===== */
.search-bar {
    margin-bottom: 1rem;
}

.search-bar .grid {
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
}

.search-bar label {
    margin-bottom: 0;
}

.search-bar input,
.search-bar select {
    margin-bottom: 0;
}

.search-bar .btn {
    height: 42px;
    margin-bottom: 0;
}

/* ===== Sort controls ===== */
.sort-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.sort-controls small {
    color: var(--text-light);
}

.sort-controls a {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-full);
    transition: all 0.15s;
}

.sort-controls a:hover {
    background: var(--cream-dark);
    color: var(--text);
}

.sort-controls a strong {
    color: var(--wine);
}

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

.wine-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--shadow-sm);
}

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

.wine-card-photo {
    height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cream-dark);
}

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

.wine-card-photo.placeholder {
    background: linear-gradient(135deg, var(--wine) 0%, var(--wine-dark) 100%);
}

.wine-emoji {
    font-size: 3.5rem;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.2));
}

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

.wine-card-body h4 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-weight: 400;
    font-size: 1.05rem;
    margin-bottom: 0.2rem;
    line-height: 1.3;
}

.wine-card-body > small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.wine-card-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.6rem 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
    align-items: center;
}

/* ===== Tags ===== */
.tag {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.tag-red { background: var(--wine); color: var(--white); }
.tag-white { background: #F5E6CC; color: #6B5B3E; }
.tag-rosé { background: #F2D0DC; color: #8B3A5C; }
.tag-orange { background: #F0C8A0; color: #7A4A1A; }
.tag-sparkling { background: var(--gold-light); color: #4A3F20; }
.tag-dessert-fortified { background: #8B6914; color: var(--white); }

/* ===== Stars ===== */
.stars {
    color: var(--gold);
    font-size: 0.95rem;
    letter-spacing: 2px;
}

.stars.large {
    font-size: 1.3rem;
    letter-spacing: 3px;
}

/* ===== Quality badge ===== */
.quality-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: var(--cream-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    margin-top: 0.35rem;
}

/* ===== Empty state ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

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

.empty-state p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* ===== Wine detail page ===== */
.wine-detail-header {
    display: flex;
    gap: 2.5rem;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.wine-detail-header h2 {
    font-size: 2rem;
    margin: 0.25rem 0 0.15rem;
    color: var(--wine-dark);
}

.wine-detail-header > div > p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.wine-detail-header > div > a {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.wine-detail-photo {
    max-width: 280px;
    flex-shrink: 0;
}

.wine-detail-photo img {
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.wine-meta-row {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
    margin: 0.6rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== Tasting grid ===== */
.tasting-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.tasting-grid article {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    margin: 0;
}

.tasting-grid article header {
    font-family: 'DM Serif Display', Georgia, serif;
    color: var(--wine);
    font-size: 1rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.tasting-grid dl { margin: 0; }

.tasting-grid dt {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.6rem;
}

.tasting-grid dt:first-child { margin-top: 0; }

.tasting-grid dd {
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
    color: var(--text);
}

/* Detail extras card */
.wine-detail .extras-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

/* Reuse for standalone articles in detail view */
main > .wine-detail > article {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

main > .wine-detail > article dl { margin: 0; }
main > .wine-detail > article dt {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.6rem;
}
main > .wine-detail > article dt:first-child { margin-top: 0; }
main > .wine-detail > article dd {
    margin: 0;
    font-size: 0.9rem;
}

/* ===== Form layout ===== */
.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.danger-zone {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e8c0c0;
}

.danger-zone summary {
    color: #d44;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ===== Flavour input row ===== */
.flavour-input-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.flavour-label { flex: 1; }

.aroma-btn {
    margin-top: 1.5rem;
    white-space: nowrap;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    background: var(--cream-dark);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--wine);
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s;
}

.aroma-btn:hover {
    background: var(--wine);
    color: var(--white);
    border-color: var(--wine);
}

/* ===== Aroma helper dialog ===== */
#aroma-dialog {
    max-width: 680px;
    width: 90vw;
    max-height: 80vh;
    border-radius: var(--radius);
    border: none;
    padding: 0;
    box-shadow: var(--shadow-lg);
}

#aroma-dialog::backdrop {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.aroma-helper {
    margin: 0;
    overflow-y: auto;
    max-height: 80vh;
    padding: 2rem;
    background: var(--white);
    border-radius: var(--radius);
}

.aroma-helper header {
    position: sticky;
    top: -2rem;
    background: var(--white);
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0 1rem;
    margin: -0.5rem 0 1rem;
    border-bottom: 1px solid var(--border);
}

.aroma-helper header h3 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 1.3rem;
    margin: 0;
    flex: 1;
    color: var(--wine);
}

.aroma-helper header small {
    color: var(--text-light);
    font-size: 0.8rem;
}

.aroma-helper header .close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    order: 2;
    color: var(--text-light);
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.aroma-helper header .close:hover {
    background: var(--cream-dark);
    color: var(--text);
}

.aroma-clusters {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.aroma-cluster {
    padding: 1rem;
    background: var(--cream);
    border-radius: var(--radius-sm);
}

.aroma-cluster h4 {
    margin: 0 0 0.6rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--wine);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.aroma-subgroup {
    margin-bottom: 0.6rem;
}

.aroma-subgroup h5 {
    margin: 0 0 0.3rem;
    font-size: 0.7rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.aroma-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.aroma-tag {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    font-weight: 500;
    color: var(--text);
}

.aroma-tag:hover {
    background: var(--wine);
    border-color: var(--wine);
    color: var(--white);
    transform: scale(1.05);
}

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

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

    .wine-detail-header {
        flex-direction: column-reverse;
    }

    .wine-detail-photo {
        max-width: 100%;
    }

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

    .search-bar .grid {
        grid-template-columns: 1fr;
    }

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

    .flavour-input-row {
        flex-direction: column;
    }

    .aroma-btn {
        margin-top: 0;
        align-self: flex-start;
    }

    .stats-bar {
        gap: 1rem;
    }
}

/* ===== Date Range Row ===== */
.date-range-row {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
}

.date-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.date-label input[type="date"] {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
}

/* ===== External Ratings ===== */
.external-ratings {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.external-ratings header {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.ratings-row {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.rating-badge {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.25rem;
    min-width: 160px;
}

.rating-source {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.rating-score {
    font-size: 1rem;
    font-weight: 600;
    color: var(--wine);
}

.rating-link {
    font-size: 0.8rem;
    color: var(--gold);
    text-decoration: none;
}

.rating-link:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .date-range-row {
        grid-template-columns: 1fr;
    }

    .ratings-row {
        flex-direction: column;
    }

    .rating-badge {
        min-width: unset;
    }
}
