/* ── Toadee Web App Styles ── */

:root {
    --primary: #5B8C3E;
    --primary-dark: #4A7232;
    --primary-light: #6FA04A;
    --bg: #f5f5f5;
    --surface: #ffffff;
    --text: #222222;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #e0e0e0;
    --danger: #d32f2f;
    --header-bg: #1a1a1a;
    --header-text: #ffffff;
    --nav-bg: #ffffff;
    --nav-border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

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

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Auth Pages ── */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 32px 24px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .logo-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.auth-logo h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.auth-logo .tagline {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-links {
    margin-top: 20px;
    text-align: center;
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

/* ── Form Elements ── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    min-height: 48px;
    text-decoration: none;
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

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

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 12px 22px;
}

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

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    min-height: 36px;
}

.btn-full {
    width: 100%;
}

.btn-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ── Error / Messages ── */
.error-msg {
    background: #fde8e8;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* ── App Shell ── */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--header-bg);
    color: var(--header-text);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.app-header .header-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-light);
    flex: 1;
}

.app-header .header-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--header-text);
    font-size: 20px;
    cursor: pointer;
    margin-right: 8px;
    border-radius: 50%;
}

.app-header .header-back:active {
    background: rgba(255,255,255,0.1);
}

.app-content {
    padding-top: 56px;
    padding-bottom: 72px;
    min-height: 100vh;
    max-width: 480px;
    margin: 0 auto;
}

.app-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--nav-bg);
    border-top: 1px solid var(--nav-border);
    display: flex;
    align-items: stretch;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    position: relative;
    transition: color 0.2s;
}

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

.nav-item .nav-icon {
    font-size: 22px;
    line-height: 1;
}

.nav-item .nav-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 20px);
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ── Views ── */
.view {
    display: none;
    padding: 16px;
}

.view.active {
    display: block;
}

/* ── Cards ── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: transform 0.15s;
}

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

.card-static {
    cursor: default;
}

.card-static:active {
    transform: none;
}

.card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.card p {
    font-size: 14px;
    color: var(--text-secondary);
}

.card .card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Venue Card ── */
.venue-card {
    display: flex;
    gap: 12px;
    align-items: center;
}

.venue-card .venue-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.venue-card .venue-info {
    flex: 1;
    min-width: 0;
}

.venue-card .venue-info h3 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.venue-card .venue-checkins {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
}

/* ── Menu ── */
.menu-categories {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 0 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.menu-categories::-webkit-scrollbar {
    display: none;
}

.category-tab {
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    color: var(--text);
}

.category-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.menu-item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.menu-item-info {
    flex: 1;
    min-width: 0;
}

.menu-item-info h3 {
    font-size: 15px;
}

.menu-item-info .menu-item-desc {
    font-size: 13px;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.menu-item-info .menu-item-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 4px;
}

.menu-item-add {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.menu-item-add:active {
    background: var(--primary-dark);
}

.menu-item-unavailable {
    opacity: 0.5;
}

.menu-item-unavailable .menu-item-add {
    display: none;
}

/* ── Modifier Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal {
    background: var(--surface);
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow-y: auto;
    padding: 24px 16px;
    animation: slideUp 0.3s ease-out;
}

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

.modal h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.modal .modal-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.modifier-group {
    margin-bottom: 20px;
}

.modifier-group h4 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modifier-group h4 .required-badge {
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.modifier-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.modifier-option:last-child {
    border-bottom: none;
}

.modifier-option input[type="checkbox"],
.modifier-option input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.modifier-option .modifier-name {
    flex: 1;
    font-size: 15px;
}

.modifier-option .modifier-price {
    font-size: 14px;
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

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

/* ── Cart ── */
.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-info h4 {
    font-size: 15px;
    font-weight: 600;
}

.cart-item-info .cart-item-mods {
    font-size: 13px;
    color: var(--text-muted);
}

.cart-item-info .cart-item-price {
    font-size: 14px;
    color: var(--primary);
    font-weight: 600;
    margin-top: 2px;
}

.cart-qty-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--surface);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
}

