/* EXCENTRICA - Layout Mobile CSS */
/* Header, bottom nav y estructura principal */

/* ============================================
   ESTRUCTURA PRINCIPAL
   ============================================ */
.mobile-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg-primary);
}

.mobile-app #mobile-main {
    flex: 1;
    padding-top: calc(var(--mobile-header-height) + var(--mobile-safe-area-top));
    padding-bottom: calc(var(--mobile-bottom-nav-height) + var(--mobile-safe-area-bottom));
    overflow-y: auto;
}

/* ============================================
   BANNER INSTALACION PWA
   ============================================ */
#install-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: none;
}

#install-banner.active {
    display: block;
}

.install-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-bottom: 1px solid var(--border-color);
}

.install-banner-text {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.install-banner-icon {
    font-size: 1.25rem;
}

.install-banner-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--glow-primary);
}

.install-banner-close {
    padding: 0.25rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
}

/* Cuando hay banner, mover header abajo */
#install-banner.active ~ #mobile-header {
    top: 48px;
}

#install-banner.active ~ #mobile-main {
    padding-top: calc(var(--mobile-header-height) + 48px + var(--mobile-safe-area-top));
}

/* ============================================
   BANNER ACTUALIZACION PWA
   ============================================ */
.update-banner {
    position: fixed;
    bottom: calc(var(--mobile-bottom-nav-height) + var(--mobile-safe-area-bottom) + 1rem);
    left: 1rem;
    right: 1rem;
    z-index: 1001;
    display: none;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.update-banner.active {
    display: block;
}

.update-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(22, 163, 74, 0.1));
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.update-banner-text {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

.update-banner-icon {
    font-size: 1.25rem;
}

.update-banner-btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(34, 197, 94, 0.3);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.update-banner-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.update-banner-btn:disabled {
    opacity: 0.8;
    cursor: not-allowed;
    transform: none;
}

.update-banner-close {
    padding: 0.25rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.update-banner-close:hover {
    color: var(--text-primary);
}

/* Spinner para boton de actualizar */
.spinner-small {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Desktop update banner */
@media (min-width: 769px) {
    .update-banner {
        bottom: 2rem;
        left: auto;
        right: 2rem;
        max-width: 360px;
    }
}

/* ============================================
   HEADER MOBILE
   ============================================ */
#mobile-header {
    position: fixed;
    top: var(--mobile-safe-area-top);
    left: 0;
    right: 0;
    height: var(--mobile-header-height);
    z-index: 500;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.mobile-header-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 var(--mobile-padding);
    gap: 0.75rem;
}

.mobile-header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.125rem;
}

.mobile-header-logo img {
    height: 28px;
    width: auto;
}

.mobile-header-search {
    flex: 1;
    position: relative;
}

.mobile-header-search input {
    width: 100%;
    height: 36px;
    padding: 0 0.75rem 0 2.25rem;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: 18px;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.mobile-header-search input::placeholder {
    color: var(--text-muted);
}

.mobile-header-search input:focus {
    border-color: var(--primary);
    background: var(--bg-quaternary);
}

.mobile-header-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-header-search-icon svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   BOTTOM NAVIGATION
   ============================================ */
#mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--mobile-bottom-nav-height) + var(--mobile-safe-area-bottom));
    padding-bottom: var(--mobile-safe-area-bottom);
    z-index: 500;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.mobile-bottom-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: var(--mobile-bottom-nav-height);
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem;
    text-decoration: none;
    color: var(--text-muted);
    transition: var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item:active {
    transform: scale(0.95);
}

.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.mobile-nav-icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.5;
}

.mobile-nav-label {
    font-size: 0.6875rem;
    font-weight: 500;
}

/* Efecto en item activo */
.mobile-nav-item.active .mobile-nav-icon svg {
    stroke-width: 2;
    filter: drop-shadow(0 0 4px var(--primary));
}

/* ============================================
   PAGINA CONTENIDO
   ============================================ */
.mobile-page {
    padding: var(--mobile-padding);
}

.mobile-page-header {
    margin-bottom: 1rem;
}

.mobile-page-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ============================================
   LOADING STATE
   ============================================ */
.mobile-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.mobile-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: mobile-spin 0.8s linear infinite;
}

@keyframes mobile-spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   EMPTY STATE
   ============================================ */
.mobile-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

.mobile-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.mobile-empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.mobile-empty-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ============================================
   PULL TO REFRESH INDICATOR
   ============================================ */
.mobile-pull-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}
