/* Variables & Reset */
:root {
    --primary-color: #2E4F2F;
    /* Forest green */
    --secondary-color: #666666;
    /* Medium gray */
    --accent-color: #1a1a1a;
    /* Deep charcoal accent */
    --bg-color: #FFFFFF;
    /* Pure white */
    --text-color: #1a1a1a;
    --light-text: #666666;
    --white: #FFFFFF;
    --surface: #FFFFFF;
    --border-color: #E5E5E5;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.12);

    --transition: all 0.2s ease;

    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-logo: 'Aref Ruqaa', serif;
}

[data-theme='dark'] {
    --bg-color: #0f1110;
    --text-color: #e2f1e5;
    --light-text: #a8d7b0;
    --surface: #1a1d1a;
    --border-color: #2a2d2a;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 15px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent horizontal scroll */
    overflow-x: hidden;
    width: 100%;
    /* Space for sticky cart + Safe Area */
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    color: var(--primary-color);
    font-weight: 600;
    letter-spacing: -0.02em;
}

[data-theme='dark'] h1,
[data-theme='dark'] h2,
[data-theme='dark'] h3 {
    color: #e0f8e4;
}

/* Utilities */
.container {
    max-width: 800px;
    /* Narrower for menu readability */
    margin: 0 auto;
    padding: 0 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    font-family: var(--font-body);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

/* Navbar */
/* Navbar */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
    /* Reduced from 16px */
    padding-top: max(10px, env(safe-area-inset-top));
}

.app-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.nav-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
}

.logo-text {
    font-family: var(--font-logo);
    font-size: 1.4rem;
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: normal;
}

[data-theme='dark'] .logo-text {
    color: #e0f8e4;
}

/* Hero */
.hero {
    text-align: center;
    padding: 32px 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.hero h1 {
    font-size: 1.75rem;
    margin-bottom: 6px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.hero p {
    color: var(--light-text);
    font-size: 0.95rem;
}



/* Menu List */
.menu-category {
    margin-bottom: 40px;
}

.category-title {
    font-size: 1.8rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--secondary-color);
}

.menu-grid {
    display: grid;
    gap: 24px;
}

.menu-item {
    display: flex;
    gap: 20px;
    /* More breathing room */
    background: var(--surface);
    padding: 20px;
    /* Generous padding */
    border-radius: 20px;
    /* Softer corners */
    box-shadow: var(--shadow);
    align-items: center;
    border: 1px solid rgba(0, 0, 0, 0.03);
    /* Subtle definition */
}

.item-thumb {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    object-fit: cover;
    background: #eee;
}

.item-details {
    flex: 1;
}

.item-name {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.item-desc {
    font-size: 0.9rem;
    color: var(--light-text);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.item-price {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1rem;
}

[data-theme='dark'] .item-price {
    color: #a8d7b0;
}

.add-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
    touch-action: manipulation;
}

.add-btn:active {
    transform: scale(0.9);
    background: var(--secondary-color);
}

/* Mobile Inputs */
input,
select,
textarea,
button {
    font-size: 16px !important;
    font-family: inherit;
    /* Prevent zoom */
}

/* Sticky Bottom Cart */
.floating-cart {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom));
    /* Safe area respect */
    left: 20px;
    right: 20px;
    margin: 0 auto;
    max-width: 500px;
    background: var(--primary-color);
    color: white;
    padding: 16px 24px;
    border-radius: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 25px rgba(46, 79, 47, 0.4);
    z-index: 500;
    text-decoration: none;
    transform: translateY(150%);
    /* Hidden by default */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-cart.visible {
    transform: translateY(0);
}

/* Admin / Status Styles */
.item-thumb.sold-out {
    filter: grayscale(100%);
    opacity: 0.6;
}

.thumb-container {
    position: relative;
    width: 100px;
    height: 100px;
}

.item-thumb {
    width: 100%;
    height: 100%;
}

.badge-sold-out {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 4px;
    white-space: nowrap;
}

.add-btn.sold-out {
    background: #ccc;
    cursor: not-allowed;
    width: auto;
    padding: 0 12px;
    font-size: 0.9rem;
    border-radius: 12px;
}

.add-btn.sold-out:active {
    transform: none;
}

.admin-note {
    display: inline-block;
    background: #FFF4E5;
    color: #B45309;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-weight: 500;
}

.cart-count {
    background: white;
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    margin-left: 8px;
}

.cart-total {
    font-weight: 600;
}

/* ===== BREAKFAST SETS STYLES ===== */

/* Breakfast Set Card */
.breakfast-set-card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.breakfast-set-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--accent-color);
}

