/* ===== Variables ===== */
:root {
    --bg: #FDF5E6;
    --card-bg: #FFFFFF;
    --text: #4A3B32;
    --text-muted: #8B7355;
    --green: #4CAF50;
    --green-light: #E8F5E9;
    --gray: #9E9E9E;
    --gray-light: #F0F0F0;
    --amber: #FF9800;
    --amber-light: #FFF3E0;
    --red: #E53935;
    --red-light: #FFEBEE;
    --primary: #A0845C;
    --primary-light: #F5DEB3;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
    --heading-font: 'Playfair Display', serif;
    --body-font: 'Lato', sans-serif;
    --burgundy: #8B1A2B;
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--body-font);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

/* ===== Navigation Bar ===== */
.navbar {
    position: sticky;
    top: 0;
    width: 100%;
    height: 64px;
    background: #FFFFFF;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    display: flex;
    align-items: center;
}

.nav-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.nav-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--burgundy);
}

.nav-logo-text {
    font-family: var(--heading-font);
    font-size: 1.2rem;
    font-weight: 700;
    color: #000000;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link-subtle {
    font-family: var(--body-font);
    font-size: 0.8rem;
    color: #8B7355;
    text-decoration: none;
}

/* ===== PIN Gate ===== */
.pin-gate {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background-image: url('https://images.unsplash.com/photo-1696178465329-da0df96e208f');
    background-size: cover;
    background-position: center;
}

.pin-gate-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.pin-container {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px 32px;
    background: #FFFFFF;
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 360px;
}

.pin-container h1 {
    font-family: var(--heading-font);
    font-size: 1.6rem;
    margin-bottom: 8px;
    color: var(--text);
}

.pin-container p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.pin-container input {
    display: block;
    width: 100%;
    font-size: 2rem;
    text-align: center;
    letter-spacing: 12px;
    padding: 14px;
    border: 2px solid #E0E0E0;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--text);
    font-family: var(--body-font);
}

.pin-container input:focus {
    border-color: var(--burgundy);
    box-shadow: 0 0 0 3px rgba(139, 26, 43, 0.15);
}

.pin-container .btn-primary {
    width: 100%;
    background: var(--burgundy);
    color: #FFFFFF;
    font-size: 1rem;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--body-font);
    font-weight: 600;
    transition: background 0.15s, transform 0.1s;
    min-height: 48px;
}

.pin-container .btn-primary:hover {
    background: #6B1422;
}

.pin-container .btn-primary:active {
    transform: scale(0.97);
}

.pin-error {
    color: var(--red);
    font-size: 0.9rem;
    margin-top: 12px;
}

/* ===== Dashboard Layout ===== */
.dashboard {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px;
}

.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.dash-header h1 {
    font-family: var(--heading-font);
    font-size: 1.5rem;
}

/* ===== Sections ===== */
.section {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.section-title {
    font-family: var(--heading-font);
    font-size: 1.2rem;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #EDE0D4;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--body-font);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    min-height: 44px;
}

.btn:active {
    transform: scale(0.97);
}

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

.btn-primary:active {
    background: #8A6F48;
}

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

.btn-outline:active {
    background: var(--primary-light);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
    min-height: 36px;
}

.btn-block {
    width: 100%;
    margin-top: 16px;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-danger {
    background: var(--red);
    color: #FFF;
}

.btn-danger:active {
    background: #C62828;
}

/* ===== Inputs ===== */
.input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #DDD;
    border-radius: var(--radius-sm);
    font-family: var(--body-font);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    min-height: 44px;
}

.input:focus {
    border-color: var(--primary);
}

.textarea {
    resize: vertical;
    min-height: 80px;
}

.input-file {
    padding: 8px 0;
    border: none;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text);
}

/* ===== Settings Form ===== */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-form .btn {
    align-self: flex-start;
}

/* ===== Tag Grid (Ingredients) ===== */
.tag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.tag-grid-sm {
    gap: 8px;
    margin-bottom: 0;
}

/* ===== Ingredient Tag Button ===== */
.ingredient-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 24px;
    border: 2px solid transparent;
    font-family: var(--body-font);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    min-height: 44px;
    user-select: none;
}

.ingredient-btn:active {
    transform: scale(0.96);
}

.ingredient-btn.available {
    background: var(--green-light);
    border-color: var(--green);
    color: #2E7D32;
}

.ingredient-btn.unavailable {
    background: var(--gray-light);
    border-color: #CCC;
    color: var(--gray);
}

.ingredient-btn .delete-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0,0,0,0.12);
    color: #555;
    font-size: 0.75rem;
    line-height: 1;
    margin-left: 2px;
    flex-shrink: 0;
}

