/* ==========================================
   BOCADOS DE NIEVE - ADMIN PANEL
   Ultra Professional Mobile-First Design
   ========================================== */

/* ===== CSS Variables ===== */
:root {
    /* Paleta de colores pastel premium */
    --primary: #FF6B9D;
    --primary-light: #FFE4ED;
    --primary-dark: #E64D80;
    
    --secondary: #7C83FD;
    --secondary-light: #E8E9FF;
    
    --accent-mint: #4ECDC4;
    --accent-mint-light: #E0F7F5;
    
    --accent-peach: #FFB17A;
    --accent-peach-light: #FFF0E4;
    
    --accent-lavender: #B19CD9;
    --accent-lavender-light: #F3EEFF;
    
    /* Estado colors */
    --success: #00B894;
    --success-light: #E0F8F3;
    --warning: #FDCB6E;
    --warning-light: #FFF9E6;
    --danger: #FF6B6B;
    --danger-light: #FFE9E9;
    --info: #74B9FF;
    --info-light: #E8F4FF;
    
    /* Neutros */
    --dark: #2D3436;
    --gray-dark: #636E72;
    --gray: #A0A4A8;
    --gray-light: #DFE6E9;
    --light: #F8F9FA;
    --white: #FFFFFF;
    
    /* Gradientes */
    --gradient-header: linear-gradient(135deg, #FF6B9D 0%, #7C83FD 50%, #4ECDC4 100%);
    --gradient-card: linear-gradient(145deg, #FFFFFF 0%, #FEF9FB 100%);
    --gradient-button: linear-gradient(135deg, #FF6B9D 0%, #FF8E53 100%);
    
    /* Sombras */
    --shadow-sm: 0 2px 8px rgba(255, 107, 157, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.06);
    
    /* Bordes */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 50px;
    
    /* Tipografía */
    --font-primary: 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Fredoka', 'Quicksand', sans-serif;
    
    /* Transiciones */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    background: var(--light);
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.5;
}

/* ===== Login Screen ===== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--gradient-header);
    position: relative;
}

.login-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
}

.login-card {
    background: var(--white);
    padding: 40px 30px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

.login-logo {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-card h1 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--dark);
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 0.95rem;
    color: var(--gray);
    margin-bottom: 30px;
    font-weight: 500;
}

.password-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 20px;
    transition: all var(--transition-smooth);
}

.password-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 107, 157, 0.15);
}

.login-btn {
    width: 100%;
    padding: 16px;
    background: var(--gradient-button);
    color: var(--white);
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-smooth);
    box-shadow: 0 4px 20px rgba(255, 107, 157, 0.35);
}

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

.error-msg {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 16px;
    font-weight: 600;
}

/* ===== App Container ===== */
.app-container {
    min-height: 100vh;
    padding-bottom: 90px;
}

/* ===== Header ===== */
.header {
    background: var(--gradient-header);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--white);
    padding: 3px;
    box-shadow: var(--shadow-sm);
}

.header-info h1 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--white);
    line-height: 1.1;
}

.header-subtitle {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.logout-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    display: flex;
    justify-content: space-around;
    padding: 12px 10px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.08);
    z-index: 100;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 20px;
    background: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-smooth);
    position: relative;
}

.nav-btn.active {
    background: var(--primary-light);
}

.nav-emoji {
    font-size: 1.5rem;
    line-height: 1;
}

.nav-btn span:last-of-type:not(.badge) {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray);
}

.nav-btn.active span:last-of-type:not(.badge) {
    color: var(--primary);
}

.badge {
    position: absolute;
    top: 4px;
    right: 10px;
    background: var(--danger);
    color: var(--white);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
}

.badge:empty,
.badge:contains('0') {
    display: none;
}

/* ===== Main Content ===== */
.main-content {
    padding: 16px;
    max-width: 540px;
    margin: 0 auto;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--white);
    padding: 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-card);
    border-left: 4px solid transparent;
}

.stat-card.green {
    border-left-color: var(--success);
    background: linear-gradient(135deg, var(--white) 0%, var(--success-light) 100%);
}

.stat-card.blue {
    border-left-color: var(--info);
    background: linear-gradient(135deg, var(--white) 0%, var(--info-light) 100%);
}

.stat-card.orange {
    border-left-color: var(--warning);
    background: linear-gradient(135deg, var(--white) 0%, var(--warning-light) 100%);
}

