body {
    background-color: #0a0e17;
    color: white;
    font-family: 'Segoe UI', system-ui, sans-serif;
    margin: 0;
    padding: 0;
}

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

.header-neon {
    text-align: center;
    padding: clamp(10px, 2vw, 20px);
    border-bottom: 1px solid rgba(0, 242, 255, 0.2);
    flex-shrink: 0;
}

.header-neon h1 {
    margin: 0;
    font-size: clamp(1.2em, 3vw, 1.8em);
    color: #00f2ff;
    text-shadow: 0 0 20px rgba(0, 242, 255, 0.5);
    letter-spacing: clamp(1px, 0.3vw, 3px);
}

.layout-main {
    display: flex;
    flex: 1;
    gap: 0;
    min-height: 0;
}

#side-panel {
    width: clamp(200px, 20vw, 280px);
    min-width: 200px;
    background: rgba(255, 255, 255, 0.03);
    border-right: 1px solid rgba(0, 242, 255, 0.2);
    padding: 15px;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
    flex-shrink: 0;
}

.arbol-wrapper {
    flex: 1;
    overflow: auto;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
}

.tree-container {
    position: relative;
    min-width: 100%;
    min-height: 100%;
}

.lienzo-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-width: 100%;
    min-height: 100%;
    pointer-events: none;
    z-index: 0;
}

.btn-menu-movil {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1200;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    background: rgba(0, 242, 255, 0.1);
    border: 1px solid #00f2ff;
    color: #00f2ff;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1500;
    opacity: 1;
    transition: opacity 0.3s;
}

.drawer-backdrop.oculto {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    .btn-menu-movil {
        display: flex;
    }

    .header-neon {
        padding-left: 56px;
        padding-right: 56px;
    }

    .layout-main {
        flex-direction: column;
    }

    #side-panel {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(82%, 320px);
        max-height: none;
        z-index: 2000;
        background: #0d1220;
        border-right: 1px solid rgba(0, 242, 255, 0.2);
        border-bottom: none;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.6);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        padding-top: 60px;
    }

    #side-panel.abierto {
        transform: translateX(0);
    }
}

#side-panel h3 {
    margin: 0 0 15px 0;
    color: #00f2ff;
    font-size: 1em;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.panel-section {
    margin-bottom: 20px;
}

.panel-section h4 {
    margin: 0 0 8px 0;
    font-size: 0.75em;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-semestre {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 5px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 242, 255, 0.3);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    text-align: left;
    transition: all 0.2s;
}

.btn-semestre:hover {
    background: rgba(0, 242, 255, 0.1);
    border-color: #00f2ff;
}

.btn-semestre.active {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
}

#lista-ramos {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.ramo-panel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.75em;
    transition: all 0.2s;
}

.ramo-panel-item .ramo-nombre {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ramo-panel-item:hover {
    background: rgba(0, 242, 255, 0.1);
}

.ramo-panel-item.aprobado {
    background: rgba(34, 197, 94, 0.15);
    border-left: 3px solid #22c55e;
}

.ramo-panel-item .check {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
}

.ramo-panel-item.aprobado .check {
    background: #22c55e;
    border-color: #22c55e;
}

.leyenda-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75em;
    color: #94a3b8;
    margin-bottom: 5px;
}

.linea-color {
    width: 30px;
    height: 3px;
    border-radius: 2px;
}

.linea-color.pre {
    background: #00f2ff;
    box-shadow: 0 0 6px rgba(0, 242, 255, 0.6);
}

.linea-color.co {
    background: #fbbf24;
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.6);
}

.linea-color.unlock {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

#panel-info {
    box-sizing: border-box;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 90%;
    max-width: 320px;
    max-height: 75vh;
    overflow-y: auto;
    background: rgba(10, 14, 23, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 242, 255, 0.4);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(0, 242, 255, 0.15);
    padding: 15px;
    z-index: 1000;
    transition: all 0.3s ease-in-out;
}

@media (max-width: 768px) {
    #panel-info {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: none;
        max-height: 45vh;
        border-radius: 14px 14px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
    }

    #panel-info.colapsado {
        width: 100%;
    }
}

#panel-info h3 {
    margin: 0 0 10px 0;
    padding-right: 28px;
    font-size: 1rem;
    color: #00f2ff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-toggle-info {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 242, 255, 0.1);
    border: 1px solid rgba(0, 242, 255, 0.4);
    color: #00f2ff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    transition: transform 0.3s ease, background 0.2s;
    z-index: 1;
}

.btn-toggle-info:hover {
    background: rgba(0, 242, 255, 0.25);
}

#panel-info.colapsado {
    width: auto;
    max-width: none;
    padding-bottom: 12px;
}

#panel-info.colapsado #info-detalle {
    display: none;
}

#panel-info.colapsado h3 {
    margin-bottom: 0;
}

#panel-info.colapsado .btn-toggle-info {
    transform: rotate(-90deg);
}

#info-detalle {
    font-size: 0.85rem;
    line-height: 1.5;
    color: #ccc;
}

#info-detalle .info-header {
    color: #00f2ff;
    font-weight: bold;
    font-size: 1.1rem;
}

#info-detalle .info-section {
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 5px;
}

#info-detalle .info-section-title {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

#info-detalle .info-ramo-link {
    color: #a78bfa;
    cursor: pointer;
}

#info-detalle .info-ramo-link:hover {
    text-decoration: underline;
}

.btn-neon-ayuda {
    position: fixed;
    top: 20px;
    right: 20px;
    left: auto;
    bottom: auto;
    background: rgba(0, 242, 255, 0.1);
    border: 1px solid #00f2ff;
    color: #00f2ff;
    padding: 10px 15px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    z-index: 1000;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
    transition: all 0.2s;
}

.btn-neon-ayuda:hover {
    background: #00f2ff;
    color: #000;
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.6);
}

@media (max-width: 768px) {
    .btn-neon-ayuda {
        top: 10px;
        right: 10px;
        font-size: 0.8em;
        padding: 8px 12px;
    }
}

.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal-overlay.oculto {
    opacity: 0;
    pointer-events: none;
}

.modal-contenido {
    background: #0a0e17;
    border: 2px solid #00f2ff;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 0 40px rgba(0, 242, 255, 0.2);
}

.btn-cerrar {
    position: absolute;
    top: 15px; right: 15px;
    background: transparent;
    border: none;
    color: #f87171;
    font-size: 1.2em;
    cursor: pointer;
}