.ingredient-btn .delete-x:active {
    background: var(--red);
    color: #FFF;
}

/* Small tag for form ingredient picker */
.ingredient-pick {
    padding: 6px 12px;
    border-radius: 20px;
    border: 2px solid #DDD;
    background: #FFF;
    font-size: 0.85rem;
    cursor: pointer;
    min-height: 36px;
    user-select: none;
    transition: background 0.15s, border-color 0.15s;
}

.ingredient-pick.selected {
    background: var(--green-light);
    border-color: var(--green);
    color: #2E7D32;
}

.ingredient-pick:active {
    transform: scale(0.96);
}

/* ===== Add Row ===== */
.add-row {
    display: flex;
    gap: 8px;
}

.add-row .input {
    flex: 1;
}

.add-row .btn {
    flex-shrink: 0;
}

/* ===== Cocktail Filters ===== */
.cocktail-filters {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

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

.toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    user-select: none;
    color: var(--text);
    white-space: nowrap;
}

.toggle-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.cocktail-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* ===== Cocktail Cards (Bartender) ===== */
.cocktails-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.cocktail-card {
    display: flex;
    flex-direction: column;
    padding: 16px;
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.cocktail-card:active {
    transform: scale(0.99);
}

.cocktail-card.on-menu {
    background: var(--green-light);
    border-color: var(--green);
}

.cocktail-card.off-menu {
    background: var(--gray-light);
    border-color: #CCC;
}

.cocktail-card.missing-ingredients {
    background: var(--amber-light);
    border-color: var(--amber);
}

/* ===== Drag Handle ===== */
.drag-handle {
    cursor: grab;
    font-size: 1.2rem;
    color: var(--text-muted);
    padding: 4px 6px;
    flex-shrink: 0;
    line-height: 1;
    user-select: none;
    touch-action: none;
    transition: color 0.15s;
}

.drag-handle:active {
    cursor: grabbing;
    color: var(--primary);
}

/* SortableJS states */
.sortable-ghost {
    opacity: 0.3;
}

.sortable-chosen {
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    z-index: 10;
}

.sortable-drag {
    opacity: 0.9;
}

.cocktail-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.cocktail-card-name {
    font-weight: 700;
    font-size: 1.05rem;
    flex: 1;
    min-width: 0;
}

.cocktail-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.cocktail-card-actions .btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
    min-height: 32px;
}

.cocktail-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.cocktail-card-tags .mini-tag {
    font-size: 0.78rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(0,0,0,0.06);
    color: #555;
}

.cocktail-card-tags .mini-tag.missing {
    background: var(--red-light);
    color: var(--red);
}

.cocktail-card .status-label {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cocktail-card.on-menu .status-label { color: var(--green); }
.cocktail-card.off-menu .status-label { color: var(--gray); }
.cocktail-card.missing-ingredients .status-label { color: var(--amber); }

/* ===== Modal ===== */
[hidden] {
    display: none !important;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 900;
    padding: 0;
}

.modal {
    background: var(--card-bg);
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #EDE0D4;
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 1;
}

.modal-header h2 {
    font-family: var(--heading-font);
    font-size: 1.2rem;
}

.modal-body {
    padding: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.modal-actions .btn {
    flex: 1;
}

/* ===== Image Preview ===== */
.image-preview-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid #EDE0D4;
    background: #f9f6f0;
}

.image-preview-thumb {
    display: block;
    width: 100%;
    max-width: 240px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.image-remove-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #FFF;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.image-remove-btn:active {
    background: var(--red);
}

.image-placeholder {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border: 2px dashed #D5C9B6;
    border-radius: var(--radius-sm);
    background: #faf7f1;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.image-placeholder .placeholder-icon {
    font-size: 1.3rem;
}

/* ===== Cropper ===== */
.crop-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 8px 0 4px;
    font-style: italic;
}

.cropper-wrapper {
    margin-top: 8px;
    max-height: 300px;
    background: #f9f6f0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid #EDE0D4;
}

.cropper-wrapper img {
    display: block;
    max-width: 100%;
}

/* ===== Tablet+ ===== */
@media (min-width: 768px) {
    .dashboard {
        padding: 24px;
    }

    .dash-header h1 {
        font-size: 1.8rem;
    }

    .section {
        padding: 28px;
    }

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

    .modal-overlay {
        align-items: center;
        padding: 24px;
    }

    .modal {
        border-radius: 12px;
        max-height: 85vh;
    }
}

/* ===== Mobile ===== */
@media (max-width: 767px) {
    .nav-logo-text {
        font-size: 1rem;
    }

    .nav-links {
        gap: 12px;
    }
}
