/**
 * RA0 main_up - 비주얼 홈페이지 빌더
 * style.css - 섹션 레이아웃 및 레이어 스타일
 *
 * CSS 변수 연동: default.css.php의 :root 변수 사용
 * 반응형 디자인 적용
 */

/* ==========================================
   1. 메인 컨테이너
   ========================================== */

#main-builder {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: transparent;
    font-family: var(--content-font-family);
    color: var(--content-font-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 90vh;
    overflow: hidden;
}

/* ==========================================
   2. 섹션 스타일
   ========================================== */
   
.section {
    background: rgb(from var(--container-bg-color) r g b / 80%);
    border-radius: var(--container-border-radius);
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    transition: all 0.2s ease;
    
}

/* 레이어에 배경색이 있으면 섹션 배경 투명화 */
.section:has(.layer[style*="background"]) {
    background: transparent;
}

/* 섹션별 기본 패딩 */
.section {
    padding: 0.2em;
}

/* ==========================================
   3. 프리셋별 레이아웃
   ========================================== */

/* 3-1. ISOLATED SYSTEM */
.preset-isolated_system .main-container {
    display: flex;
    flex-direction: row;
}

.preset-isolated_system .section-left {
    width: 20%;
    min-width: 200px;
    border-right: 1px solid var(--border-light);
}

.preset-isolated_system .section-center {
    width: 60%;
    flex: 1;
}

.preset-isolated_system .section-right-wrapper {
    width: 20%;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-light);
}

.preset-isolated_system .section-top-right {
    height: 50%;
    border-bottom: 1px solid var(--border-light);
}

.preset-isolated_system .section-bottom-right {
    height: 50%;
}

/* 3-2. FULL WIDTH */
.preset-full_width .main-container {
    flex-direction: column;
}

.preset-full_width .section-main {
    width: 100%;
    height: 100vh;
}

/* 3-3. TWO COLUMN */
.preset-two_column .main-container {
    flex-direction: row;
}

.preset-two_column .section-left {
    width: 50%;
    border-right: 1px solid var(--border-light);
}

.preset-two_column .section-right {
    width: 50%;
}

/* 3-4. THREE COLUMN */
.preset-three_column .main-container {
    flex-direction: row;
}

.preset-three_column .section-left {
    width: 25%;
    min-width: 200px;
    border-right: 1px solid var(--border-light);
}

.preset-three_column .section-center {
    width: 50%;
    flex: 1;
}

.preset-three_column .section-right {
    width: 25%;
    min-width: 200px;
    border-left: 1px solid var(--border-light);
}

/* 3-5. HEADER + FOOTER */
.preset-header_footer .main-container {
    flex-direction: column;
}

.preset-header_footer .section-header {
    height: 20vh;
    min-height: 100px;
    border-bottom: 1px solid var(--border-light);
}

.preset-header_footer .section-main {
    flex: 1;
    overflow-y: auto;
}

.preset-header_footer .section-footer {
    height: 20vh;
    min-height: 100px;
    border-top: 1px solid var(--border-light);
}

/* ==========================================
   4. 레이어 공통 스타일
   ========================================== */

.layer {
    transition: all var(--transition-normal);
    position: relative;
    /* Flexbox 환경에서 레이어가 부모 컨테이너를 벗어나지 않도록 */
    min-width: 0;
    min-height: 0;
    /* 내용물이 넘치지 않도록 기본 overflow 설정 */
    box-sizing: border-box;
}

/* 레이어에 배경색이 설정된 경우 */
.layer[style*="background-color"] {
    background: inherit; /* style 속성의 background-color 사용 */
}

.layer:last-child {
    margin-bottom: 0;
}

/* 레이어 애니메이션 */
.layer-animate {
    opacity: 0;
    animation: fadeIn 0.5s ease-in-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   5. 레이어 타입별 스타일
   ========================================== */

/* 5-1. 슬라이드 레이어 */
.layer-type-slide {
    min-height: 300px;
    padding: 0;
    overflow: hidden;
}

.slide-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.layer.layer-slide .slide .slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity var(--transition-base);
    border-radius: var(--container-border-radius);
    background: transparent;
    mix-blend-mode: normal;
}

