* {
box-sizing: border-box;
font-family: system-ui, -apple-system, sans-serif;
-webkit-tap-highlight-color: transparent; /* This kills the blue flash! */
}

body {
    background-color: #f8f9fa;
    margin: 0;
    padding: 20px;
    color: #333;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

#searchInput {
width: 100%;
max-width: 500px;
padding: 12px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 8px;
}

/* Responsive Grid */
.wine-grid {
    display: grid;
    /* This makes it responsive! It fits as many 250px columns as possible */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.wine-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.wine-card:hover {
    transform: translateY(-5px);
}

.wine-card h3 {
    margin-top: 0;
    color: #5c0f2b;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fefefe;
    /* Changed from 10% to 4vh to keep it higher up on the screen */
    margin: 4vh auto;
    padding: 20px 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    position: relative;

    /* Move the scroll logic here so BOTH modals are perfectly constrained */
    max-height: 85vh;
    overflow-y: auto;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover {
    color: #000;
}

.pitch {
    font-style: italic;
    color: #555;
    white-space: pre-line; /* Respects the \n in your JSON */
}

/* Prevents the body from scrolling when the modal is active */
body.no-scroll {
    overflow: hidden;
}

/* Mobile Scroll Animations */
@media (max-width: 768px) {
    /* NEW: Add empty space at the bottom so the last card can reach the middle */
    main {
        padding-bottom: 50vh;
    }

    .wine-card {
        transform: scale(0.85);
        filter: blur(4px);
        opacity: 0.5;
        transition: transform 0.4s ease-out, filter 0.4s ease-out, opacity 0.4s ease-out;
    }

    .wine-card.in-focus {
        transform: scale(1);
        filter: blur(0);
        opacity: 1;
    }
}

/* Category Subheaders */
.category-header {
    margin-top: 40px;
    margin-bottom: 20px;
    color: #5c0f2b;
    border-bottom: 2px solid #ccc;
    padding-bottom: 10px;
    font-size: 24px;
}

/* --- Login & Button Styles --- */
.view-container {
    width: 100%;
}

.login-box {
    background: white;
    max-width: 400px;
    margin: 10vh auto;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
}

.login-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.primary-btn, .secondary-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-btn {
    background-color: #5c0f2b;
    color: white;
}

.primary-btn:hover { background-color: #4a0c22; }

.secondary-btn {
    background-color: #e9ecef;
    color: #333;
}

.secondary-btn:hover { background-color: #dee2e6; }

.error-msg {
    color: red;
    font-size: 14px;
    display: none;
}

/* --- Edit Feature Styles --- */
.wine-card {
    position: relative; /* Needed to place the edit icon correctly */
}

.edit-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f1f1f1;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: background 0.2s;
}

.edit-icon:hover {
    background: #ddd;
}

.edit-input {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* --- Image Placeholders & Layouts --- */

/* Dashboard Card Images */
.card-img-container {
    height: 160px;
    background-color: #e9ecef;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-wine-img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain; /* Keeps the whole bottle visible without stretching */
}

/* Modal Layout */
.modal-body-layout {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    margin-top: 15px;
}

.modal-main-img-container {
    flex: 0 0 120px; /* Fixed width for the bottle column */
    height: 180px;
    background-color: #e9ecef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-wine-img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.modal-text-content {
    flex: 1; /* Takes up the remaining space */
}

/* Glass Icon inside the View Modal */
.glass-line {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 5px;
    background-color: #f8f9fa; /* Slight background to make the glass pop */
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.glass-icon-container {
    display: flex;
    width: 60px; /* Increased size to make it clearly visible at a glance */
    height: 60px;
    background-color: transparent;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.glass-img {
    height: 100%; /* Scale to fit the container perfectly */
    object-fit: contain;
    /* Added subtle shadow to make the clear glass lines visible */
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.15));
}

/* Stack the bottle on top of the text on very small phone screens */
@media (max-width: 500px) {
    .modal-body-layout {
        flex-direction: column;
        align-items: center;
    }
    .modal-main-img-container {
        width: 100%;
        max-width: 200px;
    }
}

.glass-icon-container {
    display: flex;
    width: 65px;
    height: 65px;
    background-color: #e3f2fd; /* A very light blue that matches the photo background */
    border-radius: 12px;       /* Rounds the corners for a modern look */
    padding: 5px;
    border: 2px solid #bbdefb; /* A slightly darker blue border */
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Lightbox Styles */
.lightbox {
    display: none;
    position: fixed;
    z-index: 3000; /* Higher than normal modals */
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

#lightboxImg {
max-width: 90%;
max-height: 80%;
border-radius: 10px;
box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
object-fit: contain;
}

.close-lightbox {
    position: absolute;
    top: 20px; right: 35px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

/* Make the images in the pop-up look clickable */
#modalWineImg, #modalGlassImg {
cursor: zoom-in;
transition: transform 0.2s;
}

#modalWineImg:hover, #modalGlassImg:hover {
transform: scale(1.02);
}
