@import url('variables.css');
@import url('sidebar.css');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@500;700;800&display=swap');

/* --- Reset & Base (Cross-Browser) --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
}

*:before,
*:after {
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    padding-bottom: 120px;
}



h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--text-main);
    margin-bottom: 0.8rem;
    font-weight: 700;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
    -webkit-transition: var(--transition-fast);
    -moz-transition: var(--transition-fast);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* --- Layout Utilities --- */
.container {
    width: 100%;
    max-width: 600px;
    /* Reduced from 1200px for mobile-like experience */
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* --- Components: Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.8rem;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition-medium);
    -webkit-transition: all var(--transition-medium);
    -moz-transition: all var(--transition-medium);
    text-align: center;
    letter-spacing: 0.02em;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.btn:active {
    transform: scale(0.96);
    -webkit-transform: scale(0.96);
    -ms-transform: scale(0.96);
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--text-on-primary);
    box-shadow: 0 4px 15px var(--shadow-color);
    -webkit-box-shadow: 0 4px 15px var(--shadow-color);
    -moz-box-shadow: 0 4px 15px var(--shadow-color);
}

.btn-primary:hover {
    box-shadow: 0 8px 25px var(--shadow-color);
    -webkit-box-shadow: 0 8px 25px var(--shadow-color);
    -moz-box-shadow: 0 8px 25px var(--shadow-color);
    transform: translateY(-2px);
    -webkit-transform: translateY(-2px);
    -ms-transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid #eee;
}

.btn-secondary:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: #fff;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

/* --- Components: Cards --- */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-medium);
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

/* --- Components: Forms --- */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 1rem 1.2rem;
    background: #f8f9fa;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    -webkit-border-radius: var(--radius-md);
    -moz-border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-main);
    transition: all var(--transition-fast);
    -webkit-transition: all var(--transition-fast);
    -moz-transition: all var(--transition-fast);

    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-input:focus {
    outline: none;
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(255, 159, 28, 0.1);
    -webkit-box-shadow: 0 0 0 4px rgba(255, 159, 28, 0.1);
    -moz-box-shadow: 0 0 0 4px rgba(255, 159, 28, 0.1);
}

/* --- Specific Views --- */

/* --- Specific Views --- */

/* Login / Register Wrappers */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    padding: 1rem;
}