.breakfast-set-header {
    display: flex;
    gap: 20px;
    padding: 24px;
    cursor: pointer;
    align-items: center;
    transition: var(--transition);
}

.breakfast-set-header:hover {
    background: #FAFAFA;
}

.breakfast-set-image {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    object-fit: cover;
    background: #F5F5F5;
    border: 1px solid var(--border-color);
}

.breakfast-set-info {
    flex: 1;
}

.breakfast-set-title {
    font-size: 1.5rem;
    margin-bottom: 6px;
    color: var(--primary-color);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.breakfast-set-description {
    color: var(--light-text);
    font-size: 0.95rem;
    margin-bottom: 10px;
    line-height: 1.5;
}

.breakfast-set-price {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

.expand-icon {
    font-size: 1.5rem;
    color: var(--secondary-color);
    transition: transform 0.3s ease;
}

.breakfast-set-card.expanded .expand-icon {
    transform: rotate(180deg);
}

/* Breakfast Set Content (Expandable) */
body {
    width: 100%;
    overflow-x: hidden;
}

.breakfast-set-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.breakfast-set-card.expanded .breakfast-set-content {
    max-height: 3500px;
}

.breakfast-set-body {
    padding: 0 24px 24px 24px;
    border-top: 1px solid var(--border-color);
}

/* Included Items Section */
.included-items-section {
    margin-bottom: 24px;
    margin-top: 20px;
}

.section-title {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
}

.included-items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.included-item {
    background: #FAFAFA;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.included-item:hover {
    background: #F5F5F5;
    border-color: var(--accent-color);
}

.included-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.included-item-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.info-icon {
    color: var(--secondary-color);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.info-icon:hover {
    background: #E5E5E5;
    color: var(--accent-color);
}

/* Choice Options (Radio buttons styled) */
.choice-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.choice-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    background: white;
}

.choice-option:hover {
    background: #F5F5F5;
}

.choice-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.choice-option-label {
    flex: 1;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 400;
}

/* Checkbox for included items */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.checkbox-wrapper:hover {
    background: #F5F5F5;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.checkbox-label {
    flex: 1;
    cursor: pointer;
    font-weight: 400;
}

/* Add-ons Section */
.addons-section {
    margin-bottom: 24px;
}

.addons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.addon-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 12px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.addon-item:hover {
    border-color: var(--accent-color);
    background: #FAFAFA;
}

.addon-item.selected {
    border-color: var(--accent-color);
    background: #F5F9F5;
    border-width: 2px;
}

.addon-checkbox {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    accent-color: var(--accent-color);
}

.addon-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: var(--text-color);
}

.addon-price {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.85rem;
}

.addon-info-icon {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 1.2rem;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    z-index: 10;
}

.addon-info-icon:hover {
    background: #E5E5E5;
    color: var(--primary-color);
}

.addon-qty-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    justify-content: center;
}

.addon-qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
    padding: 0;
}

.addon-qty-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.addon-qty-display {
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 20px;
    text-align: center;
    color: var(--primary-color);
}

/* Add to Cart Button for Sets */
.add-set-to-cart-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.add-set-to-cart-btn:hover {
    background: #000000;
}

.add-set-to-cart-btn:active {
    transform: scale(0.98);
}

/* Item Detail Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.item-detail-modal {
    background: var(--surface);
    border-radius: 12px;
    padding: 28px;
    max-width: 500px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    transform: scale(0.95);
    transition: transform 0.3s ease;
    border: 1px solid var(--border-color);
}

.modal-overlay.active .item-detail-modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
    padding-right: 16px;
}

.modal-close {
    background: #F5F5F5;
    border: none;
    font-size: 1.5rem;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 6px;
    line-height: 1;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.modal-close:hover {
    background: #E5E5E5;
    color: var(--primary-color);
}

.modal-description {
    color: var(--text-color);
    margin-bottom: 20px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.modal-info-grid {
    display: grid;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #FAFAFA;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.info-label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.info-value {
    color: var(--light-text);
    font-size: 0.9rem;
}

/* Allergen Badges */
.allergen-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.allergen-badge {
    background: #FEE2E2;
    color: #991B1B;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid #FCA5A5;
}

