/* 
 * Pan Comido App - Main Styles
 * PWA User Application Stylesheet
 */

/* ========================================
   CSS Variables
   ======================================== */
/* Switch Toggle Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #10b981;
}

input:checked+.slider:before {
    transform: translateX(26px);
}

:root {
    --primary: #22c55e;
    --primary-dark: #16a34a;
    --orange: #FF6B35;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
}

/* ========================================
   Base Styles
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #1e293b;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.phone-frame {
    width: 100%;
    max-width: 450px;
    background: var(--bg);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.screen {
    display: none;
    height: 100vh;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* ========================================
   Login Screen
   ======================================== */
.login-screen {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 40px 24px;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    animation: fadeIn 0.5s;
}

.login-logo {
    font-size: 80px;
    margin-bottom: 16px;
    animation: bounce 2s infinite;
}

.login-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
}

.login-subtitle {
    opacity: 0.9;
    margin-bottom: 40px;
}

.login-form {
    width: 100%;
    max-width: 320px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group input {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.9);
    transition: transform 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
    transform: scale(1.02);
    outline: none;
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.input-group input::placeholder {
    color: var(--text-secondary);
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: var(--text);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.btn-login:hover {
    opacity: 0.95;
}

.btn-login:active {
    transform: scale(0.96);
}

.btn-login:focus-visible {
    outline: 3px solid white;
    outline-offset: 2px;
}

.login-divider {
    margin: 24px 0;
    opacity: 0.7;
}

.btn-guest {
    background: transparent;
    border: 2px solid white;
    color: white;
    box-shadow: none;
}

/* ========================================
   Header
   ======================================== */
.header {
    padding: 20px;
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.location {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-weight: 600;
}

.header-icons {
    display: flex;
    gap: 12px;
    font-size: 24px;
}

.header-icons button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: background 0.2s;
}

.header-icons button:hover {
    background: var(--bg);
}

.search-bar {
    background: #f1f5f9;
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    cursor: text;
}

.search-bar:focus-within {
    box-shadow: 0 0 0 2px var(--primary);
}

/* ========================================
   Categories
   ======================================== */
.categories {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    overflow-x: auto;
    scrollbar-width: none;
    background: white;
}

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

.cat-chip {
    padding: 8px 20px;
    background: #f8fafc;
    border-radius: 25px;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid var(--border);
}

.cat-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cat-chip:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.cat-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(34, 197, 94, 0.3);
}

/* ========================================
   Feed
   ======================================== */
.feed {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 100px;
    -webkit-overflow-scrolling: touch;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 12px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
}

.see-all {
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: none;
}

.see-all:hover {
    text-decoration: underline;
}

/* ========================================
   Offer Card
   ======================================== */
.offer-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.offer-card:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

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

.offer-card:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.offer-img {
    height: 160px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.offer-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--orange);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.offer-discount {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--primary);
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.offer-content {
    padding: 16px;
}

.offer-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 6px;
}

.offer-name {
    font-weight: 700;
    font-size: 16px;
    width: 70%;
    line-height: 1.3;
}

.offer-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    background: #fffbeb;
    color: #d97706;
    padding: 2px 8px;
    border-radius: 6px;
}

.offer-restaurant {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.offer-time {
    color: var(--primary);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    background: #f0fdf4;
    padding: 4px 8px;
    border-radius: 6px;
    width: fit-content;
}

.offer-price {
    display: flex;
    align-items: center;
    gap: 8px;
}

.price-new {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
}

.price-old {
    text-decoration: line-through;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ========================================
   Detail Screen
   ======================================== */
.detail-screen {
    background: white;
    z-index: 50;
}

.detail-header {
    height: 260px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.detail-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), transparent);
}

.detail-back {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    border: none;
    transition: transform 0.2s;
}

.detail-back:hover {
    transform: scale(1.1);
}

.detail-back:focus-visible {
    outline: 3px solid var(--primary);
}

.detail-content {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    border-radius: 24px 24px 0 0;
    margin-top: -24px;
    background: white;
    position: relative;
}

.detail-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.detail-badge {
    background: #f0fdf4;
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.detail-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.2;
}

.detail-restaurant {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 15px;
}

.detail-desc {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
    font-size: 14px;
}

.detail-info {
    background: #f8fafc;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 24px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child {
    border: none;
    padding-bottom: 0;
}

.info-row:first-child {
    padding-top: 0;
}

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

.info-value {
    font-weight: 600;
    font-size: 14px;
}

/* ========================================
   Quantity Selector
   ======================================== */
.quantity-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 24px;
    background: #f1f5f9;
    padding: 10px;
    border-radius: 16px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    color: var(--primary);
    transition: transform 0.2s;
}

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

