/* ==========================================================================
   MULTIS.ES - UNIFIED PREMIUM DESIGN SYSTEM (SLATE DARK THEME)
   ========================================================================== */

:root {
    /* Base configuration (Structural) */
    --nav-height: 64px;
    --search-height: 68px;
    --font-stack: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Theme colors (Defaults to Dark Theme) */
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #3730a3;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-header: #334155;
    --bg-input: #0f172a;
    --bg-hover: rgba(255, 255, 255, 0.05);
    --bg-hover-more: rgba(255, 255, 255, 0.1);
    --bg-hover-subtle: rgba(255, 255, 255, 0.02);
    --bg-subtle: rgba(255, 255, 255, 0.02);
    --bg-glass: rgba(30, 41, 59, 0.75);
    --bg-drawer: rgba(30, 41, 59, 0.95);
    --bg-overlay: rgba(15, 23, 42, 0.6);
    --bg-station: rgba(0, 0, 0, 0.1);
    --bg-detail: rgba(0, 0, 0, 0.15);
    --bg-collapse-summary: rgba(79, 70, 229, 0.1);
    --bg-line-filters: rgba(30, 41, 59, 0.4);
    
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --text-dark: #0f172a;
    --text-accent: #a5b4fc;
    --text-alias: #a0aec0;
    --text-on-primary: #ffffff;
    
    --border-color: #334155;
    --border-color-light: #475569;
    --border-subtle: rgba(255, 255, 255, 0.12);
    --border-line-filters: var(--border-color);
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --danger-text: #fc8181;
    --danger-border: rgba(239, 68, 68, 0.3);
    --warning-bg: rgba(245, 158, 11, 0.15);
    --warning-border: rgba(245, 158, 11, 0.3);
    
    --badge-esc-bg: rgba(245, 158, 11, 0.15);
    --badge-esc-text: var(--warning);
    --badge-esc-border: rgba(245, 158, 11, 0.3);
    --badge-ibt-bg: rgba(59, 130, 246, 0.15);
    --badge-ibt-text: #60a5fa;
    --badge-ibt-border: rgba(59, 130, 246, 0.3);

    --logo-shadow: drop-shadow(0 0 8px rgba(255,255,255,0.1));
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-primary: 0 4px 15px rgba(79, 70, 229, 0.35);
    --shadow-primary-hover: 0 6px 20px rgba(79, 70, 229, 0.5);
    --shadow-brand: 0 0 15px rgba(79, 70, 229, 0.4);
    --shadow-brand-text: 0 0 10px rgba(79, 70, 229, 0.5);
    --shadow-input: inset 0 2px 4px rgba(0,0,0,0.1);
    --shadow-input-focus: 0 0 0 3px rgba(99, 102, 241, 0.2);
    --shadow-drawer: 4px 0 30px rgba(0,0,0,0.5);

    /* Navbar / Shortcut icon states */
    --border-icon-hover: rgba(99, 102, 241, 0.6);
    --bg-icon-hover: rgba(99, 102, 241, 0.15);
    --text-icon-hover: #a5b4fc;
    --shadow-icon-hover: 0 0 10px rgba(99, 102, 241, 0.3);
    
    --shadow-icon-active: 0 0 8px rgba(255, 255, 255, 0.15);

    /* Drawer Active styles */
    --border-drawer-active: none;
    --shadow-drawer-active: 0 4px 12px rgba(79, 70, 229, 0.25);
    --text-shadow-drawer-active: none;
    --font-weight-drawer-active: 600;

    /* Station Selected styles */
    --bg-station-selected: rgba(79, 70, 229, 0.1);
    --border-station-selected: rgba(79, 70, 229, 0.3);

    /* Filter buttons */
    --filter-btn-opacity-inactive: 0.5;
    --filter-btn-all-bg: rgba(255, 255, 255, 0.08);
    --filter-btn-all-text: var(--text-muted);
    --filter-btn-all-border: var(--border-color);

    /* Manufacturer Badges */
    --style-default-bg: rgba(79, 70, 229, 0.15);
    --style-default-text: #818cf8;
    --style-default-border: rgba(79, 70, 229, 0.3);
    --style-ft-bg: rgba(59, 130, 246, 0.15);
    --style-ft-text: #60a5fa;
    --style-ft-border: rgba(59, 130, 246, 0.3);
    --style-avante-bg: rgba(6, 182, 212, 0.15);
    --style-avante-text: #22d3ee;
    --style-avante-border: rgba(6, 182, 212, 0.3);
    --style-kone-bg: rgba(16, 185, 129, 0.15);
    --style-kone-text: #34d399;
    --style-kone-border: rgba(16, 185, 129, 0.3);
    --style-thyssen-bg: rgba(2, 132, 199, 0.16);
    --style-thyssen-text: #38bdf8;
    --style-thyssen-border: rgba(56, 189, 248, 0.35);
    --style-thyssen-events-bg: rgba(14, 165, 233, 0.12);
    --style-thyssen-events-text: #7dd3fc;
    --style-thyssen-events-border: rgba(125, 211, 252, 0.3);

    /* Code block */
    --code-bg: rgba(0,0,0,0.2);
    --code-bg-active: rgba(0,0,0,0.4);
    --code-text: #a5b4fc;
    --code-shadow: 0 0 15px rgba(165, 180, 252, 0.4);

    /* Secondary button styling */
    --bg-btn-secondary: var(--bg-card);
    --text-btn-secondary: var(--text-main);
    --border-btn-secondary: var(--border-color);
    --bg-btn-secondary-hover: rgba(255, 255, 255, 0.05);

    /* PWA install banner */
    --bg-pwa-banner: rgba(30, 41, 59, 0.85);
    --border-pwa-banner: rgba(255, 255, 255, 0.12);
    --text-pwa-banner-title: #ffffff;
    --text-pwa-banner-desc: #cbd5e1;
    --bg-pwa-btn-close: rgba(255, 255, 255, 0.1);
    --text-pwa-btn-close: #ffffff;
    --bg-pwa-btn-close-hover: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   MODO AMOLED (NEGRO PURO - ESPECIAL TÚNELES Y TRABAJOS NOCTURNOS)
   ========================================================================== */
html.theme-amoled,
body.theme-amoled {
    --bg-body: #000000 !important;
    --bg-card: #08080a !important;
    --bg-header: #121216 !important;
    --bg-input: #040406 !important;
    --bg-glass: rgba(10, 10, 14, 0.95) !important;
    --bg-drawer: rgba(6, 6, 8, 0.98) !important;
    --bg-overlay: rgba(0, 0, 0, 0.88) !important;
    --bg-line-filters: rgba(15, 15, 20, 0.85) !important;
    --border-color: #202028 !important;
    --border-color-light: #2c2c36 !important;
    --text-muted: #94a3b8 !important;
}

html.theme-amoled .nav-bar {
    background-color: rgba(0, 0, 0, 0.95) !important;
    border-bottom: 1px solid #1a1a22 !important;
}

html.theme-amoled .form-tarjeta,
html.theme-amoled .list-item,
html.theme-amoled .contact-card,
html.theme-amoled .menu-drawer,
html.theme-amoled .drawer-content {
    background-color: #070709 !important;
    border-color: #1a1a24 !important;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

body {
    font-family: var(--font-stack);
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding-bottom: 90px;
    line-height: 1.5;
}

/* ==========================================================================
   GLASSMORPHIC NAVIGATION
   ========================================================================== */
.nav-bar {
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    height: var(--nav-height);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.nav-container {
    max-width: 800px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
}

.nav-brand {
    font-size: 24px;
    font-weight: 800;
    text-decoration: none;
    color: var(--text-main);
    background: var(--primary-gradient);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: var(--shadow-brand);
}

.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-grow: 1;
    justify-content: center;
    margin: 0 15px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link i {
    font-size: 14px;
}

.nav-link:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.nav-link.active {
    color: var(--text-on-primary);
    background: var(--primary-gradient);
    box-shadow: var(--shadow-primary);
}

.nav-logout {
    color: var(--danger);
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    text-decoration: none;
    flex-shrink: 0; /* Prevents squishing and keeps it perfectly square */
}

.nav-logout:hover {
    background: var(--danger);
    color: var(--text-on-primary);
}

@media (max-width: 600px) {
    .nav-link span {
        display: none; /* Icon-only on small mobiles for clean view */
    }
    .nav-link {
        padding: 10px;
    }
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 15px;
}

.project-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.header-logo {
    height: 38px;
    width: auto;
    filter: var(--logo-shadow);
}

/* ==========================================================================
   LOGIN SCREEN
   ========================================================================== */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-body);
}

.login-card {
    padding: 40px 30px;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.login-header-custom {
    text-align: center;
    margin-bottom: 30px;
}

.login-main-image {
    max-width: 260px;
    height: auto;
    border-radius: 12px;
    margin-bottom: 20px;
}

.login-brand-logo {
    font-size: 48px;
    font-weight: 900;
    color: var(--text-on-primary);
    text-shadow: var(--shadow-brand-text);
    margin-bottom: 10px;
}

.login-text-por {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.login-logo-ugt {
    height: 18px;
    width: auto;
    opacity: 0.8;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 25px;
    color: var(--text-main);
}

.input-with-icon {
    position: relative;
}

.input-with-icon i,
.input-with-icon iconify-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-with-icon input {
    padding-left: 40px !important;
}

/* ==========================================================================
   FORMS & INPUTS
   ========================================================================== */
.form-group {
    margin-bottom: 22px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-wrapper {
    position: sticky;
    top: var(--nav-height);
    z-index: 900;
    background-color: var(--bg-body);
    height: var(--search-height);
    padding: 12px 0;
}

.search-input {
    width: 100%;
    height: 46px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 15px;
    outline: none;
    font-family: inherit;
    box-shadow: var(--shadow-input);
}

.search-input:focus {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-input-focus), var(--shadow-input);
}

/* ==========================================================================
   LISTS & ACCORDIONS (PREMIUM LOOK)
   ========================================================================== */
.list-group {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 25px;
    overflow: visible; /* Allowed visible globally so sticky headers work on all directory/code/error lists */
}

/* Clean border-radius clipping for sticky headers and items when parent overflow is visible */
.list-group > .category-group:first-child > .list-header,
.list-group > .list-item:first-child,
.list-group > a.list-item:first-child {
    border-top-left-radius: 11px;
    border-top-right-radius: 11px;
}

.list-group > .category-group:last-child > .list-item:last-child,
.list-group > .list-item:last-child,
.list-group > a.list-item:last-child {
    border-bottom-left-radius: 11px;
    border-bottom-right-radius: 11px;
}

.list-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    justify-content: space-between;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background: var(--bg-hover-subtle);
    transform: translateX(4px);
}

.list-header {
    background-color: var(--bg-header);
    color: var(--text-main);
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: calc(var(--nav-height) + var(--search-height));
    z-index: 800;
}

.item-code {
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-family: monospace;
    font-size: 14px;
    margin-right: 15px;
    min-width: 55px;
    text-align: center;
}

.item-text {
    flex-grow: 1;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
}

.item-text iconify-icon, .item-text i {
    width: 1.4rem;
    height: 1.4rem;
    font-size: 1.4rem;
    margin-right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(1.5px);
}

/* Manufacturer Styles */
.style-default { background-color: var(--style-default-bg); color: var(--style-default-text); border: 1px solid var(--style-default-border); }
.style-ft { background-color: var(--style-ft-bg); color: var(--style-ft-text); border: 1px solid var(--style-ft-border); }
.style-avante { background-color: var(--style-avante-bg); color: var(--style-avante-text); border: 1px solid var(--style-avante-border); }
.style-kone { background-color: var(--style-kone-bg); color: var(--style-kone-text); border: 1px solid var(--style-kone-border); }
.style-thyssen { background-color: var(--style-thyssen-bg); color: var(--style-thyssen-text); border: 1px solid var(--style-thyssen-border); font-weight: 700; }
.style-thyssen-events { background-color: var(--style-thyssen-events-bg); color: var(--style-thyssen-events-text); border: 1px solid var(--style-thyssen-events-border); font-weight: 600; }

/* Alias / Nombres vulgares de componentes */
.component-alias {
    font-size: 0.82rem;
    color: var(--text-alias);
    margin-top: 4px;
    font-style: normal;
    font-weight: 400;
    line-height: 1.3;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    opacity: 0.9;
}
.component-alias::before {
    content: "↳";
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.65;
    margin-right: 2px;
}

/* Details/Accordions */
details {
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

details:last-of-type {
    border-bottom: none;
}

summary {
    padding: 16px 20px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: '\25BC';
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

details[open] summary::after {
    transform: rotate(180deg);
}

.detalle-escalera {
    padding: 20px;
    background: var(--bg-detail);
    border-top: 1px solid var(--border-color);
    font-size: 14px;
}

/* Collapsible form card */
.form-collapse {
    margin-bottom: 25px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 2px dashed var(--primary) !important;
    overflow: hidden;
}

.form-collapse summary {
    background: var(--bg-collapse-summary);
    color: var(--primary-light);
    padding: 16px;
    font-weight: 700;
    font-size: 15px;
    justify-content: center;
    gap: 8px;
}

.form-collapse summary::after {
    display: none;
}

.form-tarjeta {
    padding: 24px;
}

.form-tarjeta h2 {
    color: var(--primary-light);
    text-align: center;
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 20px;
    font-weight: 700;
    text-transform: uppercase;
}

.form-tarjeta label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-top: 12px;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.foto-actual {
    max-width: 100%;
    max-height: 250px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

/* ==========================================================================
   BADGES & CHIPS
   ========================================================================== */
.station-badges {
    display: flex;
    gap: 6px;
}

.badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-esc {
    background: var(--badge-esc-bg);
    color: var(--badge-esc-text);
    border: 1px solid var(--badge-esc-border);
}

.badge-ibt {
    background: var(--badge-ibt-bg);
    color: var(--badge-ibt-text);
    border: 1px solid var(--badge-ibt-border);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    box-shadow: var(--shadow-primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

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

.btn-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

.btn-warning:hover {
    background: var(--warning);
    color: var(--bg-body);
}

/* ==========================================================================
   METRO DIRECTORY (TABS & GRID)
   ========================================================================== */
.directory-tabs-container {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 6px;
    border: 1px solid var(--border-color);
}

.directory-tabs {
    display: flex;
    gap: 4px;
}

.directory-tab-btn {
    flex: 1;
    text-align: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.directory-tab-btn:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.directory-tab-btn.active {
    background: var(--primary-gradient);
    color: var(--text-on-primary);
}

.directory-tab-btn iconify-icon, .directory-tab-btn i {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 1.25rem;
    transform: translateY(1px);
}

@media (max-width: 600px) {
    .directory-tab-btn {
        flex-direction: column;
        gap: 2px;
        font-size: 11px;
        padding: 8px 4px;
    }
    .directory-tab-btn iconify-icon, .directory-tab-btn i {
        width: 1.15rem;
        height: 1.15rem;
        font-size: 1.15rem;
        transform: none;
    }
    .grid-container {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
    }
    .linea-card {
        font-size: 20px !important;
        border-radius: 8px !important;
    }
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 14px;
}

.linea-card {
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 800;
    font-size: 32px;
    border: 3px solid;
    box-shadow: var(--shadow-md);
}

.linea-card:hover {
    transform: scale(1.08);
}

.linea-card-wrapper {
    position: relative;
    width: 100%;
}

.linea-card-edit-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--primary-light);
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
    text-decoration: none;
}

.linea-card-edit-btn:hover {
    transform: scale(1.22);
    background: var(--primary);
    color: #ffffff;
}

/* ==========================================================================
   METRO LINE LAYOUT
   ========================================================================== */
.linea-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

@media (max-width: 768px) {
    .linea-layout {
        grid-template-columns: 1fr;
    }
}

.estaciones-column {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 15px;
    height: fit-content;
}

.order-toggle-container {
    margin-bottom: 12px;
    text-align: right;
}

.order-toggle {
    color: var(--primary-light);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.estaciones-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.estaciones-list::before {
    content: '';
    position: absolute;
    top: 25px;
    bottom: 25px;
    left: 20px;
    width: 10px;
    box-sizing: border-box;
    border-left: 2px solid var(--line-border-color, #ffffff);
    border-right: 2px solid var(--line-border-color, #ffffff);
    background-color: var(--line-color);
    z-index: 1;
}

.estacion-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-station);
    cursor: pointer;
    border: 1px solid transparent;
    position: relative;
}

.estacion-item:hover {
    background: var(--bg-hover-subtle);
}

.estacion-item.selected {
    background: var(--bg-station-selected);
    border-color: var(--border-station-selected);
}

/* Override details elements with .estacion-item class to behave as block dropdowns */
details.estacion-item {
    display: block;
    padding: 0;
}

details.estacion-item:hover {
    background: var(--bg-station);
}

details.estacion-item summary:hover {
    background: var(--bg-hover-subtle);
}

.estacion-marker {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 3px solid var(--line-border-color, #ffffff);
    background-color: var(--line-color);
    margin-right: 12px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    box-shadow: 0 0 6px rgba(0,0,0,0.3);
}

.estacion-nombre {
    font-weight: 600;
    font-size: 14px;
    flex-grow: 1;
}

.estacion-lineas {
    display: flex;
    gap: 4px;
}

.linea-indicator {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    line-height: 1;
    box-sizing: border-box;
}

/* Contacts Layout */
.contactos-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contactos-list {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 20px;
}

.contacto-item {
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.contacto-item:last-child {
    border-bottom: none;
}

.contacto-nombre {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 8px;
    color: var(--text-main);
}

.contacto-item a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-light);
    text-decoration: none;
    margin-bottom: 6px;
    font-size: 14px;
    width: fit-content;
}

.contacto-item a:hover {
    text-decoration: underline;
}

.contacto-item a i {
    color: var(--text-muted);
}

.btn-ver-estacion {
    background: var(--primary-gradient);
    color: var(--text-on-primary) !important;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    display: block !important;
    text-decoration: none !important;
    box-shadow: var(--shadow-primary);
}

.btn-ver-estacion:hover {
    box-shadow: var(--shadow-primary-hover);
}

/* ==========================================================================
   GENERADOR (WIZARD STEPS)
   ========================================================================== */
.step {
    display: none;
}

.step.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

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

.result-container {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 16px;
    text-align: center;
    border: 2px dashed var(--primary);
    box-shadow: var(--shadow-md);
    margin: 20px 0;
}

.final-code {
    display: inline-block;
    font-family: monospace;
    font-size: 44px;
    font-weight: 800;
    color: var(--code-text);
    text-shadow: var(--code-shadow);
    margin: 15px 0;
    letter-spacing: 2px;
    cursor: pointer;
    padding: 12px;
    border-radius: 10px;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
}

.final-code:active {
    transform: scale(0.96);
    background: var(--code-bg-active);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
    font-size: 14px;
}

.summary-label {
    color: var(--text-muted);
}

.summary-val {
    font-weight: 600;
    color: var(--text-main);
    text-align: right;
}

.alert-error {
    background-color: var(--danger-bg);
    color: var(--danger-text);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    border: 1px solid var(--danger-border);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.controls-inline {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Component alias style and mobile hide rule */
.component-alias {
    font-size: 0.85em;
    font-style: italic;
    color: var(--text-alias);
    margin-top: 2px;
}

@media (max-width: 768px) {
    .component-alias {
        display: none !important;
    }
}

/* Style for Iconify SVGs to make them sleek, readable, and premium */
svg.iconify, .iconify, iconify-icon {
    display: inline-block;
    width: 1.15em;
    height: 1.15em;
    vertical-align: -0.2em; /* pulled down slightly for general inline texts */
    color: currentColor;
}

/* Specific adjustments for navbar and buttons */
.nav-link svg.iconify, .nav-link .iconify, .nav-link iconify-icon {
    width: 2.1rem;
    height: 2.1rem;
    font-size: 2.1rem; /* Forces the internal SVG (1em) to scale to 100% of the box */
    margin: 0;
    vertical-align: middle;
    /* Circular border & background */
    padding: 4px;
    border-radius: 50%;
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-subtle);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: content-box;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(1px);
}

.nav-link:hover svg.iconify, .nav-link:hover .iconify, .nav-link:hover iconify-icon {
    border-color: var(--border-icon-hover);
    background: var(--bg-icon-hover);
    color: var(--text-icon-hover);
    transform: translateY(1px) scale(1.1);
    box-shadow: var(--shadow-icon-hover);
}

.nav-link.active svg.iconify, .nav-link.active .iconify, .nav-link.active iconify-icon {
    border-color: var(--border-icon-active);
    background: var(--bg-icon-active);
    color: var(--text-icon-active);
    box-shadow: var(--shadow-icon-active);
}

.btn svg.iconify, .btn .iconify, .btn iconify-icon {
    width: 1.1rem;
    height: 1.1rem;
    font-size: 1.1rem;
    margin: 0;
    vertical-align: middle;
    transform: translateY(1.5px);
}

.line-header-banner svg.iconify, .line-header-banner .iconify, .line-header-banner iconify-icon {
    width: 1.8rem;
    height: 1.8rem;
    font-size: 1.8rem;
    margin: 0;
    vertical-align: middle;
    transform: translateY(1.5px);
}

.nav-logout iconify-icon {
    width: 1.4rem;
    height: 1.4rem;
    font-size: 1.4rem; /* Scales the SVG inside shadow DOM */
    transition: transform 0.2s ease;
}

.nav-logout:hover iconify-icon {
    transform: scale(1.15);
}



/* ==========================================================================
   PWA INSTALL BANNER
   ========================================================================== */
.pwa-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    width: calc(100% - 30px);
    max-width: 500px;
    background: var(--bg-pwa-banner);
    border: 1px solid var(--border-pwa-banner);
    border-radius: 16px;
    padding: 15px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.pwa-banner.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.pwa-banner-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-pwa-banner-title);
}

.pwa-banner-desc {
    font-size: 11px;
    color: var(--text-pwa-banner-desc);
}

.pwa-btn-close {
    background: var(--bg-pwa-btn-close);
    border: none;
    color: var(--text-pwa-btn-close);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.pwa-btn-close:hover {
    background: var(--bg-pwa-btn-close-hover);
}

.pwa-btn-install {
    background: var(--primary-gradient);
    border: none;
    color: var(--text-on-primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-primary);
    transition: transform 0.2s, box-shadow 0.2s;
}

.pwa-btn-install:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-primary-hover);
}



/* ==========================================================================
   HAMBURGER MENU DRAWER & CENTER SHORTCUTS
   ========================================================================= */
.nav-menu-btn {
    color: var(--text-muted);
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-menu-btn:hover {
    color: var(--text-main);
    background: var(--bg-hover-more);
}

.nav-menu-btn iconify-icon {
    width: 1.4rem;
    height: 1.4rem;
    font-size: 1.4rem;
}

/* Shortcuts container */
.nav-shortcuts {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
}

.nav-shortcut {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-subtle);
    flex-shrink: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-shortcut iconify-icon {
    width: 1.4rem;
    height: 1.4rem;
    font-size: 1.4rem;
}

.nav-shortcut:hover {
    border-color: var(--border-icon-hover);
    background: var(--bg-icon-hover);
    color: var(--text-icon-hover);
    transform: scale(1.05);
    box-shadow: var(--shadow-icon-hover);
}

.nav-shortcut.active {
    border-color: transparent;
    background: var(--primary-gradient);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-icon-active);
}

/* Drawer Navigation Styles */
.menu-drawer {
    position: fixed;
    top: 0;
    left: -280px; /* Hidden offscreen by default */
    width: 280px;
    height: 100vh;
    background: var(--bg-drawer);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    z-index: 10000;
    box-shadow: var(--shadow-drawer);
    border-right: 1px solid var(--border-color);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.menu-drawer.open {
    transform: translateX(280px); /* Slide in */
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-overlay);
    backdrop-filter: blur(2px);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.drawer-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.drawer-logo {
    height: 32px;
    width: auto;
}

.drawer-close-btn {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.drawer-close-btn:hover {
    background: var(--bg-hover-more);
}

.drawer-content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.drawer-section {
    margin-bottom: 25px;
}

.drawer-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary-light);
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px;
    margin-bottom: 6px;
    transition: all 0.2s ease;
}

.drawer-link iconify-icon {
    font-size: 1.3rem;
    width: 1.3rem;
    height: 1.3rem;
}

.drawer-link:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.drawer-link.active {
    color: var(--text-on-primary);
    background: var(--primary-gradient);
    border-left: var(--border-drawer-active);
    box-shadow: var(--shadow-drawer-active);
    text-shadow: var(--text-shadow-drawer-active);
    font-weight: var(--font-weight-drawer-active, 600);
}

/* ==========================================================================
   LINE FILTER BUTTONS
   ========================================================================== */
.line-filters {
    background: var(--bg-line-filters);
    border: 1px solid var(--border-line-filters);
}

.filter-btn {
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    height: 34px;
}

.filter-btn-all {
    padding: 0 12px;
}

.filter-btn-all:not(.active) {
    background: var(--filter-btn-all-bg);
    color: var(--filter-btn-all-text);
    border: 1px solid var(--filter-btn-all-border);
}

.filter-btn-all.active {
    background: var(--primary-gradient);
    color: var(--text-on-primary);
    border: 1px solid transparent;
}

.filter-btn[data-line]:not([data-line="all"]) {
    width: 34px;
    padding: 0;
}

/* ==========================================================================
   ESTILOS FORMALES: STEPPER, CABECERAS Y FICHA TÉCNICA
   ========================================================================== */

.stepper-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 8px 0 20px 0;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden; /* Nunca barra de desplazamiento horizontal */
    user-select: none;
}

.stepper-step {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    opacity: 0.55;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    padding: 2px 4px;
    flex-shrink: 0;
}

.stepper-step.active {
    opacity: 1;
}

.stepper-step.completed {
    opacity: 0.9;
}

.stepper-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.stepper-step.active .stepper-num {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.45);
    transform: scale(1.06);
}

.stepper-step.completed .stepper-num {
    background: var(--success);
    color: #ffffff;
}

.stepper-text {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.stepper-step.active .stepper-text {
    color: var(--text-main);
    font-weight: 700;
}

.stepper-step.completed .stepper-text {
    color: var(--text-main);
}

.stepper-text .text-abbr {
    display: none;
}

.stepper-line {
    flex: 1;
    height: 2px;
    background: var(--border-color);
    margin: 0 6px;
    min-width: 6px;
    transition: background 0.3s ease;
}

.stepper-line.completed {
    background: var(--success);
}

.section-title-wrap {
    text-align: center;
    margin-bottom: 20px;
}

.section-formal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 6px 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.section-formal-title i {
    color: var(--primary-light);
}

.section-formal-subtitle {
    display: block;
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* Ficha Formal de Resultado */
.result-container-formal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    margin: 15px 0;
}

.code-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.code-box-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.code-badge-status {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.code-display-wrap {
    text-align: center;
    padding: 10px 0;
}

.final-code-formal {
    display: inline-block;
    font-family: ui-monospace, 'Cascadia Mono', 'SF Mono', Menlo, Consolas, monospace;
    font-size: 42px;
    font-weight: 800;
    color: var(--primary-light);
    background: var(--code-bg);
    border: 2px solid var(--primary);
    padding: 12px 28px;
    border-radius: 12px;
    letter-spacing: 4px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.15);
    transition: all 0.2s ease;
}

.final-code-formal:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(79, 70, 229, 0.3);
    border-color: var(--primary-light);
}

.final-code-formal:active {
    transform: scale(0.97);
}

.copy-feedback-formal {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin: 10px 0 16px 0;
    min-height: 20px;
}

.copy-btn-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.btn-copy-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
}

.summary-formal-card {
    background: var(--bg-hover-subtle);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    margin-top: 15px;
}

.summary-card-header {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.summary-formal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color-light);
    font-size: 13.5px;
}

.summary-formal-row:last-child {
    border-bottom: none;
}

.summary-formal-label {
    color: var(--text-muted);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.summary-formal-val {
    color: var(--text-main);
    text-align: right;
}

@media (max-width: 640px) {
    .stepper-wrapper {
        padding: 8px 6px;
        align-items: flex-start;
        margin: 6px 0 16px 0;
    }

    .stepper-step {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 3px;
        padding: 0;
        flex: 0 0 auto;
        min-width: 36px;
        max-width: 58px;
    }

    .stepper-num {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }

    .stepper-text {
        font-size: 10px;
        line-height: 1.1;
        letter-spacing: -0.2px;
    }

    .stepper-text .text-full {
        display: none;
    }

    .stepper-text .text-abbr {
        display: inline;
    }

    .stepper-line {
        margin: 10px 2px 0 2px;
        min-width: 4px;
    }

    .final-code-formal {
        font-size: 32px;
        padding: 10px 18px;
        letter-spacing: 2px;
    }
    .summary-formal-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    .summary-formal-val {
        text-align: left;
    }
}

.filter-btn:not(.active) {
    opacity: var(--filter-btn-opacity-inactive);
}

.filter-btn.active {
    opacity: 1;
    transform: scale(1.05);
    box-shadow: var(--shadow-primary);
}

/* ==========================================================================
   EXPERIENCIA MÓVIL OPTIMIZADA: ERRORES Y BUSCADOR TÁCTIL
   ========================================================================== */

.search-wrapper-mobile {
    position: sticky;
    top: calc(var(--nav-height) + 4px);
    z-index: 900;
    margin-bottom: 10px;
}

.search-input-inner {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-icon-left {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
    opacity: 0.7;
}

.search-wrapper-mobile .search-input {
    padding-left: 44px;
    padding-right: 42px;
    height: 48px;
    font-size: 16px; /* Evita auto-zoom en iOS */
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.search-clear-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s ease;
}

.search-clear-btn:hover {
    color: var(--text-main);
}

/* Filtros Pills deslizables para móviles */
.mobile-filters-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 10px 0;
    margin-bottom: 8px;
    scrollbar-width: none;
}

.mobile-filters-wrapper::-webkit-scrollbar {
    display: none;
}

.mobile-category-pills {
    display: inline-flex;
    gap: 8px;
    padding: 2px 2px;
    white-space: nowrap;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.category-pill:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.category-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(79, 70, 229, 0.35);
}

.category-pill .pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    display: inline-block;
}

.category-pill.active .pill-dot {
    background: #ffffff;
}

.category-pill .pill-count {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: inherit;
    font-weight: 700;
}

.category-pill:not(.active) .pill-count {
    background: var(--bg-hover);
    color: var(--text-muted);
}

/* Barra de métricas y estado */
.results-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 4px 10px 4px;
    font-size: 12.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color-light);
    margin-bottom: 12px;
}

