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

:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --success-color: #28a745;
    --success-hover: #1e7e34;
    --secondary-color: #6c757d;
    --secondary-hover: #5a6268;
    --background-color: #f0f2f5;
    --card-background: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #888888;
    --border-color: #e0e0e0;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.12);
    --border-radius: 12px;
    --transition: all 0.2s ease;
}

body.dark-mode {
    --primary-color: #0a84ff;
    --primary-hover: #0071e3;
    --success-color: #2ea043;
    --success-hover: #3fb950;
    --secondary-color: #90a4ae;
    --secondary-hover: #b0bec5;
    --background-color: #121212;
    --card-background: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-muted: #9e9e9e;
    --border-color: #424242;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.6);
}

body.dark-mode .form-container input,
body.dark-mode .form-container select {
    background-color: #2c2c2c;
    border-color: #616161;
    color: var(--text-primary);
}

body.dark-mode .form-container select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e0e0e0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

body.dark-mode .form-container input:focus,
body.dark-mode .form-container select:focus {
    background-color: #383838;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--background-color);
    padding: 20px;
    line-height: 1.5;
}

/* Form Container */
.form-container {
    background: var(--card-background);
    padding: 32px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    text-align: center;
    width: 100%;
    max-width: 420px;
    transition: var(--transition);
    position: relative;
    z-index: 1;
}

.form-container h2 {
    margin-bottom: 24px;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
}

.form-container input,
.form-container select {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    color: var(--text-primary);
    background-color: var(--card-background);
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.form-container select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    cursor: pointer;
}

.form-container input:focus,
.form-container select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

/* Buttons */
.form-container button {
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin: 6px;
    transition: var(--transition);
    min-height: 48px;
    min-width: 120px;
}

.btn-next {
    background-color: var(--success-color);
    color: white;
    width: 100%;
}

.btn-next:hover,
.btn-next:active {
    background-color: var(--success-hover);
    transform: translateY(-1px);
}

.btn-back {
    background-color: var(--secondary-color);
    color: white;
}

.btn-back:hover,
.btn-back:active {
    background-color: var(--secondary-hover);
}

.btn-finish {
    background-color: var(--primary-color);
    color: white;
}

.btn-finish:hover,
.btn-finish:active {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-refresh {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-refresh:hover,
.btn-refresh:active {
    background-color: var(--primary-hover);
}

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

/* Settings Button */
.settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--card-background);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    font-size: 20px;
    border-radius: 50%;
    cursor: pointer;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    z-index: 200;
}

.settings-btn:hover {
    background: var(--border-color);
}

.dark-mode-btn {
    position: absolute;
    top: 20px;
    right: 80px;
    background: var(--card-background);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    font-size: 20px;
    border-radius: 50%;
    cursor: pointer;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    z-index: 200;
}

.dark-mode-btn:hover {
    background: var(--border-color);
}

/* Navigation Link */
.nav-link {
    position: absolute;
    top: 20px;
    right: 140px;
    background: var(--card-background);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    font-size: 20px;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    z-index: 200;
    text-decoration: none;
}

.nav-link:hover {
    background: var(--border-color);
    transform: scale(1.05);
}

/* Selection Info */
.selection-info {
    position: absolute;
    top: 16px;
    left: 16px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    background-color: var(--primary-color);
    color: white;
    border-radius: 8px;
    box-shadow: var(--shadow-light);
    z-index: 100;
    max-width: calc(100% - 140px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Order Card Styles */
.order-card {
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    padding: 20px;
    margin: 16px 0;
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 12px 16px;
    text-align: left;
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
}

.order-card:hover {
    box-shadow: var(--shadow-medium);
}

.order-card label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    align-self: center;
}

.order-card span {
    color: var(--text-primary);
    font-size: 15px;
    word-break: break-word;
    align-self: center;
}

.order-card a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.order-card a:hover,
.order-card a:active {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Directions link styling */
.order-card .directions-container {
    grid-column: 1 / -1;
    text-align: center;
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: center;
}

.order-card .directions-container a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--success-color);
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.order-card .directions-container a:hover,
.order-card .directions-container a:active {
    background-color: var(--success-hover);
    text-decoration: none;
    transform: translateY(-1px);
}

.order-card .directions-container .completed-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #dc2626;
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.order-card .directions-container .completed-btn:hover {
    background-color: #b91c1c;
    transform: translateY(-1px);
}

.order-card .directions-container .completed-btn:active {
    transform: translateY(0);
}

/* Map screenshot styling */
.order-card .map-container {
    grid-column: 1 / -1;
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
}

.order-card .map-container .map-loading {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-color);
    color: var(--text-secondary);
    font-size: 1rem;
}

.order-card .map-container img {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
    object-fit: contain;
}

#orders-container {
    width: 100%;
}

/* Orders Section */
#ordersSection {
    max-width: 600px;
    width: 100%;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Tablets and smaller */
