/* ========================================
   MEJORADO: Marcos, Colores y UI Visual v4.1
   ======================================== */

/* ========================================
   COLOR PREVIEW CIRCLE - Moderno y redondo
   ======================================== */

.color-preview-circle {
    width: 42px;
    height: 42px;
    border-radius: 50% !important;
    border: 3px solid #e2e8f0 !important;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    flex-shrink: 0;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

.color-preview-circle:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
}

body.dark-mode .color-preview-circle {
    border-color: #4b5563 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .color-preview-circle:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
}

/* ========================================
   COLOR CONTROL MODERN - Con preview circles
   ======================================== */

.color-control-modern {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.color-picker-modern {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.color-picker-modern:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.color-picker-modern:active {
    transform: scale(0.95);
}

.color-hex-modern {
    padding: 0.65rem 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #4a5568;
    transition: all 0.2s ease;
    flex: 1;
    max-width: 130px;
    text-transform: uppercase;
    text-align: center;
}

.color-hex-modern:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: #f0f4ff;
}

.color-hex-modern::placeholder {
    color: #cbd5e1;
}

.color-hex-modern:invalid {
    border-color: #ef4444;
}

body.dark-mode .color-picker-modern {
    background: #374151;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .color-picker-modern:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

body.dark-mode .color-hex-modern {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

body.dark-mode .color-hex-modern:focus {
    border-color: #667eea;
    background: #4b5563;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* ========================================
   FRAME SECTION (Full Width Top)
   ======================================== */

.frame-section {
    width: 100%;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
}

body.dark-mode .frame-section {
    border-bottom-color: #4b5563;
}

.frame-section label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
}

body.dark-mode .frame-section label {
    color: #d1d5db;
}

/* ========================================
   FRAME TYPE PREVIEW BUTTONS
   ======================================== */

.frame-types-preview {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.frame-types-preview .frame-type-btn {
    width: 100%;
}

.frame-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
}

.frame-type-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.frame-type-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.frame-preview {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 4px;
    position: relative;
    border: 1px solid #d1d5db;
}

.frame-preview.solid {
    border: 4px solid #4a5568;
}

.frame-preview.double {
    border: 2px solid #4a5568;
    box-shadow: inset 0 0 0 4px white, inset 0 0 0 6px #4a5568;
}

.frame-preview.rounded {
    border: 4px solid #4a5568;
    border-radius: 12px;
}

.frame-preview.shadow {
    border: 2px solid #4a5568;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.frame-label {
    text-align: center;
    word-break: break-word;
    font-size: 0.7rem;
}

body.dark-mode .frame-type-btn {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

body.dark-mode .frame-type-btn:hover {
    border-color: #667eea;
    background: #4b5563;
}

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

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

/* ========================================
   RANGE CONTROL ENHANCED
   ======================================== */

.range-control-enhanced {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.range-control-enhanced input[type="range"] {
    flex: 1;
    min-width: 150px;
    height: 6px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.range-control-enhanced input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: all 0.2s ease;
}

.range-control-enhanced input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.range-control-enhanced input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: all 0.2s ease;
}

.range-control-enhanced input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.range-control-enhanced input[type="number"] {
    width: 60px;
    padding: 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
    text-align: center;
    transition: all 0.2s ease;
}

.range-control-enhanced input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.range-control-enhanced #frame-width-display {
    font-size: 0.9rem;
    font-weight: 600;
    color: #667eea;
    min-width: 40px;
}

body.dark-mode .range-control-enhanced input[type="number"] {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

body.dark-mode .range-control-enhanced input[type="number"]:focus {
    border-color: #667eea;
    background: #4b5563;
}

/* ========================================
   FINDER SHAPES GRID MEJORADO
   ======================================== */

.finder-shapes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.finder-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6b7280;
    position: relative;
    overflow: hidden;
}

.finder-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.2);
}

.finder-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.finder-btn.active::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.finder-btn .icon {
    font-size: 28px;
    display: block;
}

.finder-btn .label {
    text-align: center;
    word-break: break-word;
    font-size: 0.75rem;
}

body.dark-mode .finder-btn {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

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

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

/* ========================================
   FORM SECTION IMPROVEMENTS
   ======================================== */

.form-section {
    padding: 1.5rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.form-section:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.form-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

body.dark-mode .form-section h3 {
    color: #f3f4f6;
}

/* ========================================
   APPEARANCE GRID MEJORADO
   ======================================== */

.appearance-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

body.dark-mode .control-group label {
    color: #d1d5db;
}

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

@media (max-width: 768px) {
    .color-control-enhanced {
        flex-wrap: wrap;
    }

    .frame-types-preview {
        gap: 0.5rem;
        grid-template-columns: repeat(5, 1fr);
    }

    .frame-type-btn {
        padding: 0.6rem 0.4rem;
    }

    .range-control-enhanced {
        flex-wrap: wrap;
    }

    .range-control-enhanced input[type="range"] {
        min-width: 100%;
        order: 1;
    }

    .range-control-enhanced input[type="number"] {
        order: 2;
    }

    .range-control-enhanced #frame-width-display {
        order: 3;
    }

    .appearance-grid {
        grid-template-columns: 1fr;
    }

    .finder-shapes-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
}

@media (max-width: 480px) {
    .color-control-enhanced {
        flex-direction: column;
        align-items: stretch;
    }

    .color-picker-wrapper {
        justify-content: center;
    }

    .color-hex-input {
        min-width: 100%;
    }

    .frame-types-preview {
        gap: 0.4rem;
        grid-template-columns: repeat(5, 1fr);
    }

    .frame-type-btn {
        padding: 0.5rem 0.25rem;
    }

    .frame-label {
        font-size: 0.65rem;
    }

    .appearance-grid {
        grid-template-columns: 1fr;
    }

    .finder-shapes-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-section {
        padding: 1rem;
    }

    .form-section h3 {
        font-size: 0.95rem;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes slideInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.frame-type-btn,
.finder-btn,
.color-picker,
.color-hex-input {
    animation: slideInScale 0.3s ease-out;
}

.frame-type-btn:nth-child(1) { animation-delay: 0.05s; }
.frame-type-btn:nth-child(2) { animation-delay: 0.1s; }
.frame-type-btn:nth-child(3) { animation-delay: 0.15s; }
.frame-type-btn:nth-child(4) { animation-delay: 0.2s; }
.frame-type-btn:nth-child(5) { animation-delay: 0.25s; }

.finder-btn:nth-child(1) { animation-delay: 0.05s; }
.finder-btn:nth-child(2) { animation-delay: 0.1s; }
.finder-btn:nth-child(3) { animation-delay: 0.15s; }
.finder-btn:nth-child(4) { animation-delay: 0.2s; }
.finder-btn:nth-child(5) { animation-delay: 0.25s; }
.finder-btn:nth-child(6) { animation-delay: 0.3s; }
.finder-btn:nth-child(7) { animation-delay: 0.35s; }