.filter-status-tag {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-light);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Tarjetas de error con touch target optimizado */
.list-item-touch {
    padding: 13px 16px;
    min-height: 52px;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease;
    display: flex;
    align-items: center;
}

.list-item-touch:active {
    transform: scale(0.985);
    background: var(--bg-hover-more);
}

.item-text-error {
    font-size: 14.5px;
    line-height: 1.35;
    font-weight: 500;
    color: var(--text-main);
    word-break: break-word;
}

.category-header-count {
    font-size: 12px;
    font-weight: 700;
    background: var(--bg-hover-more);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    color: var(--text-muted);
}

/* Botones de acción móvil (Admin) */
.mobile-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
}

.mobile-action-btn.edit-btn {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.mobile-action-btn.delete-btn {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Toast flotante en móvil */
.mobile-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    background: rgba(15, 23, 42, 0.95);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.mobile-toast i {
    color: var(--success);
}

.mobile-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   BUSCADOR UNIVERSAL SPOTLIGHT (MODAL & COMMAND PALETTE)
   ========================================================================== */
.spotlight-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 16px;
    box-sizing: border-box;
}

.spotlight-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spotlight-container {
    width: 100%;
    max-width: 640px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    max-height: calc(88vh - 40px);
    margin-top: 50px;
    overflow: hidden;
    transform: translateY(-16px) scale(0.98);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.spotlight-overlay.active .spotlight-container {
    transform: translateY(0) scale(1);
}

.spotlight-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.spotlight-search-icon {
    font-size: 22px;
    color: var(--primary-light);
    flex-shrink: 0;
}

.spotlight-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    font-size: 16px !important;
    color: var(--text-main) !important;
    font-family: inherit;
}

.spotlight-input::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

.spotlight-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}