@media (max-width: 768px) {
    body {
        padding: 16px;
        padding-top: 80px;
    }

    .form-container {
        padding: 24px;
        max-width: 100%;
    }

    .form-container h2 {
        font-size: 1.35rem;
    }

    .order-card {
        grid-template-columns: 100px 1fr;
        gap: 10px 12px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    body {
        padding: 12px;
        padding-top: 120px;
        justify-content: flex-start;
    }

    .form-container {
        padding: 20px;
        border-radius: 10px;
    }

    .form-container h2 {
        font-size: 1.2rem;
        margin-bottom: 20px;
    }

    .form-container input,
    .form-container select {
        padding: 12px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .form-container button {
        padding: 12px 20px;
        font-size: 15px;
        min-width: 100px;
    }

    .btn-next {
        margin-bottom: 8px;
    }

    /* Stack buttons vertically on small screens */
    #step2 .btn-back,
    #step2 .btn-finish {
        width: calc(50% - 8px);
    }

    /* Order Cards - Stack layout */
    .order-card {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 16px;
        margin: 12px 0;
    }

    .order-card label {
        font-size: 11px;
        margin-top: 12px;
        margin-bottom: 2px;
    }

    .order-card label:first-child {
        margin-top: 0;
    }

    .order-card span {
        font-size: 16px;
        font-weight: 500;
    }

    .order-card .directions-container {
        margin-top: 12px;
        padding-top: 16px;
    }

    .order-card .directions-container a {
        width: 100%;
        padding: 14px 24px;
    }

    /* Header elements */
    .selection-info {
        left: 12px;
        right: 12px;
        top: 12px;
        font-size: 13px;
        padding: 10px 14px;
        max-width: calc(100% - 24px);
        text-align: center;
        margin-top: 60px; /* Make space for buttons */
    }

    .settings-btn {
        top: 12px;
        right: 12px;
        width: 45px;
        height: 45px;
        left: auto;
        font-size: 20px;
        padding: 8px;
    }

    .dark-mode-btn {
        top: 12px;
        right: 70px;
        width: 45px;
        height: 45px;
        font-size: 20px;
        padding: 8px;
    }

    .nav-link {
        top: 12px;
        right: 128px;
        width: 45px;
        height: 45px;
        font-size: 20px;
        padding: 8px;
    }

    .btn-refresh {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* Extra small phones */
@media (max-width: 360px) {
    body {
        padding: 8px;
        padding-top: 115px;
    }

    .form-container {
        padding: 16px;
    }

    .form-container h2 {
        font-size: 1.1rem;
    }

    #step2 .btn-back,
    #step2 .btn-finish {
        width: 100%;
        margin: 4px 0;
    }
}

/* Safe area support for notched phones */
@supports (padding: max(0px)) {
    body {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* Improved touch targets for mobile */
@media (hover: none) and (pointer: coarse) {
    .form-container button {
        min-height: 52px;
    }

    .order-card a {
        padding: 4px 0;
        display: inline-block;
    }
}

/* No Orders Message */
.no-orders-message {
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    padding: 40px 20px;
    margin: 16px 0;
    text-align: center;
    border-left: 4px solid var(--success-color);
}

.no-orders-message p {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.no-orders-message .no-orders-subtext {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 400;
    margin-bottom: 0;
}

/* Product Totals */
.product-totals {
    grid-column: 1 / -1;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.product-totals label {
    display: block;
    margin-bottom: 8px;
}

.product-totals-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.product-total-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--background-color);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.product-total-item i {
    font-size: 16px;
    color: var(--primary-color);
}

.product-total-item:hover {
    background-color: var(--border-color);
}

/* Product icon colors - unique color for each type */
.product-icon-str {
    background-color: #fef3c7;
    border-color: #f59e0b;
}
.product-icon-str i {
    color: #d97706;
}

.product-icon-vel {
    background-color: #ffedd5;
    border-color: #ea580c;
}
.product-icon-vel i {
    color: #c2410c;
}

.product-icon-burger {
    background-color: #fce7f3;
    border-color: #db2777;
}
.product-icon-burger i {
    color: #be185d;
}

.product-icon-boxes {
    background-color: #dbeafe;
    border-color: #3b82f6;
}
.product-icon-boxes i {
    color: #1d4ed8;
}

.product-icon-dip {
    background-color: #f3e8ff;
    border-color: #a855f7;
}
.product-icon-dip i {
    color: #7c3aed;
}

.product-icon-drink {
    background-color: #d1fae5;
    border-color: #10b981;
}
.product-icon-drink i {
    color: #059669;
}

.product-icon-wine {
    background-color: #fee2e2;
    border-color: #ef4444;
}
.product-icon-wine i {
    color: #dc2626;
}

/* Dark mode adjustments for product icons */
body.dark-mode .product-icon-str {
    background-color: rgba(245, 158, 11, 0.2);
}
body.dark-mode .product-icon-vel {
    background-color: rgba(234, 88, 12, 0.2);
}
body.dark-mode .product-icon-burger {
    background-color: rgba(219, 39, 119, 0.2);
}
body.dark-mode .product-icon-boxes {
    background-color: rgba(59, 130, 246, 0.2);
}
body.dark-mode .product-icon-dip {
    background-color: rgba(168, 85, 247, 0.2);
}
body.dark-mode .product-icon-drink {
    background-color: rgba(16, 185, 129, 0.2);
}
body.dark-mode .product-icon-wine {
    background-color: rgba(239, 68, 68, 0.2);
}

/* Mobile responsive for product totals */
@media (max-width: 480px) {
    .product-totals-icons {
        gap: 8px;
    }

    .product-total-item {
        padding: 6px 10px;
        font-size: 13px;
    }

    .product-total-item i {
        font-size: 14px;
    }
}
