/* ===== PALETA CORPORATIVA DE VENEZUELA INSIGHTS ===== */
:root {
    --bg-body: #0b132b; /* Azul Oscuro Noche */
    --bg-card: #1c2541; /* Azul Marino Profundo */
    --bg-card-hover: #232d4d;
    --text-primary: #ffffff; /* Blanco Puro */
    --text-secondary: #9aa8c3; /* Gris Azulado */
    --border-light: rgba(255, 255, 255, 0.08);
    --shadow-card: 0 20px 40px -12px rgba(0, 0, 0, 0.5);
    --radius-card: 24px;
    --radius-btn: 40px;

    /* Acentos de Marca */
    --brand-gold: #f5a623; /* Dorado / Ámbar Insights */
    --brand-gold-hover: #d98e19;
    --blue-accent: #3a86ff; /* Azul Neón Tech */
    --blue-hover: #2563eb;
    --green-accent: #10b981; /* Verde Excelente Señal */
    --red-accent: #ff0055; /* Rojo/Rosa Zonas de Sombra */
    --canvas-bg: #0d1b2a; /* Fondo Técnico del Canvas */

    --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: "Playfair Display", serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 24px 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== MATERIAL ICONS Y ALINEACIÓN ===== */
.material-icons {
    vertical-align: middle;
    font-size: 1.25em;
    line-height: 1;
}

.align-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ===== HEADER ===== */
.header {
    margin-bottom: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.header-left h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.header-left h1 i {
    color: var(--brand-gold);
    font-size: 1.6rem;
}

.header-left p {
    color: var(--text-secondary);
    font-size: 0.98rem;
    margin-top: 4px;
}

.header a {
    color: var(--blue-accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.header a:hover {
    color: var(--brand-gold);
    text-decoration: none;
}

/* ===== LAYOUT PRINCIPAL ===== */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
}

/* ===== CANVAS WRAPPER ===== */
#canvas-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
}

#canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

#canvas-header .controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Botones Corporativos */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-btn);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue-accent), var(--blue-hover));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(58, 134, 255, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
    background: linear-gradient(
        135deg,
        var(--brand-gold),
        var(--brand-gold-hover)
    );
    color: #0b132b;
    font-weight: 700;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 166, 35, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

#canvas-container {
    position: relative;
    background: var(--canvas-bg);
    border-radius: 18px;
    overflow: hidden;
    cursor: grab;
    border: 1px solid var(--border-light);
}

#canvas-container:active {
    cursor: grabbing;
}

#floorPlan {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16/10;
    background: var(--canvas-bg);
}

/* ===== SIDEBAR ===== */
#sidebar {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: 640px;
    overflow-y: auto;
}

#sidebar h3 {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 12px;
}

.metric-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    text-align: center;
}

.metric-card .value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 4px;
}

.metric-card .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sugerencia-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 14px;
    border-radius: 12px;
    border-left: 4px solid var(--brand-gold);
    font-size: 0.88rem;
    margin-top: 10px;
}

.sugerencia-item .coord {
    font-weight: 700;
    color: var(--text-primary);
}

.sugerencia-item .justif {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 2px;
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11, 19, 43, 0.85);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    max-width: 440px;
    width: 100%;
    padding: 32px;
    border-radius: 24px;
    box-shadow: var(--shadow-card);
    animation: modalFadeIn 0.25s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-box h3 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal-box p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.4;
}

.modal-box input,
.modal-box select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    margin-bottom: 14px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
}

.modal-box select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal-box input:focus,
.modal-box select:focus {
    outline: none;
    border-color: var(--brand-gold);
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.2);
}

.modal-box .btn {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    justify-content: center;
    margin-top: 6px;
}

.modal-close {
    float: right;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ===== FOOTER Y LEYENDA ===== */
.footer {
    margin-top: 40px;
    padding: 24px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-light);
}

.footer a {
    color: var(--brand-gold);
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    text-decoration: underline;
}

.legend {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.legend-color.red {
    background: var(--red-accent);
}
.legend-color.green {
    background: var(--green-accent);
}
.legend-color.ap {
    background: var(--blue-accent);
    border-radius: 50%;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    #sidebar {
        max-height: none;
    }
}

@media (max-width: 640px) {
    body {
        padding: 16px 12px;
    }
    .header-left h1 {
        font-size: 1.6rem;
    }
    #canvas-wrapper,
    #sidebar {
        padding: 16px;
    }
}