.spotlight-kbd {
    display: inline-block;
    padding: 3px 7px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.spotlight-results {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    overscroll-behavior: contain;
}

.spotlight-initial-state {
    padding: 30px 20px;
    text-align: center;
}

.spotlight-hint-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.spotlight-hint-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.spotlight-tag {
    background: rgba(79, 70, 229, 0.12);
    border: 1px solid rgba(79, 70, 229, 0.3);
    color: var(--primary-light);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.spotlight-tag:hover {
    background: rgba(79, 70, 229, 0.25);
    transform: translateY(-1px);
}

.spotlight-hint-shortcuts {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.spotlight-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    padding: 12px 10px 6px;
}

.spotlight-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-main);
    text-decoration: none;
    transition: background-color 0.12s ease;
    cursor: pointer;
    margin-bottom: 4px;
    border-left: 3px solid transparent;
}

.spotlight-item:hover,
.spotlight-item.focused {
    background: rgba(79, 70, 229, 0.15);
    border-left-color: var(--primary-light);
}

.spotlight-item-icon-circle {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: var(--primary-light);
    flex-shrink: 0;
}

.spotlight-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.spotlight-line-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

.spotlight-item-body {
    flex: 1;
    min-width: 0;
}

.spotlight-item-title {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.spotlight-line-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-left-width: 3px;
    border-left-style: solid;
}

