/* public/css/style.css */
@import url('variables.css');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

/* --- ESTRUCTURA SPA --- */
#app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header superior */
.main-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    height: 36px;
    max-width: 120px;
    object-fit: contain;
}

.brand-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

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

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

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

/* Selectores táctiles sencillos */
.lang-selector {
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--secondary-color);
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-main);
}

.lang-selector:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-icon {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast);
}

.btn-icon:hover {
    background-color: var(--secondary-color);
}

/* Contenido Principal */
.main-content {
    flex: 1;
    padding: 16px;
    padding-bottom: 80px; /* Espacio para bottom nav en móvil */
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* --- NAVEGACIÓN MÓVIL (BOTTOM NAV) --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 200;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    gap: 4px;
    flex: 1;
    height: 100%;
    transition: color var(--transition-fast);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-main);
}

.nav-item svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

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

/* Ocultar Sidebar en Móvil */
.sidebar {
    display: none;
}

/* --- VISTAS / VIEWS --- */
.view-section {
    display: none;
}

.view-section.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* --- PANTALLA DE LOGIN --- */
.login-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--bg-app);
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 32px 24px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--primary-color);
}

/* --- VISTA DE CARGA (SPINNER) --- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--secondary-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

/* --- ANIMACIONES --- */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- RESPONSIVIDAD (ESCRITORIO >= 768px) --- */
@media (min-width: 768px) {
    #app-container {
        flex-direction: row;
    }

    /* Ocultar Bottom Nav en Escritorio */
    .bottom-nav {
        display: none;
    }

    /* Mostrar Sidebar Fijo en Escritorio */
    .sidebar {
        display: flex;
        flex-direction: column;
        width: 240px;
        background-color: var(--bg-card);
        border-right: 1px solid var(--border-color);
        height: 100vh;
        position: sticky;
        top: 0;
        z-index: 150;
        padding: 20px 0;
    }

    .sidebar-brand {
        padding: 0 20px 20px;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 20px;
        text-align: center;
    }

    .sidebar-menu {
        display: flex;
        flex-direction: column;
        gap: 4px;
        flex: 1;
        padding: 0 10px;
    }

    .sidebar-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        text-decoration: none;
        color: var(--text-secondary);
        font-size: 14px;
        font-weight: 500;
        border-radius: 8px;
        transition: all var(--transition-fast);
        background: none;
        border: none;
        width: 100%;
        text-align: left;
        cursor: pointer;
        font-family: var(--font-main);
    }

    .sidebar-item svg {
        width: 20px;
        height: 20px;
        fill: currentColor;
    }

    .sidebar-item:hover {
        background-color: var(--secondary-color);
        color: var(--text-primary);
    }

    .sidebar-item.active {
        background-color: var(--primary-light);
        color: var(--primary-color);
    }

    /* Contenedor de contenido desplazado a la derecha en Escritorio */
    .content-wrapper {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }

    .main-content {
        padding: 24px;
        padding-bottom: 24px; /* Sin relleno extra para bottom nav */
    }
}
