/* 피보나치 기둥 안정성 시뮬레이터 스타일 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 상단 컨트롤 패널 */
.control-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.control-panel h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 2.2em;
    font-weight: 700;
}

.control-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.control-section {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.control-section h3 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

.control-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap; /* 줄바꿈 허용 */
}

.control-group label {
    min-width: 120px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9em;
    flex-shrink: 0; /* 라벨 크기 고정 */
}

.control-group input[type="number"],
.control-group select {
    flex: 1;
    min-width: 80px; /* 최소 너비 설정 */
    padding: 8px 12px;
    border: 2px solid #bdc3c7;
    border-radius: 6px;
    font-size: 0.9em;
    transition: border-color 0.3s ease;
}

.control-group input[type="number"]:focus,
.control-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.control-group input[type="range"] {
    flex: 1;
    min-width: 100px; /* 슬라이더 최소 너비 */
    height: 6px;
    background: #ecf0f1;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.control-group span {
    min-width: 60px; /* 숫자 표시 영역 최소 너비 증가 */
    max-width: 80px; /* 최대 너비 설정 */
    text-align: center;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9em;
    flex-shrink: 0; /* 숫자 영역 크기 고정 */
    padding: 4px 8px; /* 패딩 추가 */
    background: rgba(52, 152, 219, 0.1); /* 배경색 추가 */
    border-radius: 4px; /* 둥근 모서리 */
}

/* 버튼 그룹 */
.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #bdc3c7);
    color: white;
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.8em;
}

/* 메인 콘텐츠 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    margin-bottom: 20px;
}

/* 캔버스 섹션 */
.canvas-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

#simulation-canvas {
    width: 100%;
    height: 600px;
    border: 2px solid #bdc3c7;
    border-radius: 10px;
    background: #f8f9fa;
    cursor: crosshair;
    display: block;
    margin: 0 auto;
}

.canvas-info {
    text-align: center;
    margin-top: 10px;
    color: #7f8c8d;
    font-size: 0.9em;
}

/* 지표 패널 */
.metrics-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    height: fit-content;
}

.metrics-panel h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3em;
    text-align: center;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.metric-group {
    margin-bottom: 25px;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #ecf0f1;
}

.metric-item:last-child {
    border-bottom: none;
}

.metric-item label {
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9em;
}

.metric-item span {
    font-weight: 700;
    color: #e74c3c;
    font-size: 1.1em;
    background: rgba(231, 76, 60, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

.progress-section {
    margin-bottom: 25px;
}

.progress-section h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1em;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

#progress-text {
    text-align: center;
    display: block;
    font-size: 0.9em;
    color: #7f8c8d;
    font-weight: 500;
}

.sample-results h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1em;
    border-bottom: 1px solid #bdc3c7;
    padding-bottom: 5px;
}

#sample-stats div {
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #2c3e50;
}

#sample-stats span {
    font-weight: 600;
    color: #27ae60;
}

/* 로그 패널 */
.log-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.log-panel h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3em;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.log-container {
    max-height: 200px;
    overflow-y: auto;
    background: #f8f9fa;
    border: 1px solid #bdc3c7;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    line-height: 1.4;
}

.log-entry {
    margin-bottom: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #ecf0f1;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry.info {
    color: #3498db;
}

.log-entry.success {
    color: #27ae60;
}

.log-entry.warning {
    color: #f39c12;
}

.log-entry.error {
    color: #e74c3c;
}

.log-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* 반응형 디자인 */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .metrics-panel {
        order: -1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .control-sections {
        grid-template-columns: 1fr;
    }
    
    .control-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .control-group label {
        min-width: auto;
        width: 100%;
        margin-bottom: 5px;
    }
    
    .control-group input[type="range"],
    .control-group input[type="number"],
    .control-group select {
        width: 100%;
        min-width: auto;
    }
    
    .control-group span {
        align-self: flex-end;
        margin-top: 5px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    #simulation-canvas {
        height: 400px;
    }
}

/* 접근성 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 포커스 표시 */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* 스크롤바 스타일링 */
.log-container::-webkit-scrollbar {
    width: 8px;
}

.log-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}
