:root {
    --bg-color: #f1f5f9;
    --sidebar-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #e2e8f0;
    --secondary-hover: #cbd5e1;
    --success: #10b981;
    --success-hover: #059669;
    --warning: #f59e0b;
    --warning-hover: #d97706;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 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;
}

/* Estilos globales limitados a nuestro contenedor */
.formacion-frontend-wrap {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    z-index: 99999;
    overflow: hidden;
}

.formacion-frontend-wrap * {
    box-sizing: border-box;
}

/* Topbar horizontal (como QTabWidget en Python) */
.plataforma-topbar {
    display: flex;
    align-items: center;
    background: #0f172a;
    padding: 0 16px;
    border-bottom: 2px solid #3b82f6;
    height: 50px;
    flex-shrink: 0;
    z-index: 100;
    gap: 8px;
}

.topbar-brand {
    font-size: 1rem;
    font-weight: 800;
    color: #38bdf8;
    white-space: nowrap;
    margin-right: 12px;
    padding-right: 12px;
    border-right: 1px solid #1e293b;
}

.topbar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: row;
    flex: 1;
    height: 100%;
    gap: 2px;
    align-items: flex-end;
}

.topbar-menu li {
    height: 100%;
    display: flex;
    align-items: flex-end;
}

.topbar-menu .nav-link {
    display: flex;
    align-items: center;
    padding: 8px 18px;
    color: #94a3b8;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    border-radius: 8px 8px 0 0;
    background: #1e293b;
    height: 40px;
    white-space: nowrap;
}

.topbar-menu .nav-link:hover {
    background: #334155;
    color: #f8fafc;
}

.topbar-menu .nav-link.active {
    background: #3b82f6;
    color: white;
}

.btn-logout-top {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    background: #ef4444;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    transition: 0.2s;
    margin-left: auto;
}
.btn-logout-top:hover { background: #dc2626; color: white; }

/* Área Principal */
.plataforma-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: var(--bg-color);
    min-height: 0;
}

/* Panel de datos editables de credencial (como el Panel 2 de Python) */
.datos-cred-panel {
    width: 280px;
    background: white;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 16px;
    gap: 10px;
    flex-shrink: 0;
}

.datos-cred-panel h3 {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-main);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 8px;
}

.dato-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.dato-field label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.dato-field input {
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.88rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background: #f8fafc;
    transition: all 0.2s;
    outline: none;
}

.dato-field input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.tab-pane {
    display: none;
    height: 100%;
    width: 100%;
    flex-direction: column;
    overflow: auto;
}

.tab-pane.active {
    display: flex;
}

.dashboard-header {
    padding: 20px 30px;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #1e293b;
}

.dashboard-header p {
    margin: 5px 0 0 0;
    color: #64748b;
}

/* Ajustes para la app-container existente */
.app-container {
    display: flex;
    flex: 1;
    width: 100%;
    height: calc(100vh - 50px); /* Restar el height del topbar */
    margin: 0;
    min-height: 0;
}



/* Sidebars */
.sidebar-left, .sidebar-right {
    width: 320px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.sidebar-right {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 10px;
}

/* Canvas Area */
.canvas-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
    position: relative;
    padding: 40px;
    overflow-y: auto;
}

.canvas-wrapper {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-bottom: 24px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

#credencial_canvas {
    display: block;
    width: 600px;
    height: 900px;
}

/* Controls */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
}

.modern-select, .modern-file-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: #f8fafc;
    transition: all 0.2s;
    outline: none;
}

.modern-select:focus, .modern-file-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.divider {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: 10px 0;
}

/* Buttons */
.nav-buttons, .action-buttons {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-grow: 1;
    text-align: center;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}
.btn-primary:hover { background-color: var(--primary-hover); }

.btn-secondary {
    background-color: var(--secondary);
    color: var(--text-main);
}
.btn-secondary:hover { background-color: var(--secondary-hover); }

.btn-success {
    background-color: var(--success);
    color: white;
}
.btn-success:hover { background-color: var(--success-hover); }

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

/* Sliders */
.slider-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.slider-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: var(--shadow-sm);
}
input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: var(--secondary);
    border-radius: 2px;
}

/* Color inputs */
.colors-group input[type="color"] {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    background: none;
}
.colors-group input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
.colors-group input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}