/* 헤더 레이아웃 (다크/라이트 공통) */
.header {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 25px 30px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    border-bottom: 2px solid #404040;
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-title {
    flex: 1;
    text-align: left;
}

.header-title h1 {
    font-size: 2.2rem;
    margin: 0 0 8px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    color: #667eea;
}

.header-title p {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0;
    color: #bdc3c7;
}

/* 헤더 우측 컨트롤 */
.header-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

/* 테마 토글 표시기 (자동저장과 동일한 스타일) */
.theme-toggle-indicator {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(241, 196, 15, 0.2);
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(241, 196, 15, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.theme-toggle-indicator:hover {
    background: rgba(241, 196, 15, 0.3);
    border-color: rgba(241, 196, 15, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(241, 196, 15, 0.3);
}

/* 라이트모드일 때 */
.theme-toggle-indicator.light-mode {
    background: rgba(52, 152, 219, 0.2);
    border-color: rgba(52, 152, 219, 0.3);
}

.theme-toggle-indicator.light-mode:hover {
    background: rgba(52, 152, 219, 0.3);
    border-color: rgba(52, 152, 219, 0.5);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.theme-toggle-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f1c40f;
    animation: pulse 2s infinite;
    transition: all 0.3s ease;
}

.theme-toggle-indicator.light-mode .theme-toggle-dot {
    background: #3498db;
}

/* 자동 저장 표시기 */
.auto-save-indicator {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(52, 152, 219, 0.2);
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(52, 152, 219, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.auto-save-indicator:hover {
    background: rgba(52, 152, 219, 0.3);
    border-color: rgba(52, 152, 219, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* 자동저장 ON 상태 */
.auto-save-indicator:not(.disabled) {
    background: rgba(46, 204, 113, 0.2);
    border-color: rgba(46, 204, 113, 0.3);
}

.auto-save-indicator:not(.disabled):hover {
    background: rgba(46, 204, 113, 0.3);
    border-color: rgba(46, 204, 113, 0.5);
}

/* 자동저장 OFF 상태 */
.auto-save-indicator.disabled {
    background: rgba(149, 165, 166, 0.2);
    border-color: rgba(149, 165, 166, 0.3);
}

.auto-save-indicator.disabled:hover {
    background: rgba(149, 165, 166, 0.3);
    border-color: rgba(149, 165, 166, 0.5);
}

.auto-save-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2ecc71;
    animation: pulse 2s infinite;
    transition: all 0.3s ease;
}

.auto-save-indicator.disabled .auto-save-dot {
    background: #95a5a6;
    animation: none;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.3); }
    100% { opacity: 1; transform: scale(1); }
}

/* 저장 드롭다운 */
.save-dropdown {
    position: relative;
}

.save-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: linear-gradient(135deg, #2d2d30 0%, #3a3a3d 100%);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    padding: 15px;
    min-width: 220px;
    display: none;
    z-index: 1000;
    border: 2px solid #404040;
}

.save-menu.show {
    display: block;
    animation: dropdownSlide 0.3s ease-out;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.save-menu button {
    width: 100%;
    padding: 10px 15px;
    margin: 4px 0;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #3a3a3d 0%, #4a4a4d 100%);
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-align: left;
    border: 2px solid transparent;
}

.save-menu button:hover {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    transform: translateX(5px);
    border-color: rgba(52, 152, 219, 0.5);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.save-menu .save-version-input {
    width: 100%;
    padding: 10px 12px;
    margin: 8px 0 12px 0;
    border: 2px solid #555;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    color: #e0e0e0;
    background: #2d2d30;
    transition: all 0.3s ease;
}

.save-menu .save-version-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    background: #1e1e1e;
}

.save-menu .save-version-input::placeholder {
    color: #7f8c8d;
}

.save-menu hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #555 50%, transparent 100%);
    margin: 12px 0;
}

/* 메인 버튼들 */
.data-btn {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.2) 0%, rgba(41, 128, 185, 0.2) 100%);
    border: 2px solid rgba(52, 152, 219, 0.4);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    white-space: nowrap;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.data-btn:hover {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.4) 0%, rgba(41, 128, 185, 0.4) 100%);
    border-color: rgba(52, 152, 219, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}

.save-btn {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.2) 0%, rgba(39, 174, 96, 0.2) 100%);
    border-color: rgba(46, 204, 113, 0.4);
}

.save-btn:hover {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.4) 0%, rgba(39, 174, 96, 0.4) 100%);
    border-color: rgba(46, 204, 113, 0.7);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.3);
}

