/* style.css */
* {margin:0; padding:0; box-sizing:border-box; font-family: 'Arial', sans-serif;}
body, html {width:100%; height:100%; background:#111; color:#fff;}

/* 스크롤바 */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }

/* 로그인 화면 */
.login-container {display:flex; flex-direction:column; align-items:center; justify-content:center; height:100vh; background:linear-gradient(135deg,#0b0b0b,#1a1a1a);}
.login-container h1 {margin-bottom:30px; font-size:2.5rem; letter-spacing:2px;}
.login-container form {display:flex; flex-direction:column; width:300px;}
.login-container input, .login-container select, .login-container button {margin-bottom:15px; padding:10px; border-radius:5px; border:none; font-size:1rem;}
.login-container button {background:#f5a623; color:#111; cursor:pointer; transition:0.3s;}
.login-container button:hover {background:#ffa733;}
.error {color:#ff4d4f; margin-bottom:10px; text-align:center;}

/* 공통 레이아웃 */
.input-container { padding: 40px; max-width: 95%; margin: 0 auto; background: #1a1a1a; min-height: 100vh; }
h2 { font-size: 2.2rem; margin-bottom: 30px; border-left: 6px solid #f5a623; padding-left: 20px; }
.section-box { background: #252525; padding: 25px; border-radius: 12px; margin-bottom: 30px; border: 1px solid #333; }
.section-box h3 { margin-bottom: 20px; color: #f5a623; font-size: 1.4rem; border-bottom: 1px solid #444; padding-bottom: 10px; }

/* 레이아웃/모드 선택 버튼 */
.layout-selector { display: flex; gap: 15px; margin-bottom: 25px; }
.layout-btn { flex: 1; padding: 20px; background: #333; border: 2px solid #444; color: #aaa; cursor: pointer; font-size: 1.1rem; border-radius: 8px; transition: all 0.2s; text-align: center; }
.layout-btn:hover { background: #444; color: #fff; }
.layout-btn.active { border-color: #f5a623; background: #f5a623; color: #000; font-weight: bold; }

/* ZONE & 리스트 스타일 */
.zone-wrapper { background: #202020; border: 1px solid #444; border-radius: 8px; padding: 15px; margin-bottom: 20px; }
.zone-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; font-weight: bold; font-size: 1.1rem; color: #ddd; }
.zone-badge { background: #555; padding: 3px 8px; border-radius: 4px; font-size: 0.8rem; }

.media-item { display: flex; align-items: center; gap: 15px; padding: 15px; background: #303030; margin-bottom: 10px; border-radius: 6px; border-left: 4px solid #f5a623; }
.media-preview { font-size: 1.5rem; color: #f5a623; width: 30px; text-align: center; }
.media-inputs { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.media-controls { display: flex; flex-direction: column; gap: 4px; }

.btn-sm { padding: 6px 12px; font-size: 0.9rem; border: none; border-radius: 4px; cursor: pointer; color: #fff; transition: 0.2s; }
.btn-del { background: #d93025; } .btn-del:hover { background: #ff4d4f; }
.btn-up { background: #444; } .btn-up:hover { background: #555; }
.btn-down { background: #444; } .btn-down:hover { background: #555; }

.btn-add { width: 100%; padding: 12px; background: #333; border: 1px dashed #666; color: #ccc; cursor: pointer; border-radius: 6px; margin-top: 5px; }
.btn-add:hover { background: #444; color: #fff; border-color: #888; }

.bottom-buttons { display: flex; gap: 20px; margin-top: 40px; padding-bottom: 50px; }
.save-btn, .preview-btn { flex: 1; padding: 18px; font-size: 1.2rem; font-weight: bold; border: none; border-radius: 8px; cursor: pointer; }
.save-btn { background: #f5a623; color: #000; }
.preview-btn { background: #444; color: #fff; }

/* 텍스트 모드 관련 */
.type-selector { display: flex; gap: 10px; margin-bottom: 20px; }
.type-label { flex: 1; padding: 15px; background: #333; border: 1px solid #555; text-align: center; cursor: pointer; border-radius: 8px; color: #aaa; font-weight: bold; }
.type-label:hover { background: #444; }
input[name="content_type"] { display: none; }
input[name="content_type"]:checked + .type-label { background: #f5a623; color: #000; border-color: #f5a623; }

/* 미리보기 스타일 */
.preview-container {
    width: 100%; height: 100vh; background: #000;
    display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden;
}
.monitor-wrapper {
    width: 100%; max-width: 100%; aspect-ratio: 16 / 3; 
    display: flex; background: #000; gap: 0; 
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.05);
}
.monitor-screen {
    position: relative; background: #111; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    border-right: 1px solid #222; 
}
.monitor-screen:last-child { border-right: none; }
.media-content { width: 100%; height: 100%; object-fit: fill; }
.text-display-mode {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    padding: 40px; text-align: center; font-weight: bold;
    white-space: pre-wrap; word-break: break-word; line-height: 1.3; overflow: hidden;
}
.text-inner { display: block; width: 100%; }
.preview-controls {
    position: fixed; bottom: 0; left: 0; width: 100%; height: 60px;
    background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; gap: 20px;
    z-index: 1000; border-top: 1px solid #444;
}
.p-btn { padding: 10px 20px; background: #f5a623; border: none; cursor: pointer; border-radius: 4px; font-weight: bold; font-size: 1rem;}
.p-btn:hover { background: #ffa733; }
.p-btn.secondary { background: #444; color: #fff; }

/* 로딩 오버레이 */
.upload-overlay { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.85); z-index:9999; flex-direction:column; align-items:center; justify-content:center; }
.upload-overlay.active { display:flex; }
.spinner { width: 50px; height: 50px; border: 5px solid #333; border-top: 5px solid #f5a623; border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 20px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* =========================================
   📱 모바일(핸드폰) 전용 반응형 스타일
   ========================================= */
@media screen and (max-width: 768px) {
    .input-container { padding: 15px; max-width: 100%; min-height: auto; }
    h2 { font-size: 1.5rem; margin-bottom: 20px; }
    .section-box { padding: 15px; margin-bottom: 20px; }
    .section-box h3 { font-size: 1.2rem; }

    /* 버튼류 크기 확대 */
    .layout-selector { flex-direction: column; gap: 10px; }
    .layout-btn { padding: 15px; font-size: 1rem; width: 100%; }
    .media-item { flex-direction: column; align-items: flex-start; gap: 10px; padding: 15px; }
    .media-preview { display: none; }
    .media-inputs { width: 100%; }
    .media-inputs input[type="file"], .media-inputs input[type="number"] { width: 100%; margin-top: 5px; }
    
    .media-controls { flex-direction: row; width: 100%; justify-content: flex-end; margin-top: 10px; gap: 10px; }
    .btn-sm { padding: 10px 15px; font-size: 1rem; flex: 1; }
    .btn-add { padding: 15px; font-size: 1rem; }
    
    .bottom-buttons { flex-direction: column; gap: 10px; margin-top: 20px; padding-bottom: 80px; }
    .save-btn, .preview-btn { width: 100%; padding: 15px; font-size: 1.1rem; }
    
    .type-selector { flex-direction: column; }
    input[type="color"] { height: 40px; }
    
    /* 미리보기 화면 모바일 대응 */
    .preview-container { height: auto; min-height: 100vh; padding-bottom: 70px; }
    .monitor-wrapper { width: 100%; height: auto; aspect-ratio: 16 / 3; }
}