.stat-card.purple {
    border-left-color: var(--accent-lavender);
    background: linear-gradient(135deg, var(--white) 0%, var(--accent-lavender-light) 100%);
}

.stat-emoji {
    font-size: 1.8rem;
    line-height: 1;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--gray);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark);
}

/* ===== Cards ===== */
.card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
}

.card h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--dark);
    margin-bottom: 16px;
}

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

.card-header h3 {
    margin-bottom: 0;
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* ===== Chart Container ===== */
.chart-container {
    position: relative;
    height: 200px;
}

/* ===== Filters ===== */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-select,
.filter-input {
    flex: 1;
    min-width: 100px;
    padding: 12px 14px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    background: var(--white);
    color: var(--dark);
}

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

.refresh-btn {
    padding: 12px 20px;
    background: var(--gradient-button);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.refresh-btn:active {
    transform: scale(0.95);
}

/* ===== Orders Grid ===== */
#ordersGrid,
#recentOrdersList {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: all var(--transition-smooth);
    border-left: 4px solid var(--gray-light);
}

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

.order-card.pending {
    border-left-color: var(--warning);
}

.order-card.preparing {
    border-left-color: var(--info);
}

.order-card.ready {
    border-left-color: var(--success);
}

.order-card.delivered {
    border-left-color: var(--accent-lavender);
}

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

.order-number {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
}

.order-status {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.order-status.pending {
    background: var(--warning-light);
    color: #B7950B;
}

.order-status.preparing {
    background: var(--info-light);
    color: #2980B9;
}

.order-status.ready {
    background: var(--success-light);
    color: #00A884;
}

.order-status.delivered {
    background: var(--accent-lavender-light);
    color: var(--accent-lavender);
}

.order-customer {
    font-size: 0.9rem;
    color: var(--gray-dark);
    margin-bottom: 6px;
    font-weight: 600;
}

.order-items {
    font-size: 0.8rem;
    color: var(--gray);
    margin-bottom: 10px;
}

.order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-total {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.order-time {
    font-size: 0.75rem;
    color: var(--gray);
}

/* ===== Date Picker ===== */
.date-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.date-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--gray);
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.date-field input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    background: var(--white);
}

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

.generate-btn {
    width: 100%;
    padding: 14px;
    background: var(--gradient-button);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all var(--transition-smooth);
}

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

/* ===== Report Stats ===== */
.report-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.report-stat {
    background: var(--white);
    padding: 16px 12px;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-card);
}

.report-emoji {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 6px;
}

.report-label {
    font-size: 0.65rem;
    color: var(--gray);
    font-weight: 600;
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}

.report-value {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
}

.export-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent-mint);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-smooth);
}

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

/* ===== Modal ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: 540px;
    max-height: 85vh;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform var(--transition-smooth);
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    background: var(--gradient-header);
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--white);
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 20px;
    max-height: 50vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    background: var(--light);
}

/* ===== Order Detail ===== */
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-light);
}

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

.detail-label {
    font-size: 0.85rem;
    color: var(--gray);
    font-weight: 600;
}

.detail-value {
    font-size: 0.9rem;
    color: var(--dark);
    font-weight: 700;
}

.detail-items {
    margin: 16px 0;
    padding: 14px;
    background: var(--light);
    border-radius: var(--radius-md);
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.9rem;
}

.detail-item-name {
    color: var(--dark);
    font-weight: 600;
}

.detail-item-price {
    color: var(--primary);
    font-weight: 700;
}

/* ===== Status Grid ===== */
.status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.status-btn {
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.status-btn.pending {
    background: var(--warning-light);
    color: #B7950B;
}

.status-btn.preparing {
    background: var(--info-light);
    color: #2980B9;
}

.status-btn.ready {
    background: var(--success-light);
    color: #00A884;
}

.status-btn.delivered {
    background: var(--accent-lavender-light);
    color: var(--accent-lavender);
}

.status-btn:active {
    transform: scale(0.95);
}

.status-btn.active {
    box-shadow: 0 0 0 3px var(--primary);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
}

.empty-state p {
    font-size: 1rem;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-light);
    border-radius: 10px;
}

/* ===== Input Focus Fix ===== */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="password"],
    input[type="date"],
    input[type="number"],
    select {
        font-size: 16px;
    }
}

/* ===== Desktop Improvements ===== */
@media (min-width: 768px) {
    .modal-content {
        border-radius: var(--radius-lg);
        max-height: 80vh;
    }
    
    .modal {
        align-items: center;
        padding: 20px;
    }
}