.spotlight-item-desc {
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spotlight-code {
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-weight: 700;
}

.spotlight-match {
    background: rgba(245, 158, 11, 0.28);
    color: #fbbf24;
    padding: 0 2px;
    border-radius: 3px;
}

.spotlight-arrow {
    color: var(--text-muted);
    font-size: 16px;
    flex-shrink: 0;
    opacity: 0.6;
}

.spotlight-item-actions,
.contacto-acciones-inline {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.spotlight-action-btn,
.btn-quick-action {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    font-size: 18px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    margin: 0 !important;
    box-sizing: border-box;
    flex-shrink: 0;
}

.spotlight-action-btn iconify-icon,
.btn-quick-action iconify-icon {
    font-size: 18px;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

.spotlight-call,
.btn-quick-call {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.spotlight-copy,
.btn-quick-copy {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.3);
}

.btn-quick-edit {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}

.btn-quick-edit:hover {
    background: rgba(245, 158, 11, 0.25) !important;
    color: #fbbf24 !important;
    border-color: #fbbf24 !important;
}

.btn-quick-delete {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-quick-delete:hover {
    background: rgba(239, 68, 68, 0.25) !important;
    color: #f87171 !important;
    border-color: #f87171 !important;
}

.spotlight-action-btn:hover,
.btn-quick-action:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.2);
}

.spotlight-call:hover,
.btn-quick-call:hover {
    background: rgba(16, 185, 129, 0.25) !important;
    color: #34d399 !important;
    border-color: #34d399 !important;
}

.spotlight-copy:hover,
.btn-quick-copy:hover,
.btn-copy-phone:hover {
    background: rgba(59, 130, 246, 0.25) !important;
    color: #60a5fa !important;
    border-color: #60a5fa !important;
}

.spotlight-copy.copied,
.btn-copy-phone.copied {
    background: rgba(16, 185, 129, 0.25) !important;
    color: #34d399 !important;
    border-color: #34d399 !important;
}

.spotlight-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.1);
}

