:root {
    /* Premium Dark Palette */
    --bg-dark: #0a0a0a;
    --bg-card: #141414;
    --bg-card-hover: #1f1f1f;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-gold: #FFC000;
    --accent-amber: #FF9900;
    --accent-foam: #F0F0F0;
    --border-color: #2d2d2d;
    --success: #2ecc71;
    --danger: #e74c3c;

    /* Spacing & Layout */
    --nav-height: 64px;
    --header-height: 60px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;

    /* Effects */
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 15px rgba(255, 192, 0, 0.15);
    --glass-bg: rgba(20, 20, 20, 0.85);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
    /* App-like feel */
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1,
h2,
h3 {
    font-family: 'Russo One', sans-serif;
    letter-spacing: 0.5px;
}

/* Structure */
#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
    max-width: 600px;
    /* Tablet/Desktop constraint */
    margin: 0 auto;
    background: var(--bg-dark);
}

/* Header */
.app-header {
    height: var(--header-height);
    padding: 0 var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--accent-gold);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: var(--spacing-sm);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

/* Main Content */
#main-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
    padding-bottom: calc(var(--nav-height) + var(--spacing-lg));
    /* Safe area for inputs */
    scroll-behavior: smooth;
}

/* Beer Grid */
.beer-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

.beer-card {
    background: var(--bg-card);
    border: var(--glass-border);
    border-radius: 16px;
    padding: var(--spacing-md) var(--spacing-sm);
    /* More vertical padding */
    padding-top: 25px;
    /* Specific fix for top cut-off */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    position: relative;
    overflow: hidden;
}

.beer-card:active {
    transform: scale(0.98);
}

.beer-card.drunk {
    border-color: var(--accent-gold);
    background: linear-gradient(145deg, var(--bg-card), #1a1a10);
}

.beer-card .check-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    color: var(--accent-gold);
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.beer-card.drunk .check-icon {
    opacity: 1;
    transform: scale(1);
}

.beer-image {
    width: 80px;
    height: 120px;
    object-fit: contain;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.5));
    transition: transform 0.3s;
}

.beer-card:hover .beer-image {
    transform: translateY(-5px) rotate(2deg);
}

.beer-info {
    text-align: center;
    width: 100%;
}

.beer-title {
    font-family: 'Russo One', sans-serif;
    font-size: 0.95rem;
    margin-bottom: 4px;
    /* Allow wrapping */
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.2;
}

.beer-brewery {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Floating Action Button */
.fab {
    position: absolute;
    bottom: calc(var(--nav-height) + 20px);
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-gold);
    color: #000;
    border: none;
    box-shadow: var(--shadow-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    cursor: pointer;
    transition: transform 0.2s;
}

.fab:active {
    transform: scale(0.9);
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    gap: var(--spacing-md);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 192, 0, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-gold);
    animation: spin 1s ease-in-out infinite;
}

/* Navigation */
.bottom-nav {
    height: var(--nav-height);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-top: var(--glass-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 10;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--accent-gold);
}

/* Utilities */
.hidden {
    display: none !important;
}

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

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    /* Sheet style for mobile */
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

@media (min-width: 600px) {
    .modal-overlay {
        align-items: center;
    }
}

.modal-content {
    background: #1a1a1a;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    padding: var(--spacing-lg);
    overflow-y: auto;
    position: relative;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 600px) {
    .modal-content {
        border-radius: 20px;
        height: auto;
        min-height: 400px;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

    to {
        transform: translateY(0);
    }
}

/* Form Styles */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--accent-gold);
    color: black;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    margin-top: var(--spacing-md);
}

/* Search Bar */
.search-bar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-card);
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    z-index: 9;
    animation: slideDown 0.2s ease-out;
}

.search-bar.hidden {
    display: none;
}

#search-input {
    flex: 1;
    background: var(--bg-dark);
    border: none;
    padding: 10px;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
}

#search-input:focus {
    outline: 2px solid var(--accent-gold);
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}