/* ========================================
   아파트 분양 테마 v3.0
   ======================================== */

:root {
    --apt-primary: #667eea;
    --apt-secondary: #764ba2;
    --apt-text: #333;
    --apt-bg: #f8f9fa;
    --apt-white: #fff;
    --apt-border: #e8eef5;
    --apt-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--apt-bg); color: var(--apt-text); line-height: 1.6; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* Layout */
.apt-wrap { max-width: 970px; margin: 30px auto; padding: 0 15px; display: flex; gap: 30px; }
.apt-sidebar { width: 320px; flex-shrink: 0; }
.apt-main { flex: 1; min-width: 0; }

/* Responsive */
@media (max-width: 820px) {
    .apt-wrap { flex-direction: column; margin: 0; padding: 15px; gap: 20px; }
    .apt-sidebar { width: 100%; display: none; }
    .apt-sidebar.mobile-visible { display: block; }
    .apt-main { width: 100%; }
    body { padding-bottom: 70px; }
}

/* ========== Sidebar ========== */
.apt-sidebar .sticky { position: sticky; top: 20px; }
.sidebar-card { background: var(--apt-white); border-radius: 12px; box-shadow: var(--apt-shadow); overflow: hidden; position: relative; }
.sidebar-header { height: 160px; background: linear-gradient(-45deg, var(--apt-primary), var(--apt-secondary)); background-size: cover; background-position: center; position: relative; }
.sidebar-logo { position: absolute; top: 20px; left: 25px; width: 70px; height: 70px; background: var(--apt-white); border-radius: 50%; box-shadow: 0 4px 12px rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: center; overflow: hidden; font-weight: 700; font-size: 24px; color: var(--apt-primary); }
.sidebar-logo img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-body { padding: 50px 25px 0; }
.sidebar-title { font-size: 13px; font-weight: 600; color: #666; }
.sidebar-name { font-size: 36px; font-weight: 700; margin-top: 5px; line-height: 1.2; }
.sidebar-name .pos { font-size: 16px; font-weight: 500; color: #999; margin-left: 8px; }
.sidebar-addr { font-size: 14px; color: #555; margin-top: 10px; }
.sidebar-phone { display: flex; align-items: center; background: #001b42; color: #fff; border-radius: 8px; margin-top: 20px; height: 48px; cursor: pointer; transition: background 0.2s; }
.sidebar-phone:hover { background: #003366; }
.sidebar-phone .icon { width: 48px; text-align: center; border-right: 1px solid rgba(255,255,255,0.2); font-size: 18px; }
.sidebar-phone .num { flex: 1; text-align: center; font-weight: 700; font-size: 18px; }
.sidebar-info { margin: 25px 0; }
.sidebar-info-row { display: flex; padding: 10px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.sidebar-info-label { width: 55px; color: #999; flex-shrink: 0; }
.sidebar-info-value { flex: 1; color: #333; }
.sidebar-notice { background: #164439; color: #fff; padding: 20px; text-align: center; font-weight: 600; font-size: 14px; line-height: 1.7; white-space: pre-line; border-radius: 0 0 12px 12px; margin-top: 30px; }

/* Action Buttons */
.sidebar-actions { display: flex; gap: 10px; margin-top: 15px; }
.sidebar-actions .btn { flex: 1; height: 48px; border-radius: 8px; border: none; color: #fff; font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; }
@media (max-width: 820px) { .sidebar-actions { display: none; } }

/* ========== Gallery ========== */
.apt-card { background: var(--apt-white); border-radius: 12px; box-shadow: var(--apt-shadow); padding: 20px; margin-bottom: 20px; }
.gallery-list { display: flex; flex-direction: column; gap: 15px; }
.gallery-item { position: relative; }
.gallery-item img { width: 100%; height: auto; display: block; }.gallery-caption { padding: 12px 15px; background: #fafafa; font-size: 13px; color: #666; text-align: center; border-top: 1px solid #eee; }
.gallery-admin { position: absolute; top: 10px; right: 10px; display: none; gap: 5px; }
.gallery-admin-btn { width: 34px; height: 34px; border-radius: 50%; border: none; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.gallery-admin-btn.move { background: #3498db; }
.gallery-admin-btn.del { background: #e74c3c; }
body.edit-mode .gallery-admin { display: flex; }

/* Gallery Add */
.gallery-add { display: none; margin-top: 15px; padding: 20px; background: #f8f9fa; border-radius: 10px; border: 2px dashed #ddd; }
body.edit-mode .gallery-add { display: block; }
.gallery-add-tabs { display: flex; gap: 10px; margin-bottom: 15px; }
.gallery-add-tab { padding: 8px 16px; border: none; background: #e9ecef; border-radius: 6px; font-weight: 500; font-size: 13px; }
.gallery-add-tab.active { background: var(--apt-primary); color: #fff; }
.gallery-add-panel { display: none; }
.gallery-add-panel.active { display: block; }
.gallery-add-panel input[type="text"] { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; margin-bottom: 10px; }
.gallery-add-panel button { padding: 10px 20px; background: var(--apt-primary); color: #fff; border: none; border-radius: 6px; font-weight: 600; }
.gallery-upload-zone { padding: 40px; text-align: center; cursor: pointer; }
.gallery-upload-zone i { font-size: 40px; color: #aaa; }
.gallery-upload-zone p { margin-top: 10px; color: #666; font-size: 13px; }

/* ========== Form ========== */
.form-card { background: var(--apt-white); border-radius: 12px; box-shadow: var(--apt-shadow); overflow: hidden; }
.form-header { background: linear-gradient(135deg, var(--apt-primary), var(--apt-secondary)); color: #fff; padding: 25px; }
.form-header h2 { font-size: 20px; display: flex; align-items: center; gap: 10px; }
.form-body { padding: 25px; }
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.form-label .req { color: #e74c3c; }
.form-input, .form-select { width: 100%; padding: 12px 14px; border: 2px solid var(--apt-border); border-radius: 8px; font-size: 15px; transition: border-color 0.2s; }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--apt-primary); }
.form-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.form-check { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; font-size: 14px; }
.form-check input { width: 18px; height: 18px; }
.form-submit { width: 100%; padding: 14px; background: linear-gradient(135deg, var(--apt-primary), var(--apt-secondary)); color: #fff; border: none; border-radius: 8px; font-size: 18px; font-weight: 700; }

/* ========== Mobile Quick Buttons ========== */
.mobile-quick { position: fixed; bottom: 0; left: 0; right: 0; display: none; z-index: 100; }
@media (max-width: 820px) { .mobile-quick { display: flex; } }
.quick-btn { flex: 1; height: 58px; display: flex; align-items: center; justify-content: center; gap: 8px; color: #fff; font-weight: 600; font-size: 15px; border: none; text-decoration: none; position: relative; }
.quick-btn i { font-size: 18px; }

/* ========== Admin ========== */
.admin-bar { position: fixed; top: 10px; right: 10px; display: flex; gap: 10px; z-index: 999; }
.admin-btn { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; border: none; display: flex; align-items: center; gap: 6px; box-shadow: 0 3px 10px rgba(0,0,0,0.2); position: relative; }
.admin-btn:hover { opacity: 0.9; }
.admin-btn .badge { position: absolute; top: -5px; right: -5px; background: #e74c3c; color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 10px; }
.admin-btn.active { background: linear-gradient(135deg, #28a745, #20c997); }
.save-toast { position: fixed; top: 60px; right: 10px; background: #28a745; color: #fff; padding: 10px 20px; border-radius: 6px; font-size: 14px; z-index: 999; display: none; }
.save-toast.show { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from{opacity:0;transform:translateY(-10px)} to{opacity:1;transform:translateY(0)} }

/* Editable */
.editable { cursor: pointer; border-radius: 4px; transition: background 0.2s; }
body.edit-mode .editable:hover { background: rgba(102,126,234,0.1); outline: 2px dashed var(--apt-primary); }
.editable-input { width: 100%; padding: 4px 8px; border: 2px solid var(--apt-primary); border-radius: 4px; font-size: inherit; font-weight: inherit; }

/* Upload Overlay */
.upload-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; cursor: pointer; flex-direction: column; color: #fff; font-size: 12px; }
body.edit-mode .upload-overlay { display: flex; }
.upload-overlay i { font-size: 24px; margin-bottom: 5px; }

/* Mobile Option */
.mobile-opt { position: absolute; top: 8px; right: 8px; z-index: 20; display: none; }
body.edit-mode .mobile-opt { display: block; }
.mobile-opt label { display: flex; align-items: center; gap: 5px; background: rgba(0,0,0,0.7); color: #fff; padding: 5px 10px; border-radius: 15px; font-size: 11px; cursor: pointer; }
.mobile-opt input { width: 14px; height: 14px; }

.manager .position { font-size: 13px; color: #888; margin-left: 5px; }
.manager .position:before { content: '/ '; }
.manager .position:empty { display: none; }
.manager .position:empty:before { display: none; }

/* ========== Modal ========== */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 15px; }
.modal.active { display: flex; }
.modal-box { background: #fff; border-radius: 12px; width: 100%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid #eee; }
.modal-head h3 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.modal-close { background: none; border: none; font-size: 20px; color: #999; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 15px 20px; border-top: 1px solid #eee; text-align: right; }
.modal-btn { padding: 10px 20px; background: var(--apt-primary); color: #fff; border: none; border-radius: 6px; font-weight: 600; }

/* Stats */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-box { padding: 18px; border-radius: 10px; text-align: center; color: #fff; }
.stat-box.purple { background: linear-gradient(135deg, #667eea, #764ba2); }
.stat-box.green { background: linear-gradient(135deg, #11998e, #38ef7d); }
.stat-box.orange { background: linear-gradient(135deg, #eb3349, #f45c43); }
.stat-num { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; opacity: 0.9; margin-top: 3px; }
.stats-filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 15px; padding: 12px; background: #f0f4ff; border-radius: 8px; }
.stats-filter input { padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }
.stats-filter button { padding: 8px 14px; border: none; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; }
.stats-filter .apply { background: #667eea; color: #fff; }
.stats-filter .reset { background: #6c757d; color: #fff; }
.chart-wrap { background: #f8f9fa; border-radius: 10px; padding: 15px; margin-bottom: 15px; }

/* Reservations */
.res-list { max-height: 280px; overflow-y: auto; }
.res-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-bottom: 1px solid #eee; }
.res-item.unread { background: #fffbeb; }
.res-name { font-weight: 600; font-size: 14px; }
.res-name .new { background: #e74c3c; color: #fff; font-size: 10px; padding: 2px 5px; border-radius: 8px; margin-left: 5px; }
.res-info { font-size: 12px; color: #666; margin-top: 3px; }
.res-actions button { padding: 5px 10px; border: none; border-radius: 4px; font-size: 11px; margin-left: 5px; cursor: pointer; }
.res-actions .read { background: #3498db; color: #fff; }
.res-actions .del { background: #e74c3c; color: #fff; }

/* Icon Picker */
.icon-picker { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; padding: 20px; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.3); z-index: 1100; display: none; max-width: 350px; }
.icon-picker.active { display: block; }
.icon-picker h4 { margin-bottom: 15px; }
.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.icon-item { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border: 2px solid #eee; border-radius: 8px; cursor: pointer; font-size: 18px; }
.icon-item:hover { border-color: var(--apt-primary); background: #f0f4ff; }

/* Toast Popup */
.toast-popup { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.8); background: #fff; padding: 40px 50px; border-radius: 16px; box-shadow: 0 15px 50px rgba(0,0,0,0.3); z-index: 2000; text-align: center; opacity: 0; visibility: hidden; transition: all 0.3s; }
.toast-popup.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.toast-popup .icon { font-size: 56px; color: #28a745; margin-bottom: 15px; }
.toast-popup .msg { font-size: 17px; line-height: 1.7; }

/* Preset Selector */
.preset-btn { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; background: #fff; border-radius: 50%; display: none; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.2); font-size: 12px; z-index: 10; }
body.edit-mode .preset-btn { display: flex; }
.preset-list { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); background: #fff; padding: 10px; border-radius: 8px; box-shadow: 0 3px 15px rgba(0,0,0,0.2); display: none; gap: 8px; }
.preset-list.active { display: flex; }
.preset-dot { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }

/* 방문 알림 (우측 하단) */
.visit-alert { position: fixed; bottom: 90px; right: 20px; background: #1a1a2e; color: #fff; padding: 10px 18px; border-radius: 25px; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); z-index: 90; animation: slideIn 0.5s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
.visit-alert .fire { font-size: 16px; }
.visit-alert .num { color: #ffd700; font-weight: 700; font-size: 15px; }
.visit-alert-admin { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; background: #e74c3c; color: #fff; border: none; border-radius: 50%; font-size: 10px; cursor: pointer; display: none; align-items: center; justify-content: center; }
body.edit-mode .visit-alert-admin { display: flex; }
@media (max-width: 820px) { .visit-alert { bottom: 75px; right: 15px; font-size: 12px; padding: 8px 14px; } }

/* 약관 모달 개선 */
#termsModal .modal-box { max-height: 85vh; display: flex; flex-direction: column; }
#termsModal .modal-body { flex: 1; overflow-y: auto; padding-bottom: 80px; }
#termsModal .modal-foot { position: sticky; bottom: 0; background: #fff; border-top: 1px solid #eee; padding: 15px 20px; }
.terms-edit { margin-top: 15px; padding: 15px; background: #f8f9fa; border-radius: 8px; display: none; }
body.edit-mode .terms-edit { display: block; }
.terms-edit textarea { width: 100%; height: 150px; padding: 10px; border: 1px solid #ddd; border-radius: 6px; resize: vertical; }
.terms-edit button { margin-top: 10px; padding: 8px 16px; background: var(--apt-primary); color: #fff; border: none; border-radius: 6px; cursor: pointer; }

/* Admin Edit Section */
.admin-section { margin-top: 20px; padding: 15px; background: #f8f9fa; border-radius: 8px; display: none; }
body.edit-mode .admin-section { display: block; }
.admin-section h4 { font-size: 14px; margin-bottom: 10px; }
.admin-section textarea { width: 100%; height: 80px; padding: 10px; border: 1px solid #ddd; border-radius: 6px; resize: vertical; }
.admin-section button { margin-top: 10px; padding: 8px 16px; background: var(--apt-primary); color: #fff; border: none; border-radius: 6px; font-weight: 500; }

/* 드래그앤드롭 */
.gallery-item { cursor: default; transition: transform 0.2s, box-shadow 0.2s; }
body.edit-mode .gallery-item[data-id] { cursor: grab; }
body.edit-mode .gallery-item[data-id]:active { cursor: grabbing; }
.gallery-item.dragging { opacity: 0.5; transform: scale(1.02); }
.gallery-item.drag-over { box-shadow: 0 0 0 3px var(--apt-primary); }
.drag-handle { display: none; width: 34px; height: 34px; background: #9b59b6; border-radius: 50%; align-items: center; justify-content: center; color: #fff; font-size: 16px; cursor: grab; }
body.edit-mode .drag-handle { display: flex; }

/* 사이드바 버튼 프리셋 */
.sidebar-actions .btn { position: relative; }
.sidebar-actions .preset-btn { position: absolute; top: -8px; right: 10px; }
.sidebar-actions .preset-list { position: absolute; bottom: calc(100% + 5px); right: 0; left: auto; transform: none; }

/* 공지 멀티라인 편집 */
.sidebar-notice.editable textarea.editable-input { width: 100%; min-height: 80px; background: rgba(255,255,255,0.9); color: #333; border: none; border-radius: 6px; padding: 10px; resize: vertical; }

/* ========================================
   추가할 CSS (style.css 맨 아래에 붙여넣기)
   ======================================== */

/* 모바일 옵션 - 좌측으로 이동 */
.mobile-opt-left {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 20;
    display: none;
}
body.edit-mode .mobile-opt-left {
    display: block;
}
.mobile-opt-left label {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 11px;
    cursor: pointer;
}
.mobile-opt-left input {
    width: 14px;
    height: 14px;
}

/* 푸터 스타일 */
.apt-footer {
    margin-top: 30px;
    padding: 25px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--apt-shadow);
    color: #888;
    font-size: 13px;
    line-height: 1.8;
}
.footer-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-bottom: 12px;
}
.footer-info .item {
    display: inline-flex;
    align-items: center;
}
.footer-copy {
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
    font-weight: 500;
    color: #aaa;
    font-size: 12px;
}

/* 반응형 - 모바일 */
@media (max-width: 820px) {
    .apt-footer {
        margin-top: 20px;
        padding: 20px 15px;
        margin-bottom: 80px; /* 하단 퀵버튼 여백 */
    }
    .footer-info {
        flex-direction: column;
        gap: 5px;
    }
}

/* 모바일 옵션 - 좌측으로 이동 */
.mobile-opt-left {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 20;
    display: none;
}
body.edit-mode .mobile-opt-left {
    display: block;
}
.mobile-opt-left label {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 11px;
    cursor: pointer;
}
.mobile-opt-left input {
    width: 14px;
    height: 14px;
}

/* 푸터 스타일 */
.apt-footer {
    margin-top: 30px;
    padding: 25px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--apt-shadow);
    color: #888;
    font-size: 13px;
    line-height: 1.8;
}
.footer-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-bottom: 12px;
}
.footer-info .item {
    display: inline-flex;
    align-items: center;
}
.footer-copy {
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
    font-weight: 500;
    color: #aaa;
    font-size: 12px;
}

/* 반응형 - 모바일 */
@media (max-width: 820px) {
    .apt-footer {
        margin-top: 20px;
        padding: 20px 15px;
        margin-bottom: 80px; /* 하단 퀵버튼 여백 */
    }
    .footer-info {
        flex-direction: column;
        gap: 5px;
    }
}


/* 이름 + 연락처 같은 행 */
.form-row-inline {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}
.form-row-inline .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* 모바일에서도 같은 행 유지 */
@media (max-width: 400px) {
    .form-row-inline {
        gap: 8px;
    }
    .form-row-inline .form-input {
        padding: 10px;
        font-size: 14px;
    }
}

/* 모바일 날짜 입력 다크모드 수정 */
.form-input[type="date"],
.form-select {
    background-color: #fff !important;
    color: #333 !important;
    color-scheme: light;
}

/* 모바일 옵션 좌측 */
.mobile-opt-left {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 20;
    display: none;
}
body.edit-mode .mobile-opt-left {
    display: block;
}
.mobile-opt-left label {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 11px;
    cursor: pointer;
}

/* 푸터 스타일 개선 */
.apt-footer {
    margin-top: 30px;
    padding: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--apt-shadow);
    overflow: hidden;
}
.footer-inner {
    padding: 25px;
}
.footer-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 20px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
}
.footer-item {
    display: inline-flex;
    align-items: center;
}
.footer-copy {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
    font-size: 12px;
    color: #999;
}

@media (max-width: 820px) {
    .apt-footer {
        margin-bottom: 80px;
    }
    .footer-inner {
        padding: 20px;
    }
    .footer-row {
        flex-direction: column;
        gap: 5px;
    }
}

/* SMS 설정 모달 */
.sms-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.sms-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sms-field label {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}
.sms-field input,
.sms-field textarea {
    padding: 10px 12px;
    border: 2px solid #e8eef5;
    border-radius: 8px;
    font-size: 14px;
}
.sms-field input:focus,
.sms-field textarea:focus {
    outline: none;
    border-color: var(--apt-primary);
}
.sms-field small {
    font-size: 11px;
    color: #999;
}
.sms-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.sms-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.sms-actions .btn-test {
    background: #6c757d;
    color: #fff;
}
.sms-actions .btn-save {
    background: var(--apt-primary);
    color: #fff;
}

/* 토글 스위치 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 26px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--apt-primary);
}
input:checked + .slider:before {
    transform: translateX(24px);
}

/* SMS 로그 */
.sms-logs {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.sms-logs h4 {
    font-size: 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
#smsLogList {
    max-height: 200px;
    overflow-y: auto;
}
.sms-log-item {
    display: grid;
    grid-template-columns: 100px 1fr 60px 130px;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
    align-items: center;
}
.sms-log-item.success .log-status { color: #28a745; }
.sms-log-item.fail .log-status { color: #e74c3c; }
.log-phone { font-weight: 600; }
.log-msg { color: #666; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-time { color: #999; font-size: 11px; }
.no-data { text-align: center; color: #999; padding: 20px; font-size: 13px; }

@media (max-width: 500px) {
    .sms-log-item {
        grid-template-columns: 1fr 1fr;
        gap: 5px;
    }
    .log-msg { display: none; }
}

/* ========================================
   추가 CSS - style.css 맨 아래에 붙여넣기
   ======================================== */

/* 이름 + 연락처 같은 행 */
.form-row-inline {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}
.form-row-inline .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* 날짜 입력 래퍼 */
.date-input-wrap {
    position: relative;
    flex: 2;
}
.date-input-wrap .date-display {
    cursor: pointer;
    background: #fff !important;
    color: #333 !important;
}
.date-input-wrap .date-hidden {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.date-input-wrap i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

/* 모바일 날짜 입력 */
.form-input[type="date"],
.form-select {
    background-color: #fff !important;
    color: #333 !important;
    color-scheme: light;
}

/* 모바일 옵션 좌측 */
.mobile-opt-left {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 20;
    display: none;
}
body.edit-mode .mobile-opt-left {
    display: block;
}
.mobile-opt-left label {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 11px;
    cursor: pointer;
}

/* 사이드바 헤더 이미지 전체 표시 */
.sidebar-header {
    height: auto;
    min-height: 120px;
    aspect-ratio: 16 / 9;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.sidebar-header:not([style*="background-image"]) {
    background: linear-gradient(-45deg, var(--apt-primary), var(--apt-secondary));
    aspect-ratio: auto;
    height: 160px;
}

/* 간단한 푸터 */
.apt-footer-simple {
    margin-top: 30px;
    padding: 20px;
    text-align: center;
    font-size: 12px;
    color: #999;
}

@media (max-width: 820px) {
    .apt-footer-simple {
        margin-bottom: 80px;
    }
}

/* ========================================
   모바일 퀵버튼 아이콘/폰트 크기 증가
   ======================================== */
@media (max-width: 820px) {
    .mobile-quick .quick-btn {
        padding: 14px 20px;
    }
    .mobile-quick .quick-btn i {
        font-size: 22px;
    }
    .mobile-quick .quick-btn span {
        font-size: 20px;
        font-weight: 600;
    }
}

/* ========================================
   SMS 설정 모달
   ======================================== */
.sms-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.sms-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sms-field.row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}
.sms-field label {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}
.sms-field input,
.sms-field textarea {
    padding: 10px 12px;
    border: 2px solid #e8eef5;
    border-radius: 8px;
    font-size: 14px;
}
.sms-field input:focus,
.sms-field textarea:focus {
    outline: none;
    border-color: var(--apt-primary);
}
.sms-field small {
    font-size: 11px;
    color: #999;
}

.sms-tabs {
    display: flex;
    gap: 0;
    border: 2px solid #e8eef5;
    border-radius: 8px;
    overflow: hidden;
}
.sms-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: #f8f9fa;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.sms-tab.active {
    background: var(--apt-primary);
    color: #fff;
}
.sms-panel {
    padding: 15px 0 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sms-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.sms-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.sms-actions .btn-test {
    background: #6c757d;
    color: #fff;
}
.sms-actions .btn-save {
    background: var(--apt-primary);
    color: #fff;
}

/* 토글 스위치 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 26px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--apt-primary);
}
input:checked + .slider:before {
    transform: translateX(24px);
}

/* SMS 로그 */
.sms-logs {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.sms-logs h4 {
    font-size: 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
#smsLogList {
    max-height: 200px;
    overflow-y: auto;
}
.sms-log-item {
    display: grid;
    grid-template-columns: 70px 100px 1fr 60px;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
    align-items: center;
}
.sms-log-item.success .log-status { color: #28a745; }
.sms-log-item.fail .log-status { color: #e74c3c; }
.log-provider { font-weight: 600; color: #666; }
.log-phone { color: #333; }
.log-msg { color: #666; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-status { text-align: right; }
.no-data { text-align: center; color: #999; padding: 20px; font-size: 13px; }

@media (max-width: 500px) {
    .sms-log-item {
        grid-template-columns: 1fr 1fr;
        gap: 5px;
    }
    .log-msg { display: none; }
}
/* ========== 스크롤 애니메이션 ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scroll-animate {
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

/* 애니메이션 딜레이 (순차적 등장) */
.scroll-animate:nth-child(1) { animation-delay: 0.1s; }
.scroll-animate:nth-child(2) { animation-delay: 0.2s; }
.scroll-animate:nth-child(3) { animation-delay: 0.3s; }
.scroll-animate:nth-child(4) { animation-delay: 0.4s; }
.scroll-animate:nth-child(5) { animation-delay: 0.5s; }
.scroll-animate:nth-child(6) { animation-delay: 0.6s; }

/* 갤러리 아이템 애니메이션 */
.gallery-item {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.gallery-item:nth-child(1) { animation-delay: 0.1s; }
.gallery-item:nth-child(2) { animation-delay: 0.2s; }
.gallery-item:nth-child(3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4) { animation-delay: 0.4s; }
.gallery-item:nth-child(5) { animation-delay: 0.5s; }

/* 카드 애니메이션 */
.apt-card, .form-card, .sidebar-card {
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

.apt-card { animation-delay: 0.2s; }
.form-card { animation-delay: 0.3s; }
.sidebar-card { animation-delay: 0.1s; }

/* ========== 팝업 레이어 ========== */
.popup-layer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.popup-layer.hide {
    display: none;
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.popup-content {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: popupSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.popup-content img {
    display: block;
    width: 380px;
    max-width: 100%;
    height: auto;
    max-height: calc(90vh - 60px); /* 화면 높이 - 푸터 높이 */
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s;
    flex-shrink: 1;
}

.popup-content img:hover {
    transform: scale(1.02);
}

.popup-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

.popup-today {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    user-select: none;
}

.popup-today input[type="checkbox"] {
    cursor: pointer;
}

.popup-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #e74c3c;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.popup-close-btn:hover {
    background: #c0392b;
}

/* 팝업 관리 UI */
.popup-list-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 15px;
    padding: 15px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s;
}

.popup-list-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.popup-thumb {
    width: 80px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    background: #f8f9fa;
}

.popup-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.popup-info-row {
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 13px;
}

.popup-info-label {
    color: #999;
    min-width: 60px;
}

.popup-info-value {
    color: #333;
    font-weight: 500;
}

.popup-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.popup-status.active {
    background: #d4edda;
    color: #155724;
}

.popup-status.inactive {
    background: #f8d7da;
    color: #721c24;
}

.popup-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.popup-action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: center;
}

.popup-action-btn.edit {
    background: #3498db;
    color: #fff;
}

.popup-action-btn.edit:hover {
    background: #2980b9;
}

.popup-action-btn.delete {
    background: #e74c3c;
    color: #fff;
}

.popup-action-btn.delete:hover {
    background: #c0392b;
}

.popup-action-btn.preview {
    background: #9b59b6;
    color: #fff;
}

.popup-action-btn.preview:hover {
    background: #8e44ad;
}

/* 팝업 업로드 영역 */
.popup-upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.2s;
}

.popup-upload-area:hover {
    border-color: #667eea;
    background: #f0f3ff;
}

.upload-placeholder i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 10px;
}

.upload-placeholder p {
    color: #999;
    margin: 10px 0;
}

.upload-preview {
    position: relative;
}

.upload-preview img {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 6px;
}

.btn-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(231, 76, 60, 0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-remove:hover {
    background: #e74c3c;
}

.btn-add {
    padding: 8px 16px;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-add:hover {
    background: #218838;
}

.btn-preview {
    padding: 10px 20px;
    background: #9b59b6;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-preview:hover {
    background: #8e44ad;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .popup-content img {
        width: 100%;
        max-width: 350px;
        height: auto;
    }
    
    .popup-list-item {
        grid-template-columns: 60px 1fr;
        gap: 10px;
    }
    
    .popup-thumb {
        width: 60px;
        height: 45px;
    }
    
    .popup-actions {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: flex-end;
    }
}

/* ===== v3.3 - 갤러리 URL 행 / 대기열 스타일 ===== */
.gallery-url-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}
.gallery-url-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.gallery-url-fields input[type=text] {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 13px;
    box-sizing: border-box;
}
.gallery-link-target-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
}
.gallery-url-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #e74c3c;
    font-size: 16px;
    padding: 4px 6px;
    flex-shrink: 0;
}
.gallery-url-remove:hover { color: #c0392b; }

.gallery-queue-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 4px;
    font-size: 13px;
    border: 1px solid #e9ecef;
}
.queue-num {
    min-width: 22px;
    height: 22px;
    background: #667eea;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.queue-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
}
.queue-size {
    color: #999;
    font-size: 11px;
    flex-shrink: 0;
}

/* 대기열 드래그 */
.gallery-queue-item[draggable="true"] { cursor: grab; }
.gallery-queue-item.drag-over {
    border: 2px dashed #667eea;
    background: #eef0fd;
}
.queue-drag-handle {
    color: #bbb;
    font-size: 18px;
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
    padding: 0 2px;
}
.queue-drag-handle:hover { color: #667eea; }