.layer.layer-slide .slide:hover .slide-overlay {
    opacity: 0;
    background: transparent;
}

.slide-overlay.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.slide-overlay img {
    max-width: 100%;
    max-height: 60%;
    object-fit: contain;
    margin-bottom: 1rem;
}

.layer.layer-slide .slide .slide-overlay h3 {
}

.layer.layer-slide .slide .slide-overlay .slide-content {
    padding: 0;
    padding-top: 0.5em;
    width: 100%;
    height: auto;
}

.slide-controls {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.slide-controls button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgb(from var(--black) r g b / 50%);
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.slide-controls button:hover {
    background: rgb(from var(--black) r g b / 70%);
    transform: scale(1.1);
}

/* 아이콘만 표시 (배경 없음) */
.slide-controls.icon-only button {
    background: transparent;
    color: rgb(from var(--white) r g b / 80%);
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

.slide-controls.icon-only button:hover {
    color: var(--white);
    text-shadow: 0 0 6px rgba(0, 0, 0, 1);
    transform: scale(1.2);
}

.slide-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgb(from var(--white) r g b / 50%);
    cursor: pointer;
    transition: var(--transition-fast);
}

.slide-dot.active {
    background: var(--primary-color);
    transform: scale(1.2);
}

/* 5-2. 카드 레이어 */
.layer-type-card {
    padding: 1rem;
    /* 레이어가 부모 컨테이너를 벗어나지 않도록 */
    min-width: 0;
    min-height: 0;
}

.layer-card .card-container {
    display: flex;
    gap: 1rem;
    height: 100%;
    max-height: 100%;
    /* 카드 컨테이너가 축소되도록 */
    min-width: 0;
    min-height: 0;
}

.layer-card .card-container a {
    flex: 1;
    /* 링크가 축소되도록 */
    min-width: 0;
    min-height: 0;
}

.layer-card .card-container.vertical {
    flex-direction: column;
}

.layer-card .card-item {
    flex: 1;
    padding: 1rem;
    border-radius: var(--card-border-radius);
    background: var(--card-bg-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6em;
    /* 카드가 축소되도록 */
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.layer-card .card-item .card-body {
    display: flex;
    flex-direction: column;
    gap: 0.2em;
    align-items: center;
}

/* 카드 스타일 - 그림자 */
.card-style-shadow {
    box-shadow: 0 2px 3px rgb(from var(--black) r g b / 10%);
}
.card-style-shadow:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 5px rgb(from var(--black) r g b / 15%);
}

/* 카드 스타일 - 테두리 */
.card-style-border {
    border: 2px solid var(--card-border-color);
}
.card-style-border:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgb(from var(--primary-color) r g b / 15%);
}

/* 카드 스타일 - 평면 */
.card-style-flat {
    background: transparent;
    border: none;
    box-shadow: none;
}
.card-style-flat:hover {
    background: var(--container-bg-color);
}

/* 클릭 가능한 카드 */
.card-clickable {
    cursor: pointer;
    transition: all 0.3s ease;
}
.card-clickable:hover {
    transform: translateY(-4px);
}
.card-link-wrapper {
    display: flex;
    text-decoration: none;
    color: inherit;
}

.card-image {
    display: flex;
    width: 100%;
    height: 100%;
    max-width: 90%;
    max-height: 80%;
    flex: 1;
    align-items: center;
    justify-content: center;
    /* 이미지가 컨테이너를 벗어나지 않도록 */
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}

.card-item img {
    /* fit-content 제거하고 컨테이너에 맞춤 */
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--card-border-radius);
}

.card-item h3 {
    font-family: var(--title-font-family);
    font-size: var(--sub-title-font-size);
    color: var(--content-font-color);
    margin-bottom: 0.5rem;
}

.card-item .card-content {
    font-family: var(--content-font-family);
    font-size: var(--content-font-size);
    color: var(--content-font-color);
}

/* 5-3. 탭 레이어 */
.layer-type-tab {
    padding: 0;
}

