/* Variables y Reset - Paleta "Selva de Roca" / Glassmorphism */
:root {
    /* Fondos — Carbón Profundo */
    --primary: #1A1A1A;
    --bg-app: #131313;
    --bg-surface: rgba(30, 30, 30, 0.85);
    --bg-header: rgba(18, 18, 18, 0.92);

    /* Acentos — Verde Esmeralda + Turquesa Mineral */
    --accent: #43E64B;
    --accent-hover: #38CC42;
    --accent-secondary: #51E6D7;
    --border: rgba(67, 230, 75, 0.18);
    --border-light: rgba(255, 255, 255, 0.08);

    /* Textos (Alto Contraste) */
    --text-main: #E8E8E8;
    --text-light: #9A9A9A;
    --text-title: #FFFFFF;
    --text-on-accent: #0a1a0b;

    /* Alertas */
    --success: #43E64B;
    --warning: #fbbf24;
    --danger: #fb7185;

    /* Efectos de Vidrio */
    --glass-blur: blur(14px);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.55);
    --shadow-light: rgba(255, 255, 255, 0.08);
    --shadow-accent: rgba(67, 230, 75, 0.3);

    /* Controles UI */
    --bg-input: rgba(0, 0, 0, 0.45);
    --bg-input-focus: rgba(0, 0, 0, 0.7);
    --bg-dropdown: #1e1e1e;
    --text-placeholder: rgba(255, 255, 255, 0.32);
    --bg-btn-secondary: rgba(255, 255, 255, 0.06);
    --bg-btn-icon: rgba(255, 255, 255, 0.08);
    --glass-nav-hover: rgba(67, 230, 75, 0.1);

    /* Layout */
    --header-height: 56px;
}

/* Modo Claro / Pearl Stone Theme */
[data-theme="light"] {
    --primary: #FAFAFA;
    --bg-app: #F0F2F0;
    --bg-surface: rgba(255, 255, 255, 0.9);
    --bg-header: rgba(250, 250, 250, 0.95);

    --accent: #2BA832;
    --accent-hover: #239A2A;
    --accent-secondary: #3BBFB3;
    --border: rgba(43, 168, 50, 0.22);
    --border-light: rgba(0, 0, 0, 0.08);

    --text-main: #1A1A1A;
    --text-light: #575757;
    --text-title: #111111;
    --text-on-accent: #ffffff;

    --success: #2BA832;
    --warning: #d97706;
    --danger: #e11d48;

    --glass-blur: blur(16px);
    --glass-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.06);
    --shadow-light: rgba(0, 0, 0, 0.04);
    --shadow-accent: rgba(43, 168, 50, 0.2);

    --bg-input: rgba(255, 255, 255, 0.9);
    --bg-input-focus: #ffffff;
    --bg-dropdown: #ffffff;
    --text-placeholder: rgba(0, 0, 0, 0.35);
    --bg-btn-secondary: rgba(0, 0, 0, 0.04);
    --bg-btn-icon: rgba(0, 0, 0, 0.05);
    --glass-nav-hover: rgba(43, 168, 50, 0.08);
}

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--primary);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    background-image: radial-gradient(circle at top right, rgba(67, 230, 75, 0.04) 0%, transparent 50%),
        radial-gradient(circle at bottom left, rgba(81, 230, 215, 0.03) 0%, transparent 50%);
    color: var(--text-main);
    margin: 0;
    height: 100vh;
    display: flex;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

[data-theme="light"] body {
    background-image: radial-gradient(circle at top right, rgba(43, 168, 50, 0.06) 0%, transparent 50%),
        radial-gradient(circle at bottom left, rgba(59, 191, 179, 0.04) 0%, transparent 50%);
}

.app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: var(--primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ─── Network Status Indicator ─────────────────────────────── */

.net-status {
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    transition: all 0.4s ease;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.net-status.online {
    color: var(--success);
    background: rgba(67, 230, 75, 0.08);
    border: 1px solid rgba(67, 230, 75, 0.2);
    text-shadow: 0 0 8px rgba(67, 230, 75, 0.3);
}

.net-status.offline {
    color: var(--danger);
    background: rgba(251, 113, 133, 0.1);
    border: 1px solid rgba(251, 113, 133, 0.25);
    animation: pulse-offline 2s ease-in-out infinite;
}

.net-status.syncing {
    color: var(--warning);
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.net-status.pending {
    color: var(--warning);
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.pending-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 0.68rem;
    font-weight: 700;
    background: var(--warning);
    color: #000;
    animation: pulse-badge 1.5s ease-in-out infinite;
}

@keyframes pulse-offline {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ─── Offline Pack Button ───────────────────────────────────── */

.btn-offline-pack {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.btn-offline-pack:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
}

.btn-offline-pack:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.offline-pack-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--accent);
    color: #fff;
}

/* ─── Offline Pack Progress Modal ───────────────────────────── */

#offline-pack-modal {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    animation: slideInUp 0.3s ease;
}

.offline-modal-inner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    min-width: 300px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    backdrop-filter: blur(10px);
}

.offline-modal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.offline-modal-header i {
    color: var(--accent);
    font-size: 1rem;
}

.offline-progress-bar-wrap {
    background: var(--border);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.offline-progress-bar {
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
    transition: width 0.4s ease, background 0.3s ease;
}

.offline-modal-msg {
    font-size: 0.75rem;
    color: var(--text-dim);
}

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