/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 500px;
    gap: 30px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* 왼쪽 패널 - 설정 */
.settings-panel {
    padding: 20px 40px 60px 40px;
    overflow-y: auto;
    max-height: 90vh;
}

.settings-panel::-webkit-scrollbar {
    width: 8px;
}

.settings-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.settings-panel::-webkit-scrollbar-thumb {
    background: #1a73e8;
    border-radius: 10px;
}

.settings-panel::-webkit-scrollbar-thumb:hover {
    background: #1557b0;
}

h1 {
    color: #1a73e8;
    font-size: 32px;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 700;
}

h2 {
    color: #1a73e8;
    font-size: 20px;
    margin-bottom: 15px;
    font-weight: 600;
    border-left: 4px solid #1a73e8;
    padding-left: 12px;
}

h3 {
    color: #4285f4;
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: 500;
}

.section {
    background: #f8f9fa;
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 12px;
    border: 1px solid #e8eaed;
}

.section:last-child {
    margin-bottom: 40px;
}

.subsection {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e8eaed;
}

.subsection:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* 폼 그룹 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #5f6368;
    font-weight: 500;
    font-size: 14px;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e8eaed;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

/* 프레임 옵션 */
.frame-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.frame-option {
    cursor: pointer;
    padding: 15px;
    border: 2px solid #e8eaed;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s;
    background: white;
}

.frame-option:hover {
    border-color: #4285f4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.2);
}

.frame-option.active {
    border-color: #1a73e8;
    background: #e8f0fe;
}

.frame-preview {
    width: 60px;
    height: 60px;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #5f6368;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
}

.frame-none {
    background: #f1f3f4;
}

.frame-rounded {
    background: #e8f0fe;
    border-radius: 12px;
}

.frame-square {
    background: #e8f0fe;
}

.frame-border {
    background: #e8f0fe;
    border: 3px solid #1a73e8;
}

.frame-shadow {
    background: #e8f0fe;
    box-shadow: 0 4px 8px rgba(26, 115, 232, 0.3);
}

.frame-double {
    background: #e8f0fe;
    border: 2px solid #1a73e8;
    box-shadow: inset 0 0 0 2px white, inset 0 0 0 4px #1a73e8;
}

.frame-thick {
    background: #e8f0fe;
    border: 5px solid #1a73e8;
}

.frame-dashed {
    background: #e8f0fe;
    border: 3px dashed #1a73e8;
}

