/**
 * PWA App Global Styles
 * Diseño tipo app móvil para toda la experiencia
 */

:root {
    /* Colors - App Theme */
    --app-primary: #667eea;
    --app-primary-dark: #5568d3;
    --app-secondary: #764ba2;
    --app-accent: #10b981;
    --app-danger: #ef4444;
    --app-warning: #f59e0b;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    
    /* Backgrounds */
    --bg-app: #f8f9fa;
    --bg-card: #ffffff;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    
    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    
    /* Borders */
    --border-color: #e2e8f0;
    --border-radius: 16px;
    --border-radius-lg: 24px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --shadow-primary: 0 8px 24px rgba(102, 126, 234, 0.35);
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Safe Areas (iOS) */
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Mobile First - App Container */
.app-wrapper {
    min-height: 100vh;
    padding-bottom: calc(70px + var(--safe-bottom)); /* Space for bottom nav */
}

/* Bottom Navigation (App Style) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding-bottom: var(--safe-bottom);
}

.bottom-nav-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 0.5rem 0;
}

.nav-item-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.3s;
    position: relative;
}

.nav-item-bottom.active {
    color: var(--app-primary);
}

.nav-item-bottom.active::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 0 0 3px 3px;
}

.nav-icon-bottom {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.nav-label-bottom {
    font-size: 0.75rem;
    font-weight: 600;
}

.nav-badge {
    position: absolute;
    top: 0.25rem;
    right: 0.75rem;
    background: var(--app-danger);
    color: white;
    border-radius: 10px;
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}

/* Cards - App Style */
.app-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.app-card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

/* Buttons - App Style */
.btn-app {
    padding: 1rem 1.5rem;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-app-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-primary);
}

.btn-app-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.45);
}

.btn-app-success {
    background: var(--gradient-success);
    color: white;
}

.btn-app-outline {
    background: white;
    color: var(--app-primary);
    border: 2px solid var(--border-color);
}

/* Input Fields - App Style */
.input-app {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s;
}

.input-app:focus {
    outline: none;
    border-color: var(--app-primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Pull to Refresh Indicator */
.ptr-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transform: translateY(-100%);
    transition: transform 0.3s;
    z-index: 999;
}

.ptr-indicator.active {
    transform: translateY(0);
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: calc(20px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    max-width: 90%;
    width: 400px;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast.success {
    border-left: 4px solid var(--app-accent);
}

.toast.error {
    border-left: 4px solid var(--app-danger);
}

.toast-icon {
    font-size: 1.5rem;
}

.toast-message {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Swipe Indicators */
.swipe-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.swipe-indicator.left {
    left: 1rem;
}

.swipe-indicator.right {
    right: 1rem;
}

/* Bottom Sheet */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 24px 24px 0 0;
    padding: 1.5rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 2000;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
}

.bottom-sheet.active {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 2px;
    margin: 0 auto 1rem;
}

/* Page Transitions */
.page-transition {
    animation: pageIn 0.3s ease;
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Safe Areas iOS */
@supports (padding: max(0px)) {
    .safe-area-top {
        padding-top: max(var(--safe-top), 1rem);
    }
    
    .safe-area-bottom {
        padding-bottom: max(var(--safe-bottom), 1rem);
    }
}

/* Haptic Feedback (visual) */
@keyframes tap {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.btn-app:active {
    animation: tap 0.2s ease;
}

/* Responsive - Desktop */
@media (min-width: 1024px) {
    .app-wrapper {
        max-width: 480px;
        margin: 0 auto;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
    }
    
    .bottom-nav {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 16px 16px 0 0;
    }
}

/* Hide on Desktop (Mobile Only) */
@media (min-width: 768px) {
    .mobile-only {
        display: none;
    }
}

/* Hide on Mobile */
@media (max-width: 767px) {
    .desktop-only {
        display: none;
    }
}