.cart-qty-btn:active {
    background: var(--border);
}

.cart-qty-btn.remove {
    border-color: var(--danger);
    color: var(--danger);
}

.cart-qty {
    font-size: 16px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

.cart-summary {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 16px;
    box-shadow: var(--shadow);
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    padding: 4px 0;
}

.cart-summary-row.total {
    font-size: 18px;
    font-weight: 700;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 4px;
}

.cart-notes {
    width: 100%;
    padding: 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    margin-top: 12px;
}

.cart-notes:focus {
    outline: none;
    border-color: var(--primary);
}

.cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.cart-empty .cart-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ── Tab View ── */
.tab-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-status-badge.open {
    background: #e8f5e9;
    color: var(--primary);
}

.tab-status-badge.closed {
    background: #e0e0e0;
    color: var(--text-secondary);
}

.tab-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.tab-item-row:last-child {
    border-bottom: none;
}

.tab-item-qty {
    color: var(--text-muted);
    font-size: 13px;
}

/* ── Tip View ── */
.tip-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.tip-btn {
    padding: 16px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.tip-btn:active,
.tip-btn.selected {
    border-color: var(--primary);
    background: #e8f5e9;
}

.tip-btn .tip-pct {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.tip-btn .tip-amt {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.tip-custom {
    margin-bottom: 16px;
}

.tip-custom input {
    width: 100%;
    padding: 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 20px;
    text-align: center;
    font-family: inherit;
}

.tip-custom input:focus {
    outline: none;
    border-color: var(--primary);
}

.tip-total {
    text-align: center;
    margin: 20px 0;
}

.tip-total .tip-total-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.tip-total .tip-total-amount {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
}

/* ── Profile View ── */
.profile-card {
    text-align: center;
    padding: 32px 16px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    margin: 0 auto 12px;
}

.profile-name {
    font-size: 20px;
    font-weight: 700;
}

.profile-email {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ── Payment Methods ── */
.payment-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    margin-bottom: 8px;
}

.payment-card.default {
    border-color: var(--primary);
}

.payment-card .card-brand {
    font-size: 24px;
}

.payment-card .card-info {
    flex: 1;
}

.payment-card .card-info .card-number {
    font-weight: 600;
    font-size: 15px;
}

.payment-card .card-info .card-expiry {
    font-size: 13px;
    color: var(--text-muted);
}

.payment-card .card-default-badge {
    font-size: 11px;
    background: var(--primary);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.payment-card .card-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

/* ── Check-in View ── */
.checkin-header {
    text-align: center;
    padding: 24px 16px;
}

.checkin-header h2 {
    font-size: 22px;
    margin-bottom: 4px;
}

.checkin-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.table-select {
    margin: 16px 0;
}

.table-select label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: block;
}

.table-select input {
    width: 100%;
    padding: 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    text-align: center;
    font-family: inherit;
}

.table-select input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ── Section headers ── */
.section-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 16px 0 8px;
}

/* ── Empty States ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 15px;
}

/* ── Loading ── */
.loading-spinner {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--header-bg);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    z-index: 300;
    opacity: 0;
    transition: all 0.3s;
    white-space: nowrap;
    max-width: calc(100% - 40px);
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    background: var(--primary);
}

.toast-error {
    background: var(--danger);
}

/* ── Venue Detail ── */
.venue-detail-header {
    padding: 24px 16px;
    text-align: center;
    background: var(--surface);
    margin: -16px -16px 16px;
    box-shadow: var(--shadow);
}

.venue-detail-header h2 {
    font-size: 22px;
    margin-bottom: 4px;
}

.venue-detail-header .venue-address {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 4px;
}

.venue-detail-header .venue-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: #e8f5e9;
    color: var(--primary);
    text-transform: capitalize;
}

/* ── Utility ── */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 13px; }

/* ── Responsive (desktop centering) ── */
@media (min-width: 481px) {
    .app-bottom-nav {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
        border-left: 1px solid var(--nav-border);
        border-right: 1px solid var(--nav-border);
    }
    .app-header {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
    }
}