.spotlight-loading,
.spotlight-empty {
    padding: 36px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.spotlight-empty iconify-icon {
    font-size: 32px;
    color: var(--text-muted);
    opacity: 0.5;
}

.spotlight-spinner {
    font-size: 26px;
    color: var(--primary-light);
    animation: spotlight-spin 0.9s linear infinite;
}

@keyframes spotlight-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Indicador de Modo Offline en Navbar */
.offline-badge {
    position: fixed;
    top: 60px;
    right: 14px;
    z-index: 9998;
    background: #dc2626;
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.45);
    display: none;
    align-items: center;
    gap: 6px;
    animation: offline-pulse 2s infinite ease-in-out;
}

.offline-badge.visible {
    display: inline-flex;
}

@keyframes offline-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(0.97); }
}

/* Ajustes AMOLED para Spotlight */
html.theme-amoled .spotlight-container {
    background: #000000 !important;
    border-color: #1a1a24 !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95), 0 0 0 1px #222230 !important;
}

html.theme-amoled .spotlight-header,
html.theme-amoled .spotlight-footer {
    background: #050508 !important;
    border-color: #1a1a24 !important;
}

html.theme-amoled .spotlight-item:hover,
html.theme-amoled .spotlight-item.focused {
    background: #0e0e16 !important;
}

/* Sticky header scroll offset & spotlight focus highlight */
.contacto-item,
.error-item,
.estacion-item,
#contactos-scroll-target,
[id^="contact-"] {
    scroll-margin-top: calc(var(--nav-height) + 20px);
}

@keyframes contactHighlightPulse {
    0% {
        background-color: rgba(79, 70, 229, 0.28);
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.55);
        border-radius: 8px;
    }
    70% {
        background-color: rgba(79, 70, 229, 0.14);
        box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
        border-radius: 8px;
    }
    100% {
        background-color: transparent;
        box-shadow: none;
    }
}

.contact-highlight-pulse {
    animation: contactHighlightPulse 2.8s ease-out forwards;
    padding-left: 8px !important;
    padding-right: 8px !important;
}

.spotlight-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.spotlight-item-link:hover .spotlight-item-title {
    color: var(--primary-light);
}

.btn-unlink-assoc {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.btn-unlink-assoc:hover {
    background: rgba(239, 68, 68, 0.24);
    border-color: #ef4444;
    color: #fecaca;
}



