/* ========================================
   기본 스타일
======================================== */
body {
    font-family: 'Pretendard', sans-serif;
    background: #1e1e1e;
    color: #eee;
    margin: 0;
    overflow: hidden;
}

#app-wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
    transition: transform 0.3s ease-in-out;
}

/* ========================================
   사이드바
======================================== */
.sidebar {
    width: 500px;
    background: #252526;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #333;
    background: #2d2d2d;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #00ffcc;
}

.save-status {
    font-size: 0.75rem;
    color: #888;
}

.scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 80px;
}

/* ========================================
   섹션 & 블록
======================================== */
.section-group {
    background: #333;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #444;
    position: relative;
}

.section-title {
    font-weight: bold;
    margin-bottom: 10px;
    display: block;
    color: #fff;
    border-bottom: 1px solid #555;
    padding-bottom: 5px;
}

.btn-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px 8px;
    font-size: 0.7rem;
}

.btn-delete:hover {
    background: #ff6666;
}

/* ========================================
   폼 요소
======================================== */
label {
    display: block;
    font-size: 0.85rem;
    color: #aaa;
    margin-top: 10px;
    margin-bottom: 4px;
}

input,
select,
textarea {
    width: 100%;
    background: #1e1e1e;
    border: 1px solid #555;
    color: white;
    padding: 8px;
    border-radius: 4px;
    box-sizing: border-box;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #00ffcc;
    outline: none;
}

textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

/* ========================================
   버튼 스타일
======================================== */
.btn-add {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-bottom: 20px;
}

.btn-add button {
    background: #444;
    color: white;
    border: 1px solid #555;
    padding: 10px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: 0.2s;
}

.btn-add button:hover {
    background: #555;
    border-color: #00ffcc;
    color: #00ffcc;
}

#resetBtn {
    width: 100%;
    padding: 10px;
    background: #333;
    color: #aaa;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 10px;
}

.footer-btns {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.btn-generate {
    flex: 1.2;
    padding: 15px 5px;
    background: #00ffcc;
    color: #000;
    border: none;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
}

.btn-download, .btn-copy {
    flex: 1;
    padding: 15px 0;
    background: #2196F3;
    color: white;
    border: none;
    font-weight: bold;
    cursor: pointer;
    opacity: 0.5;
    transition: 0.3s;
    border-radius: 4px;
}

.btn-download.active, .btn-copy.active { opacity: 1; }
.btn-copy { background: #444; color: #00ffcc; }

/* ========================================
   파일 업로드 (Drop Zone)
======================================== */
.drop-zone {
    width: 100%;
    height: 100px;
    border: 2px dashed #555;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    background-size: cover;
    background-position: center;
    position: relative;
    cursor: pointer;
}

.drop-zone video {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.drop-zone.has-video video { display: block; }
.drop-zone.has-video span { display: none; }

/* ========================================
   미리보기 영역
======================================== */
.preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #111;
}

.guide-box {
    background: #222;
    margin: 20px;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #00ffcc;
}

.code-output {
    flex: 1;
    padding: 20px;
    color: #0f0;
    font-family: 'Courier New', monospace;
    background: transparent;
    border: none;
    resize: none;
}

/* ========================================
   이미지 편집 모달 (팝업창) - PC/모바일 공통
======================================== */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none; /* JS에서 제어 */
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background: #2d2d2d;
    padding: 30px;
    border-radius: 12px;
    width: 360px;
    text-align: center;
    border: 1px solid #444;
}

.crop-container {
    position: relative;
    overflow: hidden;
    width: 300px;
    height: 300px;
    margin: 0 auto;
    background: #000;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.crop-mask {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* ========================================
   모바일 전용 스타일
======================================== */
@media (max-width: 768px) {
    #app-wrapper { width: 200vw; }
    .sidebar, .preview-area { width: 100vw; height: 100vh; padding-bottom: 60px; box-sizing: border-box; }
    
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0; left: 0;
        width: 100%; height: 60px;
        background: #2d2d2d;
        border-top: 1px solid #444;
        z-index: 999;
    }

    .nav-btn { flex: 1; background: transparent; border: none; color: #888; cursor: pointer; }
    .nav-btn.active { color: #00ffcc; border-top: 3px solid #00ffcc; }

    .mobile-hint {
        display: block;
        position: fixed;
        bottom: 70px; left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.7);
        color: #00ffcc;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 0.85rem;
        z-index: 1000;
        animation: blink 2s infinite;
    }
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
