/* =============================================
   📲 INLINE CUSTOM THEME SETTINGS
   ============================================= */

/*
 * 드롭다운 내 인라인 커스텀 테마 설정
 * - 기존 theme-settings 드롭다운과 통합
 * - 컴팩트하고 직관적인 인터페이스
 * - 실시간 미리보기 시스템
 */

/* Panel Structure */
.custom-theme-settings-panel {
    padding: 0;
    background: white;
    border-radius: 0;
}

.custom-theme-settings-panel .theme-settings-header {
    position: relative;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid #e9ecef;
}

/* Dynamic Header with Back Button */
.theme-settings-header {
    position: relative;
    transition: all 0.3s ease;
}

.theme-settings-header.custom-mode .header-content {
    margin-left: 2.5rem; /* 뒤로가기 버튼 공간 확보 */
}

.back-btn {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    z-index: 10;
    display: none; /* 기본적으로 숨김 */
}

.back-btn.show {
    display: block;
}

.back-btn:hover {
    background: #f8f9fa;
    color: #495057;
}

.header-content {
    transition: margin-left 0.3s ease;
}

/* Dark theme support for back button */
body[data-background-color="dark"] .back-btn {
    color: #a0aec0;
}

body[data-background-color="dark"] .back-btn:hover {
    background: #2d3748;
    color: #e2e8f0;
}

.custom-settings-content {
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}


/* Color Controls - Inline Version */
.custom-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.control-row label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-row label i {
    color: #667eea;
    width: 14px;
    font-size: 0.9rem;
}

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

.color-picker-inline {
    width: 40px;
    height: 40px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    background: none;
    flex-shrink: 0;
}

.color-picker-inline:hover {
    border-color: #667eea;
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
}

.color-picker-inline:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

.preset-colors-inline {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    flex: 1;
}

.preset-inline {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid #dee2e6;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.preset-inline:hover {
    transform: scale(1.1);
    border-color: #667eea;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.preset-inline.active {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.preset-inline.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 0.6rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Action Buttons */
.custom-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.custom-actions .btn {
    flex: 1;
    font-size: 0.85rem;
    padding: 0.5rem;
}

/* Dark Theme Support for Inline */
body[data-background-color="dark"] .custom-theme-settings-panel {
    background: #1a202c;
    color: #e2e8f0;
}

body[data-background-color="dark"] .custom-theme-settings-panel .theme-settings-header {
    border-color: #4a5568;
}

body[data-background-color="dark"] .back-btn {
    color: #a0aec0;
}

body[data-background-color="dark"] .back-btn:hover {
    background: #2d3748;
    color: #e2e8f0;
}

body[data-background-color="dark"] .control-row label {
    color: #e2e8f0;
}


body[data-background-color="dark"] .custom-actions {
    border-color: #4a5568;
}

/* Responsive Design for Inline */
@media (max-width: 576px) {
    .color-control-inline {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .color-picker-inline {
        width: 100%;
        height: 35px;
    }

    .preset-colors-inline {
        justify-content: center;
    }
}

/* Animation for Panel Switch */
.theme-settings-scroll {
    transition: all 0.3s ease;
}

.custom-theme-settings-panel {
    transition: all 0.3s ease;
    transform: translateX(0);
}

.custom-theme-settings-panel.slide-in {
    transform: translateX(0);
}

.theme-settings-scroll.slide-out {
    transform: translateX(-100%);
}