/**
 * Estilos Principales
 * Sistema de Pedidos PWA - Grupo Lucas Pérez
 */

/* ===== VARIABLES CSS ===== */
:root {
    /* Colores Corporativos */
    --primary-green: #2d5016;
    --secondary-green: #4a7c23;
    --light-green: #7fb069;
    --accent-green: #a7d129;
    --bg-light: #f8fdf4;
    
    /* Colores de Estado */
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    
    /* Grises */
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    
    /* Sombras */
    --shadow-sm: 0 2px 4px rgba(45, 80, 22, 0.08);
    --shadow: 0 4px 8px rgba(45, 80, 22, 0.1);
    --shadow-lg: 0 8px 16px rgba(45, 80, 22, 0.12);
    --shadow-xl: 0 12px 24px rgba(45, 80, 22, 0.15);
    
    /* Espaciado */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 50%;
    
    /* Transiciones */
    --transition-fast: 0.15s ease-in-out;
    --transition-base: 0.3s ease-in-out;
    --transition-slow: 0.5s ease-in-out;
    
    /* Z-indexes */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    
    /* Altura de componentes fijos */
    --topbar-height: 60px;
    --bottomnav-height: 70px;
}

/* ===== RESET Y BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, var(--bg-light) 0%, #ffffff 100%);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    padding-top: var(--topbar-height);
    padding-bottom: var(--bottomnav-height);
}

/* Para páginas sin bottom nav */
body.no-bottom-nav {
    padding-bottom: var(--spacing-xl);
}

/* ===== LAYOUT PRINCIPAL ===== */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

.content-wrapper {
    min-height: calc(100vh - var(--topbar-height) - var(--bottomnav-height) - 3rem);
}

/* ===== TOPBAR ===== */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 100%);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-lg);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    color: white;
    text-decoration: none;
}

.topbar-logo {
    height: 40px;
    width: auto;
}

.topbar-title {
    font-size: 1.125rem;
    font-weight: 700;
    display: none;
}

@media (min-width: 768px) {
    .topbar-title {
        display: block;
    }
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.topbar-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    transition: var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Avatar del usuario */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--accent-green);
    color: var(--primary-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-base);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-avatar:hover {
    transform: scale(1.05);
    border-color: white;
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottomnav-height);
    background: white;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: var(--spacing-sm) var(--spacing-md);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.75rem;
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    position: relative;
}

.bottom-nav-item i {
    font-size: 1.25rem;
}

.bottom-nav-item.active {
    color: var(--primary-green);
    font-weight: 600;
}

.bottom-nav-item.active i {
    transform: scale(1.1);
}

/* Botón central flotante */
.bottom-nav-center {
    position: relative;
    margin-top: -30px;
}

.bottom-nav-center-btn {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-green) 0%, var(--light-green) 100%);
    border: 4px solid white;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-base);
}

.bottom-nav-center-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(167, 209, 41, 0.4);
}

.bottom-nav-center-btn:active {
    transform: scale(0.95);
}

/* Badge de notificaciones */
.nav-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: white;
    box-shadow: var(--shadow-xl);
    z-index: var(--z-modal);
    transition: left var(--transition-base);
    overflow-y: auto;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 100%);
    color: white;
    padding: var(--spacing-xl) var(--spacing-lg);
}

.sidebar-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--spacing-sm);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.sidebar-user-avatar {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    background: var(--accent-green);
    color: var(--primary-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
}

.sidebar-user-info h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.sidebar-user-info p {
    font-size: 0.75rem;
    opacity: 0.9;
}

.sidebar-menu {
    padding: var(--spacing-lg);
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    color: var(--gray-700);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    margin-bottom: var(--spacing-xs);
}

.sidebar-menu-item:hover {
    background: var(--gray-100);
    color: var(--primary-green);
}

.sidebar-menu-item i {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
}

.sidebar-divider {
    height: 1px;
    background: var(--gray-200);
    margin: var(--spacing-lg) 0;
}

/* Overlay para cerrar sidebar */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-modal) - 1);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-base);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===== UTILIDADES ===== */
.text-primary { color: var(--primary-green) !important; }
.text-secondary { color: var(--secondary-green) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }

.bg-primary { background-color: var(--primary-green) !important; }
.bg-secondary { background-color: var(--secondary-green) !important; }
.bg-light { background-color: var(--bg-light) !important; }

/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

.pulse {
    animation: pulse 2s infinite;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .app-container {
        padding: var(--spacing-md);
    }
}

@media (max-width: 480px) {
    .bottom-nav-item span {
        font-size: 0.625rem;
    }
    
    .bottom-nav-item i {
        font-size: 1.125rem;
    }
}