.calorie-info {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.95rem;
}

/* Customization Summary in Cart */
.customization-summary {
    background: rgba(46, 79, 47, 0.04);
    padding: 12px;
    border-radius: 8px;
    margin-top: 8px;
    font-size: 0.9rem;
}

.customization-summary-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.customization-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.customization-list li {
    padding: 4px 0;
    color: var(--text-color);
}

.customization-list li::before {
    content: "• ";
    color: var(--primary-color);
    font-weight: bold;
    margin-right: 6px;
}

.removed-item {
    text-decoration: line-through;
    color: var(--light-text);
}

.addon-item-cart {
    color: var(--primary-color);
    font-weight: 500;
}

/* Edit Button in Cart */
.edit-customization-btn {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 8px;
    transition: var(--transition);
}

.edit-customization-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 0 16px;
    }

    .menu-item {
        padding: 16px;
        gap: 16px;
    }

    .item-details {
        min-width: 0;
        /* Critical for flex text truncation */
    }

    .breakfast-set-header {
        flex-direction: column;
        text-align: center;
    }

    .breakfast-set-image {
        width: 100%;
        height: 180px;
    }

    .addons-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== LOGIN PAGE STYLES ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1a3a1b 100%);
    padding: 20px;
}

.login-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 48px 40px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.login-header p {
    color: var(--light-text);
    font-size: 0.95rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
    /* Standardize vertical spacing */
}

/* Reset margin inside flex containers with gap */
.login-form .form-group,
.dynamic-form .form-group {
    margin-bottom: 0;
}

.form-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 16px;
    background: var(--surface);
    color: var(--text-color);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 79, 47, 0.1);
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #dc2626;
}

.error-message {
    color: #dc2626;
    font-size: 0.85rem;
    display: none;
}

.error-message.show {
    display: block;
}

.btn-login {
    margin-top: 8px;
    padding: 14px 24px;
    font-size: 1rem;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== TOAST NOTIFICATIONS ===== */
#toastContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    background: var(--surface);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.toast.toast-show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left-color: #10b981;
}

.toast-error {
    border-left-color: #ef4444;
}

.toast-warning {
    border-left-color: #f59e0b;
}

.toast-info {
    border-left-color: #3b82f6;
}

.toast-icon {
    font-size: 1.2rem;
    font-weight: bold;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    color: #10b981;
}

.toast-error .toast-icon {
    color: #ef4444;
}

.toast-warning .toast-icon {
    color: #f59e0b;
}

.toast-info .toast-icon {
    color: #3b82f6;
}

.toast-message {
    flex: 1;
    color: var(--text-color);
    font-size: 0.9rem;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
    flex-shrink: 0;
}

.toast-close:hover {
    background: #f5f5f5;
}

/* ===== MAIN APP LAYOUT ===== */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.username-display {
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1;
}

.btn-logout {
    background: transparent;
    color: #dc2626;
    border: 1px solid #dc2626;
    padding: 4px 10px;
    /* Ultra compact */
    font-size: 0.8rem;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s ease;
    line-height: 1;
    /* Tight line height */
    min-height: unset;
    height: auto;
    cursor: pointer;
}

.btn-logout:hover {
    background: #dc2626;
    color: white;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.2);
}

.main-content {
    flex: 1;
    padding: 32px 0;
}

.generator-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 32px;
    align-items: start;
}

.generator-panel {
    background: var(--surface);
    border-radius: 12px;
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.panel-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

/* Tabbed Type Selector */
.type-selector {
    display: flex;
    gap: 32px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
}

.type-btn {
    padding: 12px 16px;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--light-text);
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 1rem;
    margin-bottom: -1px;
}

.type-btn:hover {
    color: var(--primary-color);
    background: rgba(0, 0, 0, 0.02);
}

