/* Reset básico y variables */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --bg-color: #000000;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --accent-color: #10b981;
    --danger-color: #ef4444;
}

body.pixels-body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', 'Roboto', sans-serif;
    overflow: hidden; /* Evitar scroll normal, manejado por canvas */
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar Custom (simplificado para la demo, pero debe integrarse con el de ToolSwift) */
.custom-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--panel-border);
    z-index: 100;
}

.custom-nav a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.custom-nav .nav-links a {
    margin-left: 1.5rem;
}

.custom-nav .nav-links a:hover, .custom-nav .nav-links a.active {
    color: var(--primary-color);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Contenedor Principal */
.pixels-container {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Canvas wrapper */
.canvas-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

.canvas-wrapper:active {
    cursor: grabbing;
}

#pixelCanvas {
    display: block;
    /* La interacción se maneja vía JS para pan & zoom */
}

/* Panel de Control Flotante (Glassmorphism) */
.control-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 320px;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-panel:hover {
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.btn-toggle:hover {
    color: #fff;
}

.control-panel.minimized {
    gap: 0;
    padding: 0.8rem 1.2rem;
    width: 200px;
}

.control-panel.minimized .panel-content {
    display: none;
}

.control-panel.minimized h1, .control-panel.minimized h2 {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
}

.control-panel h1, .control-panel h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
}

.subtitle {
    margin: -0.8rem 0 0 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Color Picker */
.tools-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.color-picker-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
}

#colorPicker {
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
    padding: 0;
}

#colorPicker::-webkit-color-swatch-wrapper {
    padding: 0;
}

#colorPicker::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--panel-border);
}

#colorHex {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
}

/* Estadísticas */
.stats-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
}

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

.stat-item.highlight {
    font-size: 1.1rem;
    color: var(--accent-color);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--panel-border);
}

.hint {
    color: var(--text-muted);
    text-align: right;
    font-size: 0.75rem;
}

/* Botones */
button {
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.btn-primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.23);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--panel-border);
}

.btn-secondary:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--danger-color);
}

/* Controles de Navegación */
.nav-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 20;
}

.nav-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--panel-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--panel-border);
    color: white;
    font-size: 1.2rem;
    padding: 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 768px) {
    .custom-nav {
        padding: 0.8rem 1rem;
    }
    .control-panel {
        top: 10px;
        bottom: auto;
        right: 10px;
        left: auto;
        transform: none;
        width: 280px;
        max-width: 90vw;
        padding: 0.8rem;
    }
    .control-panel.minimized {
        width: 170px;
    }
    .nav-controls {
        bottom: 120px;
        right: 15px;
        z-index: 20;
    }
}

.nav-counter {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 0.95rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    margin-right: 1.5rem;
    white-space: nowrap;
}

.admin-badge {
    background: #ef4444;
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

.admin-confirm-modal {
    background: rgba(18, 18, 18, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    padding: 2rem;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    color: #ffffff;
    transform: scale(0.9);
    animation: scaleUp 0.2s forwards ease-out;
    backdrop-filter: blur(10px);
}

.admin-confirm-modal h3 {
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.4rem;
}

.admin-confirm-modal p {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 1.5rem 0;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-actions button {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s, background 0.2s;
}

.modal-actions button:hover {
    transform: translateY(-2px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleUp {
    to { transform: scale(1); }
}

/* Paleta de colores rápidos */
.color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0.5rem;
}

.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s, border-color 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.active {
    border-color: #ffffff;
    transform: scale(1.15);
    box-shadow: 0 0 8px var(--primary-color);
}

.custom-color-wrapper {
    position: relative;
    width: 30px;
    height: 30px;
}

.color-swatch.custom-trigger {
    background: #1e293b;
    border: 2px dashed #475569;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-swatch.custom-trigger.active {
    border: 2px solid #ffffff;
    background: var(--active-custom-color, #1e293b);
}

#btnDropper.active {
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
    box-shadow: 0 0 8px var(--primary-color);
}


/* ===================== PREMIUM TOGGLE ===================== */
.premium-toggle-group {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(219, 39, 119, 0.1));
    border: 1px solid rgba(167, 139, 250, 0.35);
    border-radius: 10px;
    padding: 0.7rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: all 0.3s;
}

.premium-toggle-group.active {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(219, 39, 119, 0.2));
    border-color: rgba(167, 139, 250, 0.7);
    box-shadow: 0 0 14px rgba(167, 139, 250, 0.3);
}

.premium-toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.premium-toggle-text {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #c4b5fd;
}

.premium-icon {
    font-size: 1.1rem;
    animation: premiumIconFloat 2.5s ease-in-out infinite;
}

@keyframes premiumIconFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-2px) scale(1.15); }
}

.premium-toggle-switch {
    position: relative;
    width: 42px;
    height: 22px;
    flex-shrink: 0;
}

.premium-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.premium-toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.1);
    border-radius: 22px;
    border: 1px solid rgba(167, 139, 250, 0.4);
    transition: background 0.3s;
    cursor: pointer;
}

.premium-toggle-slider::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #94a3b8;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-toggle-switch input:checked + .premium-toggle-slider {
    background: linear-gradient(135deg, #7c3aed, #db2777);
    border-color: #a78bfa;
}

.premium-toggle-switch input:checked + .premium-toggle-slider::before {
    left: calc(100% - 18px);
    background: #fff;
    box-shadow: 0 0 6px rgba(167, 139, 250, 0.8);
}

.premium-price-badge {
    font-size: 0.8rem;
    color: #f0abfc;
    background: rgba(167, 139, 250, 0.12);
    border-radius: 6px;
    padding: 4px 8px;
    text-align: center;
    animation: premiumBadgePulse 2s ease-in-out infinite;
}

@keyframes premiumBadgePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Minimapa flotante (Esquina superior izquierda) */
.minimap-container {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 130px;
    height: 130px;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 4px;
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.6);
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.minimap-container.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

#minimapCanvas {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    display: block;
}

@media (max-width: 768px) {
    .minimap-container {
        top: 15px;
        left: 15px;
        width: 95px;
        height: 95px;
        border-radius: 12px;
        padding: 3px;
    }
}


