/* VARIABLES DE COLOR Y FUENTE */
:root {
    --top-bar-height: 62px; 
    --color-fondo-principal: #f5f8ff;
    --color-texto-principal: #1F2937;
    --color-activo: #2563EB;
    --fondo-panel: rgba(255, 255, 255, 0.85);
    --fondo-barra-controles: rgba(255, 255, 255, 0.8);
    --fondo-activo-sutil: rgba(59, 130, 246, 0.2);
    --borde-sutil: rgba(0, 0, 0, 0.1);
    --color-icono-capa: #6B7280;
    --color-icono-capa-hover: #1F2937;
}

/* ESTILOS GENERALES DEL BODY */
body {
    font-family: 'Inter', sans-serif;
    overscroll-behavior: none;
    background-color: var(--color-fondo-principal);
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== INICIO: ESTILOS DEL NUEVO MENÚ ===== */
header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    background: rgba(245, 248, 255, 0.5);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(10, 14, 39, 0.08);
    transition: all 0.3s ease;
    height: 80px; /* Altura fija igual que en Symmetry */
    box-sizing: border-box;
}

header.scrolled {
    background: rgba(245, 248, 255, 0.75);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

/* Logo en el header */
header .logo {
    display: block;
    height: 40px;
}

header .logo img {
    height: 100%;
    width: auto;
    object-fit: contain;
}

/* Logo desktop visible por defecto */
header .logo-desktop {
    display: block;
}

/* Logo móvil oculto por defecto */
header .logo-mobile {
    display: none;
}

/* ===== MEDIA QUERY PARA MÓVILES ===== */
@media (max-width: 768px) {
    header {
        padding: 1rem 1.5rem;
        height: 60px; /* Altura reducida en móvil */
    }
    
    header .logo {
        height: 30px;
    }
    
    /* Ocultamos el logo de escritorio */
    header .logo-desktop {
        display: none;
    }

    /* Mostramos el logo de móvil */
    header .logo-mobile {
        display: block;
    }
}

/* Hamburger Button */
.menu-toggle {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    z-index: 1001;
}

.menu-toggle:hover {
    transform: scale(1.08) rotate(5deg);
}

.menu-toggle.active {
    transform: scale(0.95);
}

.hamburger {
    width: 20px;
    height: 2px;
    background: #343434;
    border-radius: 2px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
}

.menu-toggle.active .hamburger:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
    background: linear-gradient(90deg, #fe4382 0%, #fd87eb 100%);
}

.menu-toggle.active .hamburger:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

.menu-toggle.active .hamburger:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
    background: linear-gradient(90deg, #fe4382 0%, #fd87eb 100%);
}

/* Full Screen Menu */
.fullscreen-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #f5f8ff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    z-index: 999;
}

.fullscreen-menu.active {
    opacity: 1;
    visibility: visible;
}

.menu-content {
    text-align: left;
    padding: 2rem;
}

.menu-item {
    overflow: hidden;
    margin-bottom: 1rem;
}

.menu-link {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 300;
    color: #343434;
    text-decoration: none;
    display: inline-block;
    position: relative;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.77, 0, 0.175, 1);
}

.fullscreen-menu.active .menu-link {
    transform: translateY(0);
    opacity: 1;
}

.menu-link:nth-child(1) { transition-delay: 0.1s; }
.menu-link:nth-child(2) { transition-delay: 0.2s; }
.menu-link:nth-child(3) { transition-delay: 0.3s; }
.menu-link:nth-child(4) { transition-delay: 0.4s; }

.menu-number {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: rgba(10, 14, 39, 0.3);
    margin-left: 1rem;
    font-weight: 300;
}

.menu-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #fe4382 0%, #fd87eb 100%);
    transition: width 0.4s ease;
}

.menu-link:hover::after {
    width: 100%;
}

.menu-link:hover {
    background: linear-gradient(90deg, #fe4382 0%, #fd87eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Social Links */
.menu-footer {
    position: absolute;
    bottom: 3rem;
    left: 2rem;
    display: flex;
    gap: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease 0.5s;
}

.fullscreen-menu.active .menu-footer {
    opacity: 1;
    transform: translateY(0);
}

.social-link {
    color: rgba(10, 14, 39, 0.5);
    text-decoration: none;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    position: relative;
}

.social-link::after {
    content: '↗️';
    margin-left: 0.5rem;
    opacity: 0;
    transition: all 0.3s ease;
}

.social-link:hover {
    color: #343434;
}

.social-link:hover::after {
    opacity: 1;
    transform: translate(3px, -3px);
}

/* Animated Background */
.bg-gradient {
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    opacity: 0.1;
    filter: blur(100px);
    pointer-events: none;
    animation: float 8s ease-in-out infinite;
}

.bg-gradient:nth-child(2) {
    top: 60%;
    right: 10%;
    animation-delay: 2s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, 50px) scale(1.1); }
}
/* ===== FIN: ESTILOS DEL NUEVO MENÚ ===== */