.tab-labels {
    display: flex;
}

.tab-label {
    padding: 0.5em;
    text-align: center;
    cursor: pointer;
    background: transparent;
    border: none;
    font-family: var(--content-font-family);
    font-size: var(--content-font-size);
    color: var(--content-font-color);
    transition: var(--transition-fast);
}

.tab-label:hover {
    scale: 1.02;
}

.tab-label.active {
    color: var(--accent-color);
    font-weight: bold;
}

.tab-contents {
    padding: 0.5em;
}

.tab-content {
    display: none;
    height: 100%;
}

.tab-content.active {
    display: block;
}

/* 5-4. 이미지 레이어 */
.layer-type-image {
    padding: 0;
    overflow: hidden;
}


.layer.layer-image {
    overflow: hidden;
}

.layer-type-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.layer-type-image img.contain {
    object-fit: contain;
}

.layer-type-image img.fill {
    object-fit: fill;
}

/* 5-5. 갤러리 레이어 */
.layer-type-gallery {
    padding: 1rem;
}

.gallery-grid {
    display: grid;
    gap: 0.5rem;
}

.gallery-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.gallery-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.gallery-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: calc(var(--card-border-radius) / 2);
    aspect-ratio: 1;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-normal);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* 5-6. 텍스트 레이어 */
.layer-type-text {
    padding: 1.5rem;
}

.layer-type-text .text-content {
    font-family: var(--content-font-family);
    font-size: var(--content-font-size);
    color: var(--content-font-color);
    line-height: 1.7;
}

.layer-type-text .text-content.left {
    text-align: left;
}

.layer-type-text .text-content.center {
    text-align: center;
}

.layer-type-text .text-content.right {
    text-align: right;
}

/* 5-7. 최신글 레이어 */
.layer-type-latest {
    padding: 1rem;
}

/* 5-8. 게시판 iframe 레이어 */
.layer-type-board_iframe {
    padding: 0;
}

.layer-type-board_iframe iframe {
    width: 100%;
    border: none;
    display: block;
}

/* 5-9. 외부 iframe 레이어 */
.layer-type-external_iframe {
    padding: 0;
}

.layer-type-external_iframe iframe {
    width: 100%;
    border: none;
    display: block;
}

/* 5-10. 시계 레이어 */
.layer-type-clock {
    padding: 2rem;
    text-align: center;
}

#current-time {
    font-family: var(--title-font-family);
    font-size: 32px;
    font-weight: 700;
    color: var(--content-font-color);
    letter-spacing: 3px;
}

/* 5-11. 달력 레이어 (main_up 전용 - default.css 충돌 방지) */
.layer-type-calendar {
    padding: 1rem;
}

.layer-calendar-widget {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.layer-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: auto 1fr 1fr 1fr 1fr 1fr 1fr;
    gap: 2px;
    flex: 1;
    height: 100%;
}

.layer-day-name {
    text-align: center;
    font-weight: bold;
    font-size: 11px;
    padding: 8px 4px;
    color: var(--text-muted);
}

.layer-calendar-day {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-fast);
    background: var(--container-bg-color);
    color: var(--content-font-color);
    min-height: 0;
}

.layer-calendar-day:hover {
    background: rgb(from var(--primary-color) r g b / 10%);
}

.layer-calendar-day.today {
    background: var(--accent-color);
    color: var(--white);
    font-weight: 700;
    box-shadow: 0 2px 4px rgb(from var(--accent-color) r g b / 30%);
}

.layer-calendar-day.empty {
    background: transparent;
    cursor: default;
}

/* 5-12. 회원 정보 레이어 */
.layer-type-member_info {
    padding: 1rem;
}

.my_member_info {
    /* 기본 스타일은 default.css.php 참조 */
}

/* 회원 정보 탭 */
.my_member_info .member-tabs {
    margin-top: 1rem;
}

.my_member_info .tab-buttons {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 1rem;
}

.my_member_info .tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    font-family: var(--content-font-family);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.my_member_info .tab-btn:hover {
    color: var(--content-font-color);
    background: rgb(from var(--accent-color) r g b / 5%);
}

