/**
 * Custom Styles for Ordering System
 * Mobile-first responsive design
 * Unified Premium Theme (Purple)
 */

:root {
    /* Premium Purple Theme */
    --primary-color: #7c3aed;
    --primary-hover: #6d28d9;
    --primary-dark: #5b21b6;
    --primary-light: #ede9fe;
    --active-bg: #faf5ff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    
    /* Standard Colors */
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-bg: #f5f7fb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* === Base Styles === */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-main);
    background-color: var(--light-bg);
    min-height: 100vh;
    padding-bottom: 85px;
}

/* === Top Navigation Bar === */
.top-nav {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.nav-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-main);
}

.nav-info p {
    font-size: 0.75rem;
    margin: 2px 0 0;
    color: var(--text-muted);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rc-badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.exit-btn {
    color: #dc2626;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    transition: all 0.2s;
}

.exit-btn:hover {
    background: #fee2e2;
    border-color: #f87171;
    color: #dc2626;
}

/* === Sticky Header === */
.sticky-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    position: sticky;
    top: 61px;
    z-index: 99;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.header-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.header-title span {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.header-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-badge {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.search-wrapper {
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* === Main Container === */
.main-container {
    max-width: 900px;
    margin: 16px auto;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.category-header {
    background: #f9fafb;
    padding: 12px 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
}

/* === Item Row === */
.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.2s;
}

.item-row.active {
    background: var(--active-bg);
}

.item-info {
    flex: 1;
    padding-right: 12px;
}

.item-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 2px;
}

.item-price {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stepper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stepper-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1.5px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.stepper-btn:hover {
    background: var(--primary-light);
}

.stepper-btn.minus {
    display: none;
}

.item-row.active .stepper-btn.minus {
    display: flex;
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.stepper-qty {
    display: none;
    min-width: 28px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary-color);
}

.item-row.active .stepper-qty {
    display: block;
}

.total-val {
    min-width: 70px;
    text-align: right;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-main);
}

/* === Sticky Footer === */
.sticky-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 14px 20px;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.sticky-footer.visible {
    transform: translateY(0);
}

.footer-total {
    display: flex;
    flex-direction: column;
}

.footer-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.footer-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.footer-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.footer-btn:hover {
    background: var(--primary-hover);
}

/* === Alert Styles === */
.alert {
    border-radius: 0.75rem;
    border: none;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
}

.alert-info {
    background-color: #cff4fc;
    color: #055160;
}

/* === Responsive Adjustments === */
@media (max-width: 768px) {
    .item-row {
        padding: 12px 16px;
    }
    
    .footer-btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }
    
    .footer-price {
        font-size: 1.1rem;
    }
    
    .sticky-header {
        top: 57px;
    }
}

@media (max-width: 480px) {
    .item-row {
        padding: 10px 12px;
    }
    
    .item-name {
        font-size: 0.85rem;
    }
    
    .stepper-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    
    .total-val {
        min-width: 60px;
        font-size: 0.8rem;
    }
    
    .footer-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
    
    .footer-price {
        font-size: 1rem;
    }
}

/* === Form Styles === */
.form-control:focus,
.form-check-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.25);
}

.input-group-text {
    background-color: var(--light-bg);
    border-color: var(--border-color);
}

/* === Animations === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card,
.alert {
    animation: fadeIn 0.3s ease-out;
}

/* === Loading Spinner === */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* === Custom Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

/* === Print Styles === */
@media print {
    .top-nav,
    .sticky-header,
    .sticky-footer,
    .btn {
        display: none !important;
    }

    .card {
        border: none;
        box-shadow: none;
    }

    body {
        background-color: white;
        padding-bottom: 0;
    }
}

/* === Accessibility === */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* === Utility Classes === */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.shadow-custom {
    box-shadow: var(--shadow);
}

.border-custom {
    border: 1px solid var(--border-color);
}