.login-card {
    background: var(--bg-surface);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Logo Area in Login */
.logo-area {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-title {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 800;
}

/* Dashboard Header */
.header {
    background: var(--bg-surface);
    padding: 1rem 0;
    box-shadow: var(--shadow-xs);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Hero Section */
.hero {
    background: var(--bg-surface);
    color: var(--text-main);
    padding: 3rem 1.5rem;
    margin: 1.5rem auto;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.hero h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

/* Categories Scroll */
.cat-scroll {
    display: flex;
    gap: 0.8rem;
    overflow-x: auto;
    padding: 0.5rem 0 1.5rem 0;
    margin-top: 1.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.cat-scroll::-webkit-scrollbar {
    display: none;
}

.cat-pill {
    background: var(--bg-surface);
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-pill);
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid transparent;
    transition: all var(--transition-medium);
}

.cat-pill.active,
.cat-pill:hover {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px var(--shadow-color);
    transform: translateY(-2px);
}

/* Product Grid Refined */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.product-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: transform var(--transition-medium), box-shadow var(--transition-medium);
    -webkit-transition: transform var(--transition-medium), -webkit-box-shadow var(--transition-medium);
    -moz-transition: transform var(--transition-medium), box-shadow var(--transition-medium);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.product-img {
    height: 160px;
    background-color: #f8f9fa;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.product-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--text-main);
    line-height: 1.3;
}

.product-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-price {
    font-family: var(--font-heading);
    font-weight: 800;
    color: var(--text-main);
    font-size: 1.2rem;
}

.add-btn {
    background: var(--primary-color);
    color: var(--text-on-primary);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: all 0.2s ease;
}

.add-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px var(--shadow-color);
}

.add-btn:active {
    transform: scale(0.95);
}

.btn-secondary {
    background: #e9ecef;
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #dee2e6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    font-weight: 700;
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.btn-link {
    background: none;
    border: none;
    color: rgb(236, 149, 19);
    text-decoration: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
}

/* Cart Floating Bar */
.cart-bar {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 900;
    transition: transform var(--transition-bounce);
    -webkit-transition: transform var(--transition-bounce);

    animation: popIn 0.4s var(--ease-out-back);
    -webkit-animation: popIn 0.4s var(--ease-out-back);
}

@keyframes popIn {
    from {
        transform: translateX(-50%) scale(0.8);
        -webkit-transform: translateX(-50%) scale(0.8);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) scale(1);
        -webkit-transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

@-webkit-keyframes popIn {
    from {
        -webkit-transform: translateX(-50%) scale(0.8);
        opacity: 0;
    }

    to {
        -webkit-transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

/* Status Atendimento */
.status-indicator {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.status-aberto {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.status-fechado {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* Mobile Nav */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    right: 0;
    width: 100%;
    background: #fff;
    padding: 0.3rem 1rem;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.04);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid rgba(0, 0, 0, 0.02);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-muted);
    transition: all 0.3s ease;
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
}

.nav-item.active {
    color: var(--primary-color);
    background: rgba(255, 159, 28, 0.08);
}

.nav-icon {
    font-size: 1.1rem;
    margin-bottom: 0;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    .mobile-nav {
        display: flex;
        right: 0;
    }
}

/* --- Cart & Admin Additional Styles --- */

/* Cart Items */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.cart-item:last-child {
    border-bottom: none;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f1f2f6;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
}

.qty-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    color: var(--text-secondary);
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px dashed #eee;
}

/* Admin Specifics */
.admin-header {
    background: #2D3436;
    color: white;
    padding: 1.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

/* Order Cards */
.order-card {
    border-left: 6px solid transparent;
    transition: all 0.3s ease;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-md);
}

.order-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.border-recebido {
    border-left-color: #3498db;
    background: linear-gradient(to right, rgba(52, 152, 219, 0.05), white 20%);
}

.border-preparo {
    border-left-color: #e67e22;
    background: linear-gradient(to right, rgba(230, 126, 34, 0.05), white 20%);
}

.border-entrega {
    border-left-color: #27ae60;
    background: linear-gradient(to right, rgba(46, 204, 113, 0.05), white 20%);
}

.action-row {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.2rem;
    justify-content: flex-end;
    border-top: 1px solid #f0f0f0;
    padding-top: 1rem;
}

.btn-sm {
    padding: 0.5rem 1.2rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 6px;
}

/* Status Badges */
.status-badge {
    padding: 0.4rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-recebido {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.status-preparo {
    background: rgba(243, 156, 18, 0.1);
    color: #f39c12;
}

.status-entrega {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.status-concluido {
    background: #eee;
    color: #666;
}

/* Premium Toast Noification (iFood Style) */
body.swal2-toast-shown .swal2-container.swal2-top-end {
    padding: 1rem !important;
}

.custom-toast-popup {
    background: #ffffff !important;
    border-radius: 8px !important;
    padding: 0.8rem 1rem !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    border-left: 5px solid transparent;
    border: 1px solid rgba(0, 0, 0, 0.03) !important;
    display: flex !important;
    align-items: center !important;
    font-family: 'Inter', sans-serif !important;
}

.custom-toast-popup[data-icon="success"] {
    border-left-color: #2e7d32 !important;
}

.custom-toast-popup[data-icon="error"] {
    border-left-color: #ea1d2c !important;
}

.custom-toast-popup[data-icon="warning"] {
    border-left-color: #f39c12 !important;
}

.custom-toast-title {
    color: #333 !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    margin: 0 !important;
    text-align: left !important;
}

.swal2-icon {
    transform: scale(0.6);
    margin: 0 0.5rem 0 0 !important;
    border: none !important;
}

/* Hide default timer bar, we don't need it for this clean look if we want 'clean', but user might want it. Let's keep it subtle */
/* Premium Address Modal (SweetAlert2 Customization) */
.swal2-popup.custom-address-modal {
    border-radius: 20px !important;
    padding: 2rem !important;
    font-family: 'Inter', sans-serif !important;
}

.swal2-title.custom-modal-title {
    font-size: 1.5rem !important;
    color: var(--text-main) !important;
    margin-bottom: 1.5rem !important;
    font-weight: 700 !important;
}

.swal2-input.custom-modal-input {
    border-radius: 12px !important;
    border: 2px solid #f1f2f6 !important;
    background: #f8f9fa !important;
    height: 3rem !important;
    font-size: 1rem !important;
    margin: 0.5rem auto !important;
    color: var(--text-main) !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
    width: 75% !important;
    /* Optimized width for desktop */
    max-width: 100% !important;
}

.swal2-input.custom-modal-input:focus {
    border-color: var(--primary-color) !important;
    background: #fff !important;
    box-shadow: 0 0 0 4px rgba(255, 159, 28, 0.1) !important;
}

.swal2-confirm.custom-modal-confirm {
    background: var(--primary-gradient) !important;
    box-shadow: 0 4px 15px var(--shadow-color) !important;
    border-radius: 12px !important;
    padding: 0.8rem 2rem !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    border: none !important;
    /* No border */
}

.swal2-cancel.custom-modal-cancel {
    background: #f1f2f6 !important;
    color: var(--text-secondary) !important;
    border-radius: 12px !important;
    padding: 0.8rem 1.5rem !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    border: none !important;
    /* No border */
}

/* Responsive Table (transform to cards on mobile) */
@media screen and (max-width: 768px) {
    .admin-table thead {
        display: none;
    }

    .admin-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #eee;
        border-radius: 12px;
        padding: 1rem;
        background: #fff;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    }

    .admin-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 0.6rem 0;
        border-bottom: 1px solid #f9f9f9;
        font-size: 0.95rem;
    }

    .admin-table tbody td:last-child {
        border-bottom: none;
        justify-content: flex-end;
        gap: 1rem;
        padding-top: 1rem;
    }

    .admin-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        text-align: left;
        margin-right: 1rem;
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

}

/* Mobile Optimization for Address Modal */
@media screen and (max-width: 768px) {
    .swal2-input.custom-modal-input {
        width: 100% !important;
    }

    /* Admin Dashboard Mobile Fixes (Restored) */
    .container {
        padding: 0 1rem;
        max-width: 100%;
    }

    /* Fix config card form layout */
    .config-form,
    .card form {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .card form>div {
        flex: 1 1 100%;
        min-width: 100%;
        width: 100%;
    }

    .card form button {
        width: 100%;
        margin-top: 0.5rem;
    }

    /* Fix order cards */
    .order-card {
        margin-bottom: 1rem;
        overflow: hidden;
    }

    .order-card>div:first-child {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: nowrap;
    }

    .order-card strong {
        font-size: 0.9rem;
        word-break: break-word;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .status-badge {
        flex-shrink: 0;
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
    }

    /* Adjust h2 spacing */
    h2 {
        font-size: 1.3rem;
        margin-top: 1rem;
    }

    /* Fix action buttons */
    .action-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .action-row form {
        width: 100%;
        flex-direction: column;
    }

    .action-row button {
        width: 100%;
        white-space: normal;
        text-align: center;
        padding: 0.6rem 1rem;
    }

    .swal2-popup.custom-address-modal {
        width: 95% !important;
        padding: 1.5rem !important;
    }

    .swal2-actions {
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.5rem !important;
    }

    .swal2-confirm.custom-modal-confirm,
    .swal2-cancel.custom-modal-cancel {
        width: 100% !important;
        margin: 0 !important;
    }
}

/* Mobile Typography Adjustments */
@media screen and (max-width: 768px) {
    h2 {
        font-size: 1.5rem;
    }
}