/* ========================================
   SHAPE GALLERY - GALERÍA VISUAL DE FORMAS
   Integrado con el diseño actual de QRWeb
   ======================================== */

/* Control group full-width para las formas */
.control-group.full-width {
    grid-column: 1 / -1;
}

/* ========================================
   SHAPE SELECTOR HEADER
   ======================================== */

.shape-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}

.shape-selector-header label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
    margin: 0;
}

body.dark-mode .shape-selector-header {
    border-bottom-color: #4a5568;
}

body.dark-mode .shape-selector-header label {
    color: #d1d5db;
}

.shape-category-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.dark-mode .shape-category-name {
    color: #6b7280;
}

/* ========================================
   CATEGORY TABS
   ======================================== */

.shape-categories-tabs {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scroll-behavior: smooth;
    flex-wrap: wrap;
}

/* Scrollbar para la sección de tabs */
.shape-categories-tabs::-webkit-scrollbar {
    height: 4px;
}

.shape-categories-tabs::-webkit-scrollbar-track {
    background: #f9fafb;
    border-radius: 2px;
}

.shape-categories-tabs::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.shape-categories-tabs::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

body.dark-mode .shape-categories-tabs::-webkit-scrollbar-track {
    background: #2d3748;
}

body.dark-mode .shape-categories-tabs::-webkit-scrollbar-thumb {
    background: #4a5568;
}

body.dark-mode .shape-categories-tabs::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* ========================================
   CATEGORY TAB BUTTONS
   ======================================== */

.shape-category-tab {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    background: #f9fafb;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.shape-category-tab:hover {
    background: #f0f4ff;
    border-color: #667eea;
    color: #667eea;
}

.shape-category-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Dark mode para tabs */
body.dark-mode .shape-category-tab {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

body.dark-mode .shape-category-tab:hover {
    background: #4b5563;
    border-color: #667eea;
    color: #667eea;
}

body.dark-mode .shape-category-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

/* ========================================
   SHAPE GALLERY GRID
   ======================================== */

.shape-gallery {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.8rem;
    max-height: 340px;
    overflow-y: auto;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-bottom: 0.5rem;
}

/* Scrollbar de la galería */
.shape-gallery::-webkit-scrollbar {
    width: 6px;
}

.shape-gallery::-webkit-scrollbar-track {
    background: transparent;
}

.shape-gallery::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.shape-gallery::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

body.dark-mode .shape-gallery {
    background: #2d3748;
    border-color: #4b5563;
}

body.dark-mode .shape-gallery::-webkit-scrollbar-thumb {
    background: #4a5568;
}

body.dark-mode .shape-gallery::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* ========================================
   SHAPE ITEMS (Individual shapes)
   ======================================== */

.shape-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 75px;
    position: relative;
    user-select: none;
}

.shape-item:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.15);
}

.shape-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
}

.shape-item.active:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Dark mode para items */
body.dark-mode .shape-item {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

body.dark-mode .shape-item:hover {
    background: #4b5563;
    border-color: #667eea;
}

body.dark-mode .shape-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

/* ========================================
   SHAPE PREVIEW (Emoji)
   ======================================== */

.shape-preview {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #4a5568;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.05));
}

.shape-item.active .shape-preview {
    color: white;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

body.dark-mode .shape-preview {
    color: #d1d5db;
}

/* ========================================
   SHAPE NAME (Texto)
   ======================================== */

.shape-name {
    font-size: 0.7rem;
    font-weight: 500;
    color: #6b7280;
    text-align: center;
    word-break: break-word;
    line-height: 1.1;
}

.shape-item.active .shape-name {
    color: white;
    font-weight: 600;
}

body.dark-mode .shape-name {
    color: #9ca3af;
}

/* ========================================
   CHECKMARK (Item activo)
   ======================================== */

.shape-item.active::after {
    content: '✓';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

/* ========================================
   ANIMACIONES
   ======================================== */

@keyframes shapeSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.shape-item {
    animation: shapeSlideIn 0.2s ease-out;
}

/* Stagger animation para items */
.shape-item:nth-child(1) { animation-delay: 0.02s; }
.shape-item:nth-child(2) { animation-delay: 0.04s; }
.shape-item:nth-child(3) { animation-delay: 0.06s; }
.shape-item:nth-child(4) { animation-delay: 0.08s; }
.shape-item:nth-child(5) { animation-delay: 0.1s; }
.shape-item:nth-child(n+6) { animation-delay: 0.12s; }

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .shape-gallery {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.6rem;
        max-height: 300px;
    }

    .shape-item {
        min-height: 65px;
        padding: 0.6rem;
    }

    .shape-preview {
        font-size: 20px;
    }

    .shape-name {
        font-size: 0.65rem;
    }

    .shape-category-tab {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .shape-gallery {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        max-height: 280px;
        padding: 0.5rem;
    }

    .shape-item {
        min-height: 60px;
        padding: 0.5rem;
        gap: 0.3rem;
    }

    .shape-preview {
        font-size: 18px;
        width: 28px;
        height: 28px;
    }

    .shape-name {
        font-size: 0.6rem;
    }

    .shape-categories-tabs {
        gap: 0.4rem;
    }

    .shape-category-tab {
        padding: 0.4rem 0.7rem;
        font-size: 0.7rem;
    }
}

/* ========================================
   TRANSICIONES
   ======================================== */

.shape-gallery {
    transition: all 0.3s ease;
}

.shape-gallery.transitioning {
    opacity: 0.6;
}