/* CONTENEDOR DEL CANVAS */
#canvas-container {
    width: 100%;
    height: calc(100% - var(--top-bar-height));
    cursor: default;
    position: absolute;
    top: var(--top-bar-height);
    left: 0;
}

#main-canvas.draggable { cursor: grab; }
#main-canvas.dragging { cursor: grabbing; }

/* BARRA DE CONTROLES PRINCIPAL (INFERIOR) */
.control-bar {
    background: var(--fondo-barra-controles);
    backdrop-filter: blur(10px);
    border: 1px solid var(--borde-sutil);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    position: fixed;
    bottom: 1rem;
    padding: 0.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 20;
}

.control-bar .control-btn {
    color: var(--color-texto-principal);
    padding: 0.75rem;
    border-radius: 9999px;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
}

.control-bar .control-btn .material-symbols-outlined {
  font-size: 26px;      
  line-height: 1;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ESTILOS PARA ICONOS SVG  */

.control-bar .control-btn img {
    width: 25px;
    height: 25px;
}


.control-bar .control-btn.active img {
    filter: invert(38%) sepia(98%) saturate(2206%) hue-rotate(206deg) brightness(96%) contrast(92%);
}


.control-bar .control-btn:hover:not(:disabled) { background-color: #E5E7EB; }
.control-bar .control-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.control-bar .control-btn.active { color: var(--color-activo); background: var(--fondo-activo-sutil); }

.control-bar .control-btn span { display: none; }
@media (min-width: 768px) { .control-bar .control-btn span { display: inline; } }

.control-bar .divider { width: 1px; height: 2rem; background-color: #D1D5DB; }

/* --- POSICIONAMIENTO DE PANELES --- */
#panels-container {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    display: flex;
    align-items: flex-end; 
    justify-content: center;
    gap: 0.5rem;
    padding-bottom: 5.5rem; 
    pointer-events: none;
    z-index: 30;
}

/* ESTILO BASE PARA PANELES EMERGENTES */
.popup-panel {
    background: #fdfdfd;
    backdrop-filter: blur(12px);
    border: 1px solid var(--borde-sutil);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    transition: opacity 0.3s, transform 0.3s;
    max-height: 80vh;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    border-radius: 0.75rem;
}

.hidden { display: none !important; }

/* --- PANEL DE CAPAS  --- */
#panel-layers {
    position: absolute;
    top: 5.5rem; 
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem;
    width: 260px; 
    align-items: stretch;
    max-height: 400px;
    flex-direction: column;
}

.panel-title {
    font-weight: 600;
    color: var(--color-texto-principal);
    font-size: 0.875rem;
    text-align: center;
}

#layers-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
    width: 100%;
    margin-top: 0.5rem;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    background-color: #F9FAFB;
    border: 1px solid #E5E7EB;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s, border-color 0.2s, opacity 0.2s;
    user-select: none;
}

.layer-item:hover {
    background-color: #f5f8ff;
}

.layer-item.selected {
    background-color: var(--fondo-activo-sutil);
    border-color: var(--color-activo);
    box-shadow: 0 0 0 3px var(--fondo-activo-sutil);
}

.dragging-placeholder {
    height: 2px;
    background-color: var(--color-activo);
    margin: 2px 0; 
    border-radius: 1px;
}

.layer-item.is-dragging {
    opacity: 0.5;
    background: #E0E7FF;
}

/* Estilos de estado de capa */
.layer-item.hidden-layer {
    opacity: 0.6;
}
.layer-item.hidden-layer .layer-name {
    text-decoration: line-through;
}

.layer-item.locked-layer {
    background-color: #F8FAFC;
    cursor: default;
}
.layer-item.locked-layer .layer-name,
.layer-item.locked-layer .layer-preview {
    opacity: 0.7;
}

.layer-preview {
    width: 28px;
    height: 28px;
    object-fit: contain;
    background-color: #E5E7EB;
    border-radius: 0.25rem;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.05);
}

