:root {
    --bg-base: #0f1219;
    --bg-surface: #1e2330;
    --bg-glass: rgba(30, 35, 48, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: rgba(59, 130, 246, 0.1);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Blueprint CAD colors */
    --cad-line: #60a5fa;
    --cad-fill: #1e293b;
    --cad-hatch: #475569;
    --cad-text: #f1f5f9;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-surface);
    background-image: radial-gradient(circle at top right, rgba(59, 130, 246, 0.1), transparent 400px),
                      radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.05), transparent 400px);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

/* Layout Principal */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 340px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    padding: 2rem;
    gap: 2rem;
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    z-index: 10;
}

.logo-section h1 {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--accent), #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    letter-spacing: -0.05em;
}

.logo-section p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Botones */
.controls-section h3, .stats-section h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.proposals-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn {
    background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border: 1px solid rgba(255,255,255,0.05);
    color: var(--text-primary);
    padding: 1rem 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 4px; height: 100%;
    background: var(--accent);
    transform: scaleY(0);
    transition: transform 0.3s ease;
    transform-origin: bottom;
}

.btn:hover::before {
    transform: scaleY(1);
}

.btn small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 0.4rem;
    font-weight: 400;
}

.btn:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateX(4px);
}

.btn.active {
    background: linear-gradient(145deg, var(--accent), var(--accent-hover));
    color: white;
    border-color: var(--accent-hover);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.25);
}

.btn.active::before {
    transform: scaleY(1);
    background: white;
}

.btn.active small {
    color: rgba(255, 255, 255, 0.8);
}

/* Stats Card */
.stats-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    font-size: 0.95rem;
}

.stat-value.highlight-warn { color: var(--warning); }
.stat-value.highlight-success { color: var(--success); }
.stat-value.highlight-danger { color: var(--danger); }

/* Canvas Area */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #0c1017; /* Más profesional */
    position: relative;
    overflow: hidden;
}

.canvas-header {
    position: absolute;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-glass);
    backdrop-filter: blur(8px);
    padding: 0.75rem 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    z-index: 20;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.canvas-header h2 {
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.svg-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

svg {
    width: 100%;
    height: auto;
    max-height: 90vh; /* Encajar en pantalla */
    drop-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

/* Estilos Arquitectónicos CAD (SVG) */
.cad-wall {
    fill: #111827; /* Muros sólidos muy oscuros */
}

.cad-room-social {
    fill: url(#wood-floor);
    transition: all 0.5s ease;
}

.cad-room-servicio {
    fill: url(#tile-floor);
    transition: all 0.5s ease;
}

.cad-room-intima {
    fill: url(#wood-floor);
    transition: all 0.5s ease;
}

.cad-room-circulacion {
    fill: rgba(30, 41, 59, 0.5); /* Fondo muy sutil */
    transition: all 0.5s ease;
}

.cad-patio {
    fill: url(#grass-pattern);
    opacity: 0.6;
}

.cad-label {
    fill: var(--cad-text);
    font-family: 'Inter', sans-serif;
    pointer-events: none;
    text-shadow: 0px 1px 2px rgba(0,0,0,0.8);
    opacity: 0.85; /* Un poco translúcido para dar jerarquía a líneas */
}
.cad-label.bold {
    font-weight: 500; /* Reducido de 600 a 500 por estilo técnico */
}
.cad-label.small {
    fill: var(--text-secondary);
}

.cad-cota text {
    fill: #94a3b8;
    font-family: 'Inter', monospace;
    font-weight: 500;
    pointer-events: none;
}
.cad-cota line {
    stroke: #64748b;
    stroke-linecap: round;
    stroke-width: 0.012; /* Grosor súper fino CAD (1.2 cm escala real) */
}

.cad-door-arc {
    fill: none;
    stroke: var(--warning);
    stroke-width: 0.015;
    stroke-dasharray: 0.05, 0.05;
}

.cad-door-leaf {
    stroke: var(--warning);
    stroke-width: 0.04;
    stroke-linecap: round;
}

.cad-window {
    fill: none;
    stroke: var(--accent);
    stroke-width: 0.03;
}
.cad-window-glass {
    fill: rgba(59, 130, 246, 0.2);
}
.cad-sno {
    fill: none;
    stroke: #ef4444; 
    stroke-width: 0.02;
}

/* Clases interactivas para mobiliario */
.draggable {
    cursor: grab;
    transition: filter 0.2s ease;
}

.draggable:hover {
    filter: drop-shadow(0 0 0.05px rgba(255,255,255,0.8));
}

.draggable:active {
    cursor: grabbing;
}
.draggable.selected {
    outline: none;
}
.draggable.selected > rect:first-child,
.draggable.selected > circle:first-child {
    stroke-width: 0.03;
    stroke-dasharray: 0.05, 0.05;
}

/* Configuracion de impresion para Exportar PDF */
@media print {
    body { background: #ffffff !important; margin: 0; padding: 0; }
    .sidebar { display: none !important; }
    .app-container { grid-template-columns: 1fr !important; }
    .canvas-area { height: 100vh !important; justify-content: center !important; }
    
    #cad-canvas {
        background: none !important;
        box-shadow: none !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    .cad-wall { fill: #000000 !important; stroke: none !important; }
    .cad-label { fill: #000000 !important; text-shadow: none !important; }
    .cad-label.small { fill: #333333 !important; }
    
    .cad-cota text { fill: #333333 !important; font-weight: bold; }
    .cad-cota line { stroke: #333333 !important; stroke-width: 0.008 !important; }
    
    .draggable.mob { stroke: #000000 !important; stroke-width: 0.012 !important; }
    
    .cad-door-arc { stroke: #666666 !important; stroke-width: 0.008 !important; }
    .cad-door-leaf { stroke: #000000 !important; stroke-width: 0.015 !important; }
    
    .cad-window { stroke: #333333 !important; stroke-width: 0.01 !important; }
    .cad-window-glass { fill: none !important; stroke: #555555 !important; stroke-width: 0.012 !important; }
    
    .cad-room-social, .cad-room-intima, .cad-room-servicio, .cad-room-circulacion { fill: none !important; }
    
    rect[fill="url(#grid)"] { display: none !important; }
}
