:root {
    --primary: #4f46e5;       /* Indigo moderno */
    --primary-dark: #3730a3;
    --accent: #06b6d4;        /* Cyan */
    --bg-body: #f3f4f6;       /* Gris muy claro */
    --surface: #ffffff;
    --text-main: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px;
}

/* Fondo decorativo */
.background-decor {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 300px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    z-index: -1;
    clip-path: polygon(0 0, 100% 0, 100% 70%, 0 100%);
}

.app-wrapper {
    width: 100%;
    max-width: 1400px; /* Más ancho para el mapa */
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Header */
header { text-align: center; color: white; margin-bottom: 10px; }
.logo-area { display: flex; justify-content: center; align-items: center; gap: 15px; margin-bottom: 5px; }
.logo-icon { font-size: 2rem; opacity: 0.9; }
h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -1px; text-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.subtitle { font-size: 1rem; font-weight: 300; opacity: 0.9; }

/* Layout Principal */
.main-grid {
    display: grid;
    grid-template-columns: 350px 1fr; /* Panel izquierdo fijo, derecho flexible */
    gap: 25px;
}
@media (max-width: 900px) { .main-grid { grid-template-columns: 1fr; } }

/* Paneles */
.panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,0.5);
}

.config-panel {
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    scrollbar-width: thin;
}

/* Encabezados de Sección */
.panel-header h2 {
    font-size: 1rem; color: var(--primary); margin-bottom: 15px;
    display: flex; align-items: center; gap: 10px; font-weight: 700; text-transform: uppercase;
}
.separator { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* Inputs */
.input-group { margin-bottom: 12px; }
.row-2-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-light); margin-bottom: 5px; }

input[type="number"], input[type="text"], select {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
    font-family: inherit; font-size: 0.9rem; transition: all 0.2s; background-color: #f9fafb;
}
input:focus, select:focus { outline: none; border-color: var(--primary); background-color: white; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }

/* Inputs de Archivo Personalizados */
.file-input {
    padding: 6px; font-size: 0.8rem; background: white;
}
input[type="file"]::file-selector-button {
    margin-right: 10px; border: none; background: var(--primary); padding: 5px 10px; border-radius: 4px;
    color: #fff; cursor: pointer; transition: background .2s ease-in-out;
}
input[type="file"]::file-selector-button:hover { background: var(--primary-dark); }

/* Inputs de Color */
.color-input {
    width: 100%; height: 36px; padding: 2px; cursor: pointer; border-radius: 6px; border: 1px solid var(--border);
}

/* Select */
.select-wrapper { position: relative; }
.select-wrapper i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-light); font-size: 0.7rem; }
select { appearance: none; cursor: pointer; }

/* Botón Principal */
.btn-primary {
    width: 100%; padding: 12px; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white; border: none; border-radius: 8px; font-weight: 600; font-size: 0.95rem; cursor: pointer; margin-top: 15px;
    transition: transform 0.2s, box-shadow 0.2s; display: flex; justify-content: center; align-items: center; gap: 10px;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3); }

/* Columna Derecha */
.right-column { display: flex; flex-direction: column; gap: 20px; min-height: 600px; }

.canvas-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #ffffff; /* Fondo blanco para el canvas limpio */
    padding: 10px;
    position: relative;
    overflow: hidden;
}

.canvas-wrapper {
    width: 100%;
    height: 100%;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#mainCanvas {
    box-shadow: 0 0 15px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
    max-width: 100%;
}

/* Barra de Acciones */
.actions-container {
    display: flex; gap: 20px; justify-content: flex-end; flex-wrap: wrap;
    background: white; padding: 15px; border-radius: var(--radius); box-shadow: var(--shadow);
}
.action-group { display: flex; align-items: center; gap: 10px; }
.group-label { font-size: 0.75rem; font-weight: 700; color: var(--text-light); text-transform: uppercase; margin-right: 5px;}

.btn-secondary {
    background: white; border: 1px solid var(--border); color: var(--text-main); padding: 8px 14px; border-radius: 6px;
    font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 6px;
}
.btn-secondary:hover { background: var(--bg-body); border-color: var(--text-light); color: var(--primary); }

footer { text-align: center; color: var(--text-light); font-size: 0.85rem; margin-top: 20px; padding-bottom: 10px; font-weight: 500; }