.my_member_info .tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    font-weight: 700;
}

.my_member_info .tab-btn .notification-badge {
    display: inline-block;
    background: var(--error-color);
    color: var(--white);
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    margin-left: 0.3rem;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}

.my_member_info .activity-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.my_member_info .activity-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--card-bg-color);
    border: 1px solid var(--border-light);
    border-radius: var(--card-border-radius);
    color: var(--content-font-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.my_member_info .activity-link:hover {
    background: var(--container-bg-color);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateX(4px);
}

.my_member_info .activity-link i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

/* 로그인 폼 */
.main_login_form {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.main_login_form form {
    width: 90%;
}

/* 5-13. 소개글 레이어 */
.layer-type-about {
    padding: 1.5rem;
}

.intro-content {
    font-family: var(--content-font-family);
    font-size: var(--content-font-size);
    color: var(--content-font-color);
    line-height: 1.7;
}

.intro-placeholder {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

/* 5-14. 한줄 공지 레이어 */
.layer-type-marquee {
    padding: 0.5rem 0;
    background: var(--primary-color);
    overflow: hidden;
}

.layer-type-marquee marquee {
    font-family: var(--content-font-family);
    font-size: var(--content-font-size);
    color: var(--white);
}

/* 5-15. 소개 레이어 */
.layer-about .about-layer {
    display: flex;
    flex-direction: column;
    text-align: center;
    gap: 5px;
    color: var(--content-font-color);
    font-size: 1em;
    padding: var(--spacing-sm);
    width: 100%;
    height: 100%;
    justify-content: center;
}

.layer-about .about-layer h3 {
    font-size: 1.2em;
    font-family: var(--header-font-family);
}

/* ==========================================
   6. 관리자 전용 스타일
   ========================================== */


#admin-toolbar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    background: var(--white);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgb(from var(--black) r g b / 20%);
    display: flex;
    gap: 5px;
}

.btn-admin {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition-fast);
    border: none;
    cursor: pointer;
}

.btn-admin:hover {
    opacity: 0.9;
}

/* ==========================================
   7. 반응형 디자인
   ========================================== */

/* 모바일 (768px 이하) */
@media (max-width: 768px) {
    /* 모든 프리셋을 세로 방향으로 변경 */
    .main-container {
        flex-direction: column !important;
        height: auto !important;
    }

    /* 레이아웃 컨테이너도 모바일에서는 세로 방향으로 */
    .layout-row,
    .layout-column {
        flex-direction: column !important;
        width: 100% !important;
        height: auto !important;
    }

    /* 컨테이너 내 모든 자식 요소 */
    .layout-row > *,
    .layout-column > * {
        width: 100% !important;
    }

    #main-builder {
        height: auto;
    }

    /* 모바일 숨김 클래스 */
    .hidden-mobile {
        display: none !important;
    }
}

/* ============================================
   레이아웃 시스템 공통 스타일
   ============================================ */

/* 레이아웃 컨테이너 (row/column) */
.layout-row,
.layout-column {
    display: flex;
    box-sizing: border-box;
    gap: 0;
    /* Flexbox 축소 문제 해결: 자식 요소가 컨테이너 크기를 넘지 않도록 */
    min-width: 0;
    min-height: 0;
}

.layout-row {
    flex-direction: row;
    width: 100%;
    height: 100%;
}

.layout-row > * {
    /* row 내 자식 요소는 최소 너비 0으로 설정하여 축소 가능하게 */
    min-width: 0;
}

.layout-column {
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.layout-column > * {
    /* column 내 자식 요소는 최소 높이 0으로 설정하여 축소 가능하게 */
    min-height: 0;
}

/* 섹션 공통 스타일 */
.section {
    display: flex;
    box-sizing: border-box;
    overflow: hidden;
    gap: 0;
    /* 섹션도 부모 컨테이너에 맞춰 축소되도록 */
    min-width: 0;
    min-height: 0;
    /* flex 아이템일 때 축소 허용 */
    flex-shrink: 1;
}

/* 빈 섹션 (관리자 전용) */
.empty-section {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.02);
    border: 2px dashed rgba(0, 0, 0, 0.1);
    gap: 0.3em;
    padding: var(--spacing-sm);
}