.quick-save-btn {
    background: linear-gradient(135deg, rgba(52, 73, 94, 0.3) 0%, rgba(44, 62, 80, 0.3) 100%);
    border-color: rgba(52, 73, 94, 0.5);
}

.quick-save-btn:hover {
    background: linear-gradient(135deg, rgba(52, 73, 94, 0.5) 0%, rgba(44, 62, 80, 0.5) 100%);
    border-color: rgba(52, 73, 94, 0.8);
    box-shadow: 0 6px 20px rgba(52, 73, 94, 0.3);
}

/* 테마 토글 버튼 */
.theme-toggle-btn {
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.2) 0%, rgba(243, 156, 18, 0.2) 100%);
    border-color: rgba(241, 196, 15, 0.4);
    padding: 10px 12px;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.theme-toggle-btn:hover {
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.4) 0%, rgba(243, 156, 18, 0.4) 100%);
    border-color: rgba(241, 196, 15, 0.7);
    box-shadow: 0 6px 20px rgba(241, 196, 15, 0.3);
}

/* 저장 파일 모달 */
.save-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.save-modal-content {
    background: linear-gradient(135deg, #2d2d30 0%, #3a3a3d 100%);
    padding: 30px;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    max-height: 70vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease-out;
    border: 2px solid #404040;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.save-modal-content h3 {
    margin: 0 0 20px 0;
    color: #e0e0e0;
    text-align: center;
    font-size: 1.5rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.save-file-list {
    max-height: 400px;
    overflow-y: auto;
    border: 2px solid #555;
    border-radius: 10px;
    margin: 15px 0;
    background: #1e1e1e;
}

.save-file-item {
    padding: 15px;
    border-bottom: 1px solid #404040;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: transparent;
}

.save-file-item:hover {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1) 0%, rgba(41, 128, 185, 0.1) 100%);
    transform: translateX(5px);
    border-left: 4px solid #3498db;
}

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

.save-file-name {
    font-weight: bold;
    color: #e0e0e0;
    font-size: 16px;
    margin-bottom: 5px;
}

.save-file-info {
    font-size: 12px;
    color: #95a5a6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.save-file-info button {
    color: #e74c3c;
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.2) 0%, rgba(192, 57, 43, 0.2) 100%);
    border: 1px solid rgba(231, 76, 60, 0.3);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 12px;
}

.save-file-info button:hover {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.4) 0%, rgba(192, 57, 43, 0.4) 100%);
    border-color: rgba(231, 76, 60, 0.6);
    transform: scale(1.1);
    color: white;
}

/* 라이트 테마용 모달 (body에 light-theme 클래스가 있을 때) */
body.light-theme .save-modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-color: #dee2e6;
}

body.light-theme .save-modal-content h3 {
    color: #495057;
}

body.light-theme .save-file-list {
    background: #ffffff;
    border-color: #dee2e6;
}

body.light-theme .save-file-item {
    border-bottom-color: #dee2e6;
}

body.light-theme .save-file-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-left-color: #667eea;
}

body.light-theme .save-file-name {
    color: #495057;
}

body.light-theme .save-file-info {
    color: #6c757d;
}

body.light-theme .save-menu {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-color: #dee2e6;
}

body.light-theme .save-menu button {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
}

body.light-theme .save-menu button:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

body.light-theme .save-menu .save-version-input {
    background: #ffffff;
    border-color: #dee2e6;
    color: #495057;
}

body.light-theme .save-menu .save-version-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: #ffffff;
}

body.light-theme .save-menu hr {
    background: linear-gradient(90deg, transparent 0%, #dee2e6 50%, transparent 100%);
}

/* 반응형 디자인 */
@media (max-width: 1200px) {
    .header-main {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .header-title {
        text-align: center;
    }
    
    .header-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .save-menu {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (max-width: 768px) {
    .header {
        padding: 20px;
    }
    
    .header-title h1 {
        font-size: 1.8rem;
    }
    
    .header-title p {
        font-size: 0.9rem;
    }
    
    .header-controls {
        gap: 8px;
    }
    
    .data-btn {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    .auto-save-indicator,
    .theme-toggle-indicator {
        font-size: 11px;
        padding: 6px 12px;
    }
    
    .save-modal-content {
        padding: 20px;
        width: 95%;
    }
}

/* 알림 스타일 */
.notification {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-left: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.notification-success {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.9) 0%, rgba(39, 174, 96, 0.9) 100%) !important;
    border-left-color: #2ecc71;
}

.notification-error {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.9) 0%, rgba(192, 57, 43, 0.9) 100%) !important;
    border-left-color: #e74c3c;
}

.notification-info {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.9) 0%, rgba(155, 89, 182, 0.9) 100%) !important;
    border-left-color: #3498db;
}