.qty-btn:active {
    transform: scale(0.9);
}

.qty-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

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

.qty-value {
    font-size: 20px;
    font-weight: 700;
    min-width: 30px;
    text-align: center;
}

/* ========================================
   Detail Footer
   ======================================== */
.detail-footer {
    padding: 20px 24px;
    background: white;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 16px;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.detail-total {
    flex: 1;
}

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

.total-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.btn-reserve {
    background: var(--primary);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-reserve:hover {
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}

.btn-reserve:active {
    transform: scale(0.96);
}

.btn-reserve:focus-visible {
    outline: 3px solid var(--text);
    outline-offset: 2px;
}

/* ========================================
   Orders Screen
   ======================================== */
.orders-header {
    padding: 20px;
    background: white;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.orders-title {
    font-size: 24px;
    font-weight: 700;
}

.orders-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 100px;
}

.order-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
}

.order-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.order-restaurant {
    font-weight: 600;
    color: var(--text);
}

.order-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-pending {
    background: #fef3c7;
    color: #d97706;
}

.status-completed {
    background: #dcfce7;
    color: #16a34a;
}

.order-item {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.order-code {
    background: #f8fafc;
    border: 2px dashed var(--primary);
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    margin-top: 16px;
    position: relative;
    overflow: hidden;
}

.code-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.code-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 6px;
    color: var(--primary);
}

.btn-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 12px;
    margin-top: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-whatsapp:hover {
    background: #1da851;
}

/* ========================================
   Profile Screen
   ======================================== */
.profile-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 40px 24px;
    text-align: center;
    color: white;
    border-radius: 0 0 30px 30px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: white;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.profile-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-email {
    opacity: 0.8;
    font-size: 14px;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 24px;
    background: rgba(255, 255, 255, 0.1);
    padding: 16px;
    border-radius: 16px;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.profile-stat {
    text-align: center;
}

.stat-number {
    font-size: 20px;
    font-weight: 700;
}

.stat-label {
    font-size: 11px;
    opacity: 0.9;
}

.profile-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 100px;
}

.profile-menu-item {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.2s;
}

.profile-menu-item:hover {
    background: var(--bg);
}

/* ========================================
   Bottom Navigation
   ======================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: 450px;
    background: white;
    display: flex;
    padding: 12px 0 24px;
    border-top: 1px solid var(--border);
    z-index: 100;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.05);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: none;
}

.nav-item:hover {
    color: var(--text-secondary);
}

.nav-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    border-radius: 8px;
}

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

.nav-item.active .nav-icon {
    transform: translateY(-2px);
}

.nav-icon {
    font-size: 24px;
    transition: transform 0.2s;
}

/* ========================================
   Modal
   ======================================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: white;
    border-radius: 24px;
    padding: 32px;
    text-align: center;
    margin: 20px;
    width: 90%;
    max-width: 360px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    animation: popIn 0.3s forwards;
}

.modal-icon {
    font-size: 60px;
    margin-bottom: 20px;
    display: block;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.modal-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text);
}

.modal-desc {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 15px;
}

.modal-code {
    background: #f0fdf4;
    color: var(--primary);
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 24px;
    border: 2px dashed var(--primary);
}

.modal-code-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
    margin-bottom: 4px;
}

.modal-code-value {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 6px;
}

.modal-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
    transition: transform 0.2s;
}

.modal-btn:hover {
    opacity: 0.95;
}

.modal-btn:active {
    transform: scale(0.98);
}

/* ========================================
   PWA Install Prompt
   ======================================== */
.install-prompt {
    position: fixed;
    bottom: 80px;
    left: 20px;
    right: 20px;
    background: #1e293b;
    color: white;
    padding: 16px;
    border-radius: 16px;
    display: none;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.5s;
}

.install-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.install-icon {
    font-size: 24px;
}

.install-text div:first-child {
    font-weight: 700;
    font-size: 14px;
}

.install-text div:last-child {
    font-size: 12px;
    opacity: 0.8;
}

.btn-install {
    background: var(--primary);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

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

.btn-close-install {
    background: white;
    /* Not transparent */
    ;
    border: none;
    color: white;
    opacity: 0.5;
    font-size: 20px;
    cursor: pointer;
    margin-left: 8px;
    transition: opacity 0.2s;
}

.btn-close-install:hover {
    opacity: 1;
}

/* ========================================
   Loading & Empty States
   ======================================== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

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

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
    border-radius: 8px;
}

.skeleton-card {
    height: 250px;
    margin-bottom: 20px;
    border-radius: 16px;
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes popIn {
    to {
        transform: scale(1);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

@keyframes skeleton {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ========================================
   Accessibility
   ======================================== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}