.empty-section p {
    color: var(--text-muted);
    font-size: 1em;
}

.empty-section a {
    padding: 8px 16px;
    background: var(--info-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 4px;
    font-size: 1em;
}

.empty-section a:hover {
    background: var(--success-color);
}

/* ============================================
   관리자 상단 컨트롤 바 & 탭 시스템
   ============================================ */

/* 상단 컨트롤 바 */
.admin-control-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-glass);
    box-shadow: 0 2px 1px rgb(from var(--black) r g b / 10%);
    z-index: 9998;
    transition: transform 0.3s ease;
}

/* 토글 화살표 (컨트롤 바에 붙어있음) */
.control-toggle-arrow {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-glass);
    width: 40px;
    height: 30px;
    border-radius: 0 0 8px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid var(--border-light);
    border-top: 0;
    box-shadow: 0 2px 5px rgb(from var(--black) r g b / 15%);
    opacity: 0.9;
    transition: all 0.2s ease;
    color: var(--content-font-color);
    z-index: 9999;
}

.control-toggle-arrow:hover {
    opacity: 1;
    transform: translateX(-50%) scale(1.05);
}

/* 컨트롤 바 내용 */
.admin-bar-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: var(--spacing-md) var(--spacing-sm);
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.admin-bar-content.collapsed {
    max-height: 0;
    padding: 0 var(--spacing-sm);
    opacity: 0;
}

/* 액션 버튼 (프리셋 변경, 레이어 추가, 섹션 관리, 레이어 목록) */
.admin-action-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-light);
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-radius: var(--btn-accent-radius);
    cursor: pointer;
    font-size: 14px;
    font-family: var(--f-pre);
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.admin-action-btn:hover {
    background: var(--btn-accent-bg);
    color: var(--btn-accent-text);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgb(from var(--primary-color) r g b / 20%);
}

/* 사이드 패널 */
.admin-side-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 420px;
    height: 100vh;
    background: var(--bg-glass);
    box-shadow: -2px 0 10px rgb(from var(--black) r g b / 20%);
    z-index: 10000;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.admin-side-panel.open {
    right: 0;
}

/* 패널 헤더 */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm);
    border-bottom: 2px solid var(--border-light);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 10;
}

.panel-header h3 {
    margin: 0;
    font-family: var(--f-pre);
    font-size: 0;
    color: var(--content-font-color);
}

.panel-close-btn {
    background: none;
    border: 0;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.panel-close-btn:hover {
    color: var(--content-font-color);
    transform: scale(1.1);
}

.panel-info {
    margin-bottom: 15px;
    font-size: 1em;
    color: var(--text-muted);
    line-height: 1.6;
}

/* 패널 컨텐츠 */
.panel-content {
    padding: 20px;
}

.panel-save {
    display: flex;
    justify-content: center;
}

/* 바 숨김 상태 */
.admin-control-bar.hidden {
    transform: translateY(-100%);
}

/* 공통 버튼 스타일 */
.btn-primary {
    padding: 10px 20px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--title-font-family);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

/* 페이드인 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 반응형 - 모바일 */
@media (max-width: 768px) {
    .admin-bar-content {
        flex-wrap: wrap;
        padding: 12px 15px;
    }

    .admin-action-btn {
        flex: 1 1 calc(50% - 5px);
        min-width: 0;
        font-size: 13px;
        padding: 8px 12px;
    }

    .admin-side-panel {
        width: 100%;
        right: -100%;
    }

    .admin-side-panel.open {
        right: 0;
    }

    .panel-content {
        padding: 15px;
    }
}

/* ==========================================
 * 레이어 편집 폼 스타일 (사이드 패널 내부)
 * ========================================== */

#layerEditPanel .panel-content {
    padding: var(--spacing-md);
}

/* 폼 그룹 */
#layerEditPanel .form-group {
    margin-bottom: var(--spacing-md);
}

#layerEditPanel .form-row {
    display: flex;
    gap: var(--spacing-md);
    flex-direction: row;
    flex-wrap: wrap;
}