.frame-gradient {
    background: linear-gradient(135deg, #1a73e8 0%, #4285f4 100%);
    color: white;
}

.frame-neon {
    background: #000;
    border: 2px solid #1a73e8;
    box-shadow: 0 0 10px #1a73e8, inset 0 0 10px rgba(26, 115, 232, 0.3);
    color: #1a73e8;
}

.frame-circle {
    background: #e8f0fe;
    border-radius: 50%;
    border: 2px solid #1a73e8;
}

.frame-hexagon {
    background: #e8f0fe;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

/* 패턴 스타일 버튼 */
.pattern-styles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.pattern-custom-btn {
    grid-column: span 2;
}

.corner-square-styles,
.corner-dot-styles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.pattern-btn,
.corner-square-btn,
.corner-dot-btn {
    padding: 10px 15px;
    border: 2px solid #e8eaed;
    border-radius: 8px;
    background: white;
    color: #5f6368;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 500;
}

.pattern-btn:hover,
.corner-square-btn:hover,
.corner-dot-btn:hover {
    border-color: #4285f4;
    color: #1a73e8;
}

.pattern-btn.active,
.corner-square-btn.active,
.corner-dot-btn.active {
    background: #1a73e8;
    border-color: #1a73e8;
    color: white;
}

/* 색상 컨트롤 */
.color-control {
    margin-bottom: 15px;
}

.color-control label {
    display: inline-flex;
    align-items: center;
    margin-right: 20px;
    cursor: pointer;
    color: #5f6368;
    font-size: 14px;
}

.color-control input[type="radio"],
.color-control input[type="checkbox"] {
    margin-right: 6px;
    cursor: pointer;
}

/* 색상 피커 그룹 */
.color-picker-group {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.color-picker-group label {
    color: #5f6368;
    font-size: 14px;
    font-weight: 500;
    min-width: 80px;
}

.color-picker-group input[type="color"] {
    width: 80px;
    height: 50px;
    border: 2px solid #e8eaed;
    border-radius: 8px;
    cursor: pointer;
    padding: 3px;
}

.color-picker-group input[type="text"] {
    width: 100px;
    padding: 10px;
    border: 2px solid #e8eaed;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

/* 그라데이션 피커 */
.gradient-picker-group {
    margin-top: 15px;
}

.gradient-colors {
    display: grid;
    gap: 15px;
    margin-bottom: 15px;
}

.color-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-input-group label {
    min-width: 80px;
    color: #5f6368;
    font-size: 14px;
}

.color-input-group input[type="color"] {
    width: 80px;
    height: 50px;
    border: 2px solid #e8eaed;
    border-radius: 8px;
    cursor: pointer;
    padding: 3px;
}

.color-input-group input[type="text"] {
    width: 100px;
    padding: 10px;
    border: 2px solid #e8eaed;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.gradient-type {
    margin-bottom: 15px;
}

.gradient-rotation {
    margin-top: 10px;
}

.gradient-rotation label {
    display: block;
    margin-bottom: 8px;
    color: #5f6368;
    font-size: 14px;
}

.gradient-rotation input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e8eaed;
    outline: none;
}

.gradient-rotation input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a73e8;
    cursor: pointer;
}

.gradient-rotation input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a73e8;
    cursor: pointer;
    border: none;
}

/* 커스텀 아이콘 업로드 */
.custom-icon-upload {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.custom-icon-upload input[type="file"] {
    display: none;
}

.upload-label {
    padding: 10px 20px;
    background: #1a73e8;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.upload-label:hover {
    background: #1557b0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

.remove-btn {
    padding: 10px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.remove-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.icon-preview {
    width: 80px;
    height: 80px;
    border: 2px dashed #e8eaed;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.icon-preview img {
    max-width: 100%;
    max-height: 100%;
}

/* 로고 업로드 */
.logo-upload {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.logo-upload input[type="file"] {
    display: none;
}

.logo-preview {
    width: 120px;
    height: 120px;
    border: 2px dashed #e8eaed;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    overflow: hidden;
    background: #f8f9fa;
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
}

.logo-size-control {
    margin-top: 15px;
}

.logo-size-control label {
    display: block;
    margin-bottom: 8px;
    color: #5f6368;
    font-size: 14px;
}

.logo-size-control input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e8eaed;
    outline: none;
}

.logo-size-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a73e8;
    cursor: pointer;
}

.logo-size-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a73e8;
    cursor: pointer;
    border: none;
}

/* 오른쪽 패널 - 미리보기 */
.preview-panel {
    background: linear-gradient(135deg, #1a73e8 0%, #4285f4 100%);
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-panel h2 {
    color: white;
    border-left: 4px solid white;
    margin-bottom: 30px;
}

.preview-container {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
    min-height: 400px;
    max-width: 450px;
    width: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#qrPreview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 370px;
    height: 370px;
    max-width: 370px;
    max-height: 370px;
    overflow: hidden;
}

#qrPreview canvas,
#qrPreview svg {
    display: block !important;
    margin: 0 auto !important;
}

/* 다운로드 섹션 */
.download-section {
    display: flex;
    gap: 15px;
}

.download-btn {
    padding: 12px 30px;
    background: white;
    color: #1a73e8;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
}

.download-btn:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* 고급 설정 */
.size-control,
.margin-control,
.size-control-small {
    margin-bottom: 15px;
}

.size-control-small {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e8eaed;
}

.size-control label,
.margin-control label,
.size-control-small label {
    display: block;
    margin-bottom: 8px;
    color: #5f6368;
    font-size: 14px;
}

.size-control input[type="range"],
.margin-control input[type="range"],
.size-control-small input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e8eaed;
    outline: none;
}

.size-control input[type="range"]::-webkit-slider-thumb,
.margin-control input[type="range"]::-webkit-slider-thumb,
.size-control-small input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a73e8;
    cursor: pointer;
}

.size-control input[type="range"]::-moz-range-thumb,
.margin-control input[type="range"]::-moz-range-thumb,
.size-control-small input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a73e8;
    cursor: pointer;
    border: none;
}