.layer-name {
    flex-grow: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-texto-principal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 0.25rem;
}

.layer-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.layer-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    color: var(--color-icono-capa);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.layer-action-btn:hover {
    background-color: #E5E7EB;
    color: var(--color-icono-capa-hover);
}

.layer-action-btn svg {
    width: 16px;
    height: 16px;
}

.layer-action-btn .material-symbols-outlined {
    font-size: 18px; 
}

/* PANEL DE ACCIONES (EDITAR) */
#panel-actions { 
    padding: 0.5rem; 
    border-radius: 0.75rem; 
    gap: 0.5rem; 
    flex-direction: column; 
}


#panel-actions .control-btn {
    padding: 0.5rem;
    border-radius: 0.5rem;
    background-color: #e5e7eb;
    color: #6b7280;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}


#panel-actions .control-btn:hover:not(:disabled) { 
    background-color: #d1d5db; 
    color: #1f2937;
}


#panel-actions button:disabled { 
    background-color: #94A3B8; 
    opacity: 0.5; 
    cursor: not-allowed; 
}

/* PANEL DE ACCIONES DE COLOR  */
#panel-color-actions {
    padding: 0.5rem;
    border-radius: 0.75rem;
    gap: 0.5rem;
    flex-direction: column;
}

#panel-color-actions .control-btn {
    padding: 0.5rem;
    border-radius: 0.5rem;
    background-color: #e5e7eb;
    color: #6b7280;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#panel-color-actions .control-btn:hover:not(:disabled) {
    background-color: #2764eb;
    color: white;
}

/* PANEL DE COLOR  */
#panel-color {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    max-width: 420px;
    padding: 0.75rem;
}

.color-panel-main-content {
    flex-shrink: 0;
    width: 120px;
    display: flex;
    flex-direction: column;
}

#color-picker-main {
    width: 100%;
    aspect-ratio: 1 / 1;
    position: relative;
    background-image: linear-gradient(to top, rgba(0,0,0,1), transparent), linear-gradient(to right, rgba(255,255,255,1), transparent);
    border-radius: 0.5rem;
    cursor: crosshair;
}

#color-picker-main .pointer {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 9999px;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    transform: translate(-50%, -50%);
    z-index: 10;
}

.color-panel-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.75rem;
    min-width: 0;
}

#hue-slider {
    width: 100%;
    height: 10px;
    background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
    cursor: pointer;
    border-radius: 9999px;
    margin-top: 0;
}

/* --- ALINEACIÓN  --- */

.color-controls-wrapper {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
}

.color-preview-section {
    flex-shrink: 0;
}

#color-preview-circle {
    box-sizing: border-box;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--borde-sutil);
    background-color: #FFF;
}

.color-inputs-section {
    flex-grow: 1;
    min-width: 0;
}

.color-input-group {
    display: none;
    align-items: center;
}

.color-input-group.active {
    display: flex;
    gap: 0.5rem;
}

.input-wrapper {
    position: relative;
    flex: 1;
}

.input-wrapper.hex {
    flex-grow: 1;
}

.input-wrapper input {
    width: 100%;
    text-align: center;
    border: 1px solid #D1D5DB;
    background-color: #F9FAFB;
    border-radius: 0.375rem;
    padding: 0.4rem 0.25rem;
    font-size: 0.8rem;
    color: var(--color-texto-principal);
    -moz-appearance: textfield;
    height: 32px;
    box-sizing: border-box;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--color-activo);
    box-shadow: 0 0 0 2px var(--fondo-activo-sutil);
}

.input-wrapper input::-webkit-outer-spin-button, 
.input-wrapper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-wrapper label {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    font-size: 0.75rem;
    color: #6B7280;
    font-weight: 500;
    text-transform: uppercase;
}

.tool-btn {
    background: none;
    border: 1px solid var(--borde-sutil);
    border-radius: 0.375rem;
    padding: 0.5rem;
    height: 32px;
    width: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-texto-principal);
    transition: background-color 0.2s;
    flex-shrink: 0;
}

/* SECCIÓN DE OPACIDAD  */
#panel-color .opacity-section {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
    margin-top: 1rem; 
}



#panel-color .opacity-section label {
    color: var(--color-texto-principal);
    font-weight: 500;
    flex-shrink: 0;
    font-size: 0.8rem;
}

#panel-color #opacity-value {
    color: var(--color-texto-principal);
    font-weight: 500;
    flex-shrink: 0;
    width: 45px;
    text-align: right;
    font-size: 0.8rem;
}