#layerEditPanel .form-column {
    display: flex;
    flex-direction: column;
    gap: 0.3em;
}

#layerEditPanel .form-row .form-group {
    flex: 1;
    margin-bottom: 0;
    min-width: 100px;
}

#layerEditPanel .form-flex {
    display: flex;
    gap: 0.5em;
    align-items: center;
}

/* 라벨 */
#layerEditPanel label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--content-font-color);
    margin-bottom: 6px;
}

#layerEditPanel label.required::after {
    content: ' *';
    color: var(--error-color);
}

/* 입력 필드 */
#layerEditPanel .form-control,
#layerEditPanel input[type="text"],
#layerEditPanel input[type="number"],
#layerEditPanel select,
#layerEditPanel textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 13px;
    font-family: var(--content-font-family);
    background: var(--white);
    color: var(--content-font-color);
    transition: border-color 0.2s;
    text-align: left;
    transform: none;
    display: block;
    height: auto;
}

#layerEditPanel #bg_color_picker {
    width: 35px;
    padding: 0;
}

#layerEditPanel .form-control:focus,
#layerEditPanel input:focus,
#layerEditPanel select:focus,
#layerEditPanel textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(from var(--primary-color) r g b / 10%);
}

/* 셀렉트 박스 */
#layerEditPanel select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 35px;
}

/* 체크박스 */
#layerEditPanel input[type="checkbox"] {
    width: auto;
    margin-right: 6px;
    cursor: pointer;
}

/* 파일 입력 */
#layerEditPanel input[type="file"] {
    padding: 6px;
    font-size: 12px;
}

/* 도움말 텍스트 */
#layerEditPanel .field-help {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

/* 섹션 구분 */
#layerEditPanel .form-section {
    padding: var(--spacing-md);
    background: var(--container-bg-color);
    border-radius: var(--card-border-radius);
    margin-bottom: var(--spacing-md);
}

#layerEditPanel .form-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--content-font-color);
    margin-bottom: var(--spacing-sm);
}

/* 옵션 컨테이너 */
#layerEditPanel #layer-options-container {
    margin-top: var(--spacing-md);
}

#layerEditPanel #layer-options {
    padding: var(--spacing-md);
    background: rgb(from var(--info-color) r g b / 5%);
    border: 1px solid rgb(from var(--info-color) r g b / 20%);
    border-radius: var(--card-border-radius);
}

/* 컨텐츠 영역 */
#layerEditPanel #content-container {
    margin-top: var(--spacing-md);
}

/* 이미지 영역 */
#layerEditPanel #image-container {
    margin-top: var(--spacing-md);
}

/* 버튼 */
#layerEditPanel button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: none;
    border-radius: var(--card-border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

#layerEditPanel button[type="submit"]:hover {
    opacity: 0.9;
}

#layerEditPanel button[type="submit"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 레이어 타입 뱃지 */
#layerEditPanel .layer-type-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--accent-color);
    color: var(--white);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
}

/* Range 슬라이더 */
#layerEditPanel .range-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-light);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

#layerEditPanel .range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

#layerEditPanel .range-slider::-webkit-slider-thumb:hover {
    background: var(--secondary-color);
}

#layerEditPanel .range-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

/* ==========================================
   슬라이드/카드/탭 입력 폼 스타일
   ========================================== */

/* 슬라이드 입력 컨테이너 */
.slides-input-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.slide-input-item {
    padding: var(--spacing-md);
    background: var(--container-bg-color);
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

.slide-input-item h4 {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
}

.slide-image-preview {
    margin-top: var(--spacing-xs);
}

.slide-image-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 4px;
    object-fit: cover;
}

/* 카드 입력 컨테이너 */
.cards-input-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.card-input-item {
    padding: var(--spacing-md);
    background: var(--container-bg-color);
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

.card-input-item h4 {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
}

.card-image-preview {
    margin-top: var(--spacing-xs);
}

.card-image-preview img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 4px;
    object-fit: cover;
}