.error-correction-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.error-btn {
    padding: 10px 15px;
    border: 2px solid #e8eaed;
    border-radius: 8px;
    background: white;
    color: #5f6368;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
    font-weight: 500;
}

.error-btn:hover {
    border-color: #4285f4;
    color: #1a73e8;
}

.error-btn.active {
    background: #1a73e8;
    border-color: #1a73e8;
    color: white;
}

.help-text {
    font-size: 12px;
    color: #80868b;
    margin: 5px 0 0 0;
    line-height: 1.4;
}

/* 커스텀 입력 그룹 */
.custom-input-group {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border: 2px solid #e8eaed;
    border-radius: 8px;
}

.custom-input-group > label {
    display: block;
    margin-bottom: 8px;
    color: #5f6368;
    font-weight: 500;
    font-size: 14px;
}

.custom-input-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e8eaed;
    border-radius: 8px;
    font-size: 24px;
    text-align: center;
    transition: all 0.3s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.custom-input-group input[type="text"]:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.custom-input-group .help-text {
    margin-top: 8px;
}

/* 코너 모드 선택 */
.corner-mode-select {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.corner-mode-select label {
    display: inline-flex;
    align-items: center;
    margin-right: 20px;
    cursor: pointer;
    color: #5f6368;
    font-size: 14px;
    font-weight: normal;
}

.corner-mode-select input[type="radio"] {
    margin-right: 6px;
    cursor: pointer;
}

/* 코너 입력 모드 */
.corner-input-mode {
    margin-top: 15px;
}

.corner-input-mode > label {
    display: block;
    margin-bottom: 8px;
    color: #5f6368;
    font-weight: 500;
    font-size: 14px;
}

/* 개별 코너 입력 그룹 */
.corner-individual-group {
    margin-bottom: 15px;
}

.corner-individual-group label {
    display: block;
    margin-bottom: 6px;
    color: #5f6368;
    font-size: 13px;
    font-weight: 500;
}

.corner-individual-group input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e8eaed;
    border-radius: 8px;
    font-size: 20px;
    text-align: center;
    transition: all 0.3s;
}

.corner-individual-group input[type="text"]:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

/* 반응형 디자인 */
@media (max-width: 1200px) {
    .container {
        grid-template-columns: 1fr;
        background: transparent;
        box-shadow: none;
        border-radius: 0;
    }

    .settings-panel {
        padding-top: 380px;
        padding-left: 20px;
        padding-right: 20px;
    }

    .preview-panel {
        order: -1;
        padding: 15px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 20px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
    }

    .preview-panel h2 {
        margin-bottom: 10px;
        font-size: 18px;
        width: 100%;
        text-align: left;
    }

    .preview-container {
        padding: 15px;
        min-height: auto;
        margin-bottom: 0;
        flex: 0 0 auto;
        width: 280px;
        height: 280px;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #qrPreview {
        width: 250px;
        height: 250px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    #qrPreview canvas,
    #qrPreview svg {
        display: block !important;
        margin: 0 auto !important;
    }

    .download-section {
        flex-direction: column;
        gap: 10px;
        flex: 0 0 auto;
    }

    .download-btn {
        width: auto;
        padding: 10px 20px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .container {
        background: transparent;
        box-shadow: none;
        border-radius: 0;
    }

    .settings-panel {
        padding: 20px 10px 60px 10px;
    }

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

    .pattern-styles,
    .corner-square-styles,
    .corner-dot-styles {
        grid-template-columns: repeat(2, 1fr);
    }

    .error-correction-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .settings-panel {
        padding-top: 320px;
    }

    .preview-panel {
        padding: 15px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 15px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
    }

    .preview-panel h2 {
        margin-bottom: 10px;
        font-size: 16px;
        width: 100%;
        text-align: left;
    }

    .preview-container {
        padding: 10px;
        min-height: auto;
        margin-bottom: 0;
        flex: 0 0 auto;
        width: 220px;
        height: 220px;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #qrPreview {
        width: 200px;
        height: 200px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    #qrPreview canvas,
    #qrPreview svg {
        display: block !important;
        margin: 0 auto !important;
    }

    .download-section {
        flex-direction: column;
        gap: 8px;
        flex: 0 0 auto;
    }

    .download-btn {
        width: auto;
        padding: 8px 16px;
        font-size: 13px;
    }
}
