:root {
    /* DARK THEME (Default) */
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --text-light: #ecf0f1;
    --text-dark: #333;
    --text-main: #ecf0f1; /* Nuevo: texto dinámico */
    --bg-dark: #1a1a1a;
    --bg-card: #2d2d2d;
    --bg-input: #333;
    --border-color: #444;
    --success: #2ecc71;
    --danger: #e74c3c;
}

[data-theme="light"] {
    /* LIGHT THEME */
    --primary-color: #ffffff;
    --secondary-color: #f0f2f5;
    --accent-color: #2980b9;
    --text-light: #2c3e50; /* Invertido para sidebar */
    --text-main: #333333;
    --bg-dark: #f4f6f9; /* Fondo principal claro */
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --border-color: #ddd;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* LOGIN SCREEN */
.login-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #2c3e50 0%, #1a1a1a 100%);
    position: relative;
    overflow: hidden;
}

/* Efecto de fondo activo */
.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, transparent 30%, rgba(52, 152, 219, 0.05) 31%, transparent 32%);
    animation: pulseBackground 15s infinite linear;
    pointer-events: none;
}

@keyframes pulseBackground {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.5) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

.login-box {
    background: rgba(30, 30, 30, 0.85); /* Un poco más oscuro */
    backdrop-filter: blur(12px);
    padding: 3.5rem 2.5rem; /* Más padding vertical, menos horizontal */
    border-radius: 20px; /* Bordes más redondeados */
    box-shadow: 0 15px 40px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(255,255,255,0.1);
    width: 420px; /* Un poco más ancho */
    text-align: center;
    z-index: 10;
    transition: transform 0.1s ease;
    position: relative;
    overflow: hidden; /* Para efectos de brillo interno si quisiéramos */
}

/* Línea decorativa superior */
.login-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
}

.login-box h2 {
    margin-bottom: 3rem; 
    color: white; 
    font-weight: 800; 
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-size: 2.2rem;
    text-shadow: 0 0 20px rgba(52, 152, 219, 0.5); /* Brillo en el texto */
}

.form-group {
    position: relative;
    margin-bottom: 2.5rem; 
    text-align: left;
}

/* Estilo "Pestaña" Mejorado */
.form-group label {
    position: absolute;
    top: -12px;
    left: 20px;
    background: linear-gradient(135deg, var(--accent-color), #2980b9); /* Degradado en la etiqueta */
    color: white;
    padding: 3px 12px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
    border-radius: 4px;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    text-transform: uppercase;
}

.form-group input {
    width: 100%;
    padding: 20px 15px; /* Más gordito */
    background-color: rgba(255, 255, 255, 0.05); 
    border: 2px solid rgba(255, 255, 255, 0.08); 
    color: white;
    border-radius: 10px;
    font-size: 1.1rem; /* Texto más grande */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-group input:focus {
    border-color: var(--accent-color);
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.15); /* Glow suave */
    outline: none;
    transform: translateY(-2px); /* Pequeña elevación al escribir */
}

.btn-primary {
    background: linear-gradient(90deg, var(--accent-color) 0%, #2573a7 100%);
    color: white;
    border: none;
    padding: 18px; /* Botón más alto */
    margin-top: 1rem;
    border-radius: 10px;
    cursor: pointer;
    width: 100%;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.btn-primary:hover {
    box-shadow: 0 10px 25px rgba(52, 152, 219, 0.4);
    transform: translateY(-3px) scale(1.02);
    filter: brightness(1.1);
}

/* ... existing code ... */

/* DASHBOARD LAYOUT */
.sidebar {
    width: 250px;
    background-color: #2c3e50; /* Sidebar siempre oscuro se ve mejor profesionalmente, o usa variables */
    display: flex;
    flex-direction: column;
    height: 100vh;
    transition: width 0.3s;
    color: #ecf0f1;
}

[data-theme="light"] .sidebar {
    background-color: #fff;
    border-right: 1px solid #ddd;
    color: #333;
}

.sidebar-header {
    padding: 20px;
    background-color: rgba(0,0,0,0.2); /* Transparente sobre el color base */
    text-align: center;
}

/* ... existing code ... */

.sidebar-menu a {
    display: block;
    padding: 15px 20px;
    color: inherit; /* Heredar del sidebar */
    text-decoration: none;
    transition: background 0.2s;
    border-left: 4px solid transparent;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background-color: rgba(0,0,0,0.1);
    border-left-color: var(--accent-color);
}

.sidebar-footer {
    padding: 15px;
    background-color: rgba(0,0,0,0.1);
    font-size: 0.8rem;
    text-align: center;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background-color: var(--bg-dark);
}

.top-bar {
    background-color: var(--bg-card);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    color: var(--text-main);
}

/* THEME TOGGLE */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    border-radius: 20px;
    cursor: pointer;
    color: var(--text-main);
    margin-right: 15px;
}

/* ... existing code ... */

.card {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Sombra más suave */
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}


/* UTILITIES */
.hidden { display: none !important; }
.badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}
.badge-admin { background-color: var(--danger); }
.badge-dealer { background-color: var(--success); }

/* METADATA EDITOR MODAL STYLES */
.modal-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-search-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-search-content {
    background: var(--bg-card);
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-search-overlay.show .modal-search-content {
    transform: scale(1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.2);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-main);
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--danger);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Metadata Form Grid */
.meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.full-width {
    grid-column: 1 / -1;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.input-modern {
    width: 100%;
    padding: 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-modern:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
    outline: none;
}

textarea.input-modern {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

/* Footer Actions */
.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    background: rgba(0,0,0,0.1);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.05);
}

.btn-primary {
    background: var(--accent-color);
    border: none;
    color: #fff;
    padding: 10px 25px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: filter 0.2s, transform 0.1s;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Buttons inside the grid */
.action-grid-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color); 
    color: var(--text-main);
    cursor: pointer;
    border-radius: 6px;
}
.action-grid-btn:hover {
    border-color: var(--accent-color);
}