.type-btn.active {
    background: transparent;
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.qr-type-selector {
    margin-bottom: 20px;
}

.qr-type-selector select {
    width: 100%;
}

.dynamic-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 24px;
    /* Essential spacing before Logo */
    /* Increased from 16px for better breathing room */
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    /* Increased from 16px */
}

.logo-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.logo-upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(46, 79, 47, 0.02);
}

.logo-upload-area.has-logo {
    border-style: solid;
    border-color: var(--primary-color);
}

.logo-preview {
    max-width: 150px;
    max-height: 150px;
    margin: 0 auto 12px;
    display: none;
}

.logo-preview.show {
    display: block;
}

.upload-text {
    color: var(--light-text);
    font-size: 0.9rem;
}

/* Outlined Format Selector */
.format-selector {
    display: flex;
    gap: 12px;
}

.format-option {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--surface);
    color: var(--text-color);
    font-weight: 500;
}

.format-option:hover {
    border-color: var(--primary-color);
    background: rgba(46, 79, 47, 0.05);
}

.format-option.active {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 9px;
    /* Adjust for border width if needed, or rely on box-sizing */
    font-weight: 700;
}

.preview-panel {
    position: sticky;
    top: 90px;
}

.preview-area {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 20px;
    padding: 24px;
}

.preview-placeholder {
    color: var(--light-text);
    text-align: center;
}

#previewCanvas {
    max-width: 100%;
    height: auto;
    display: none;
}

#previewCanvas.show {
    display: block;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Saved Codes Panel */
.history-section {
    margin-top: 32px;
    border-top: 1px solid var(--border-color);
    padding-top: 32px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Saved Item Card */
.saved-item {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.saved-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: var(--primary-color);
}

/* Icon Wrapper */
.saved-icon-wrapper {
    width: 48px;
    height: 48px;
    background: rgba(35, 64, 36, 0.05);
    /* Primary tint */
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    flex-shrink: 0;
}

[data-theme='dark'] .saved-icon-wrapper {
    background: rgba(46, 125, 50, 0.2);
}

/* Details Section */
.saved-details {
    flex: 1;
    min-width: 0;
    /* Enable truncation */
}

.saved-main-text {
    font-weight: 600;
    color: var(--text-color);
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.saved-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--light-text);
}

.meta-badge {
    background: var(--border-color);
    color: var(--text-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.meta-format {
    text-transform: uppercase;
    font-weight: 600;
    margin-left: auto;
    color: var(--secondary-color);
}

/* Actions */
.saved-actions {
    display: flex;
    align-items: center;
}

.delete-btn {
    opacity: 0;
    padding: 8px;
    color: #ef4444;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.saved-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .history-grid {
        grid-template-columns: 1fr;
    }

    .delete-btn {
        opacity: 1;
        /* Always show delete on mobile */
    }
}

/* Color Picker & Form Layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.color-picker-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-picker-input-group input[type="color"] {
    height: 48px;
    width: 60px;
    padding: 0;
    border: none;
    cursor: pointer;
    background: none;
    border-radius: 4px;
}

.hex-input {
    flex: 1;
    width: 0;
    /* Critical for flex shrinking */
    min-width: 0;
    /* Important for flex shrinking */
    /* Important for flex shrinking */
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-transform: uppercase;
    font-family: monospace;
    font-size: 1rem;
    color: var(--text-color);
    background: var(--surface);
}

/* Color Details Toggle */
.color-customization {
    margin-top: 24px;
    margin-bottom: 24px;
    /* Essential spacing */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}

.color-customization+.form-group {
    margin-top: 24px;
}

.color-customization summary {
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}

.color-customization summary:hover {
    background: #f9fafb;
}

.color-customization summary::-webkit-details-marker {
    display: none;
}