#opacity-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: #E5E7EB;
    outline: none;
    border-radius: 5px;
    cursor: pointer;
    transition: opacity .2s;
}

#opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--color-activo);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    cursor: pointer;
}

#opacity-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--color-activo);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    cursor: pointer;
}


/* OTROS PANELES INFERIORES */
.popup-panel h3 { font-weight: bold; font-size: 1.125rem; margin-bottom: 1rem; color: var(--color-texto-principal); text-align: center; }
.gallery-grid { display: grid; gap: 0.75rem; overflow-y: auto; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 640px) { .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 768px) { .gallery-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .gallery-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.asset-item { cursor: pointer; transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s; border: 2px solid transparent; position: relative; padding: 0.5rem; border-radius: 0.5rem; background-color: rgba(0, 0, 0, 0.07); }
.asset-item:hover { transform: scale(1.05); background-color: #2764eb; }
.asset-item.selected { border-color: var(--color-activo); box-shadow: 0 0 15px rgba(59, 130, 246, 0.4); }
.asset-item img { width: 100%; height: 100%; object-fit: contain; aspect-ratio: 1 / 1; border-radius: 0.375rem; }

.separator { width: 100%; height: 1px; background-color: #E5E7EB; margin: 0.5rem 0; }
.tool-card { background-color: rgba(0, 0, 0, 0.03); border: 1px solid var(--borde-sutil); padding: 0.75rem; border-radius: 0.5rem; display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.tool-card h4 { color: var(--color-texto-principal); font-weight: 600; font-size: 0.875rem; margin-bottom: 0.25rem; }
.tool-buttons { display: flex; flex-direction: row; gap: 0.25rem; justify-content: center; }
.op-btn { color: var(--color-texto-principal); padding: 0.5rem; border-radius: 0.5rem; display: flex; flex-direction: column; align-items: center; width: 5rem; background: none; border: none; cursor: pointer; gap: 0.25rem; }
.op-btn:hover:not(:disabled) { background-color: #E5E7EB; }
.op-btn span { font-size: 0.75rem; font-weight: 500; }
.pattern-controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; color: var(--color-texto-principal); }
.pattern-controls-grid .grid-header { grid-column: span 1; text-align: center; font-weight: 600; font-size: 0.875rem; color: #6B7280; margin-bottom: 0.25rem; }
.pattern-controls-grid .input-group { display: flex; align-items: center; gap: 0.5rem; }
.pattern-controls-grid label { font-weight: 700; }
.pattern-input { width: 100%; background-color: #F9FAFB; border: 1px solid #D1D5DB; color: var(--color-texto-principal); border-radius: 6px; padding: 4px 8px; text-align: center; font-family: 'Inter', sans-serif; transition: all 0.2s ease; }
.pattern-input:focus { outline: none; border-color: var(--color-activo); box-shadow: 0 0 0 2px var(--fondo-activo-sutil); }
.pattern-input::-webkit-outer-spin-button, .pattern-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pattern-input[type=number] { -moz-appearance: textfield; }

#camera-modal { background-color: rgba(0,0,0,0.9); position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 30; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 1rem; }
#camera-video { width: 100%; max-width: 100%; max-height: 80vh; }
.camera-actions { display: flex; gap: 1rem; margin-top: 1rem; }
.camera-actions button { color: white; font-weight: bold; padding: 1rem; border-radius: 9999px; display: flex; align-items: center; justify-content: center; background: none; border: none; cursor: pointer; }
.camera-actions button i { width: 2rem; height: 2rem; }
#btn-capture { background-color: #e11d48; }
#btn-capture:hover { background-color: #f43f5e; }
#btn-close-camera { background-color: #475569; }
#btn-close-camera:hover { background-color: #64748b; }

/* ETIQUETA DE ROTACIÓN */
#toast-notification {
    position: fixed;
    background-color: #343434;
    color: #e5e7eb;
    /* --- Menos espacio interior --- */
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1001;
    /* --- Texto más pequeño --- */
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    transform: translate(-50%, 0);
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

#toast-notification::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #343434 transparent transparent transparent;
}

#toast-notification.show {
    opacity: 1;
    transform: translate(-50%, -15px); 
}

#selection-box {
            position: absolute;
            border: 1px solid #4f86ff;
            background-color: rgba(79, 134, 255, 0.2);
            z-index: 100;
            pointer-events: none; 
        }