/* 탭 입력 컨테이너 */
.tabs-input-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.tab-input-item {
    padding: var(--spacing-md);
    background: var(--container-bg-color);
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

.tab-input-item h4 {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
}

.layer-marquee .marquee-layer {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 5px;
}

/* ====================
   시계 위젯 (Clock Widget) - mainskin_up 스타일 적용
   ==================== */
.clock-widget {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    font-family: var(--content-font-family);
    color: var(--content-font-color);
}

/* 🎯 디지털 시계 스타일 */
.digital-container {
    text-align: center;
}

.digital-date {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 300;
    font-family: var(--content-font-family);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.digital-time {
    color: var(--content-font-color);
    font-size: 2.8em;
    font-weight: bold;
    font-family: var(--title-font-family);
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 0 8px rgb(from var(--accent-color) r g b / 0.3);
}

.time-separator {
    color: var(--accent-color);
    animation: blink 1s infinite;
    margin: 0 4px;
}

@keyframes blink {
    50% {
        opacity: 0.3;
    }
}

/* 🎯 아날로그 시계 */
.analog-clock {
    position: relative;
}

.clock-hands {
    width: 120px;
    height: 120px;
    position: relative;
    background: rgb(from var(--accent-color) r g b / 70%);
    border-radius: 50%;
    filter: drop-shadow(0px 3px 2px rgb(from var(--content-font-color) r g b / 0.3));
}

.clock-hand {
    background: var(--content-font-color);
    position: absolute;
    transform-origin: bottom center;
    left: 50%;
    bottom: 50%;
    border-radius: 2px;
    transition: all 0.1s ease;
    box-shadow: 0 0 4px rgb(from var(--black) r g b / 0.3);
}

.hour-hand {
    width: 4px;
    height: 35px;
    margin-left: -2px;
    z-index: 3;
}

.minute-hand {
    width: 2px;
    height: 45px;
    margin-left: -1px;
    z-index: 2;
}

.clock-center {
    background: var(--error-color);
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    box-shadow: 0 0 6px rgb(from var(--black) r g b / 0.4);
}

/* 🎯 간단한 시계 (시:분만) */
.simple-time {
    color: var(--content-font-color);
    font-size: 3em;
    font-weight: 100;
    font-family: var(--title-font-family);
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgb(from var(--black) r g b / 0.2);
}

/* 🎯 날짜만 */
.date-only {
    text-align: center;
}

.date-main {
    color: var(--content-font-color);
    font-size: 25px;
    font-weight: bold;
    font-family: var(--title-font-family);
    font-style: italic;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgb(from var(--black) r g b / 0.2);
}

.date-weekday {
    color: var(--text-muted);
    font-family: var(--content-font-family);
    font-size: 9px;
    font-weight: 300;
    opacity: 0.8;
    margin-top: 4px;
}

/* 🎯 전체 날짜시간 */
.full-datetime {
    text-align: center;
}

.full-datetime .date-part {
    color: var(--text-muted);
    font-size: 8px;
    font-weight: 300;
    font-family: var(--content-font-family);
    opacity: 0.8;
    margin-bottom: 4px;
}

.full-datetime .time-part {
    color: var(--content-font-color);
    font-size: 2.5em;
    font-weight: bold;
    font-family: var(--title-font-family);
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgb(from var(--black) r g b / 0.2);
}

.layer-write-form .existing-files {
    margin-top: 0px;
    padding-top: 0px;
    border-top: 0;
}

.layer-write-form .drop-zone-content {
    border: 3px dashed var(--gray-400);
    border-radius: 12px;
    padding: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* ==========================================
   에디터 드롭다운 위치 조정 (main_up 전용)
   ========================================== */

/* 에디터 내 드롭다운을 왼쪽 정렬 (화면 왼쪽 잘림 방지) */
.layer-write-form .color-palette {
    left: 0 !important;
    right: auto !important;
}

/* 타일로 감싸기 버튼 숨기기 */
.layer-write-form .btn-tile-wrap {
    display: none !important;
}

/* 코드 블록 버튼 숨기기 */
.layer-write-form .toolbar-btn[data-action="codeBlock"] {
    display: none !important;
}