.color-customization summary::after {
    content: '▼';
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.color-customization[open] summary::after {
    transform: rotate(180deg);
}

.color-content {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.color-content .form-row {
    margin-bottom: 0;
    /* Remove bottom margin inside toggle */
}

/* Improved Mobile Responsiveness & Aesthetics */

/* Base Button Improvements */
.btn,
.type-btn,
.format-option,
.logo-upload-area {
    min-height: 48px;
    /* Larger touch target */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active,
.type-btn:active,
.format-option:active {
    transform: scale(0.96);
}

/* Header Adjustments */
@media (max-width: 600px) {
    .app-header .container {
        flex-direction: column;
        gap: 12px;
    }

    .user-info {
        width: 100%;
        justify-content: space-between;
        padding-top: 8px;
        border-top: 1px solid var(--border-color);
    }
}

/* Mobile Layout Refinements */
@media (max-width: 1024px) {
    .generator-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .preview-panel {
        order: -1;
        /* Show preview on top on mobile/tablet? Or keep bottom? bottom is standard form flow */
        /* keeping default order (bottom) as context is needed first */
        position: static;
    }
}

/* Small Mobile Adjustments */
@media (max-width: 600px) {
    .container {
        padding: 0 16px;
    }

    .login-card {
        padding: 32px 20px;
        border-radius: 20px;
    }

    .generator-panel,
    .preview-area {
        padding: 16px;
        /* Reduce padding for mobile alignment */
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
        /* Ensure gap is reasonable */
    }

    /* Fix input sizing on small screens */
    .hex-input {
        padding: 8px;
        /* Reduce padding from 12px */
        font-size: 0.9rem;
        /* Slightly smaller font */
    }

    .color-content {
        padding: 12px;
    }

    .color-picker-input-group input[type="color"] {
        width: 48px;
        /* Slightly smaller picker */
        height: 40px;
    }

    .type-selector {
        flex-direction: row;
        /* Keep side-by-side on mobile if they fit, otherwise stack */
        flex-wrap: wrap;
    }

    .type-btn {
        flex: 1;
        text-align: center;
        white-space: nowrap;
    }

    #toastContainer {
        left: 16px;
        right: 16px;
        bottom: 16px;
        /* Move to bottom on mobile for better visibility */
        top: auto;
        max-width: none;
    }

    /* Make action buttons stick to bottom of screen for better UX? 
       Or just full width and easy to reach */
    .action-buttons {
        gap: 16px;
    }

    #generateBtn {
        width: 100%;
        margin-top: 16px;
        font-size: 1.1rem;
        padding: 16px;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(46, 79, 47, 0.2);
    }

    /* Better spacing for history items */
    .history-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .saved-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .saved-icon-wrapper {
        width: 40px;
        height: 40px;
    }

    .saved-actions {
        width: 100%;
        justify-content: flex-end;
        border-top: 1px solid var(--border-color);
        padding-top: 8px;
        margin-top: 4px;
    }
}

/* Enhanced Visuals */
.btn {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.generator-panel {
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    background: #FFFFFF;
}

/* Refined Inputs */
.form-group input,
.form-group select,
.form-group textarea {
    background-color: #FAFAFA;
    border: 1px solid #E5E7EB;
    /* Subtle gray */
    border-radius: 8px;
    /* Smooth corners */
    padding: 12px;
    font-size: 1rem;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    background-color: #FFFFFF;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 79, 47, 0.12);
    /* Soft ring focus */
    outline: none;
}

/* Fix Preview Canvas Scaling */
#previewCanvas {
    max-width: 100%;
    height: auto !important;
    object-fit: contain;
    border-radius: 8px;
    /* Match UI */
}

/* Premium Generate Button */
#generateBtn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 24px;
    margin-bottom: 8px;
    padding: 16px;

    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.01em;

    background: linear-gradient(135deg, var(--primary-color), #234024);
    /* Subtle gradient */
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(46, 79, 47, 0.25);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#generateBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(46, 79, 47, 0.35);
    filter: brightness(1.05);
}

#generateBtn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(46, 79, 47, 0.2);
}

/* Input Hints & Info Icons */
.input-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--light-text);
    line-height: 1.4;
}

.info-icon {
    display: inline-block;
    margin-left: 6px;
    color: var(--secondary-color);
    cursor: help;
    font-size: 0.9rem;
    vertical-align: middle;
}

/* Form Validation Styles */
.form-group {
    position: relative;
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.error-text {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 4px;
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Label Typography */
.form-label,
label {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 8px;
    display: block;
    font-size: 0.95rem;
}

/* Loading Spinner */
.btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Global Mobile Fixes */
.toast {
    max-width: calc(100vw - 32px) !important;
    white-space: normal !important;
    word-break: break-word;
}

select {
    max-width: 100%;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}