/* 기본 스타일 리셋 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Banking App Colors - Professional & Trustworthy */
    --primary-color: #0046FF;
    /* Deep Blue */
    --primary-hover: #0039CC;
    --primary-light: #E8EEFF;

    /* Neutral Colors */
    --kakao-black: #191919;
    --kakao-dark-gray: #333333;

    /* Functional Colors */
    --secondary-color: #5F6368;
    --success-color: #00C853;
    --danger-color: #E53935;
    --warning-color: #FB8C00;

    /* Backgrounds */
    --bg-color: #F8F9FA;
    --bg-secondary: #FFFFFF;
    --card-bg: #FFFFFF;

    /* Text */
    --text-primary: #1A1A1A;
    --text-secondary: #666666;
    --border-color: #E0E0E0;

    /* Effects */
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

body {
    font-family: "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* 모바일 최적화 */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* 컨테이너 - 항상 모바일 스타일 */
.container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 16px;
}

/* 헤더 - 모바일 최적화 */
.header {
    background-color: var(--card-bg);
    padding: 12px 16px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    min-width: 0;
    gap: 12px;
}

.header h1 {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

/* 언어 선택 */
.language-selector {
    position: relative;
}

.language-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    min-height: 32px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 120px;
    z-index: 1000;
    display: none;
}

.language-dropdown.show {
    display: block;
}

.language-option {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid var(--bg-color);
    transition: background-color 0.2s;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover,
.language-option.active {
    background-color: var(--bg-color);
}

.language-option.active {
    color: var(--primary-color);
    font-weight: 500;
}

/* 버튼 - 모바일 터치 친화적 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    min-height: 40px;
    /* 모바일 터치 최적화 */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

/* 버튼 호버 효과 제거 (모바일 전용) */

/* 버튼 액티브 상태 (터치 피드백) */
.btn:active {
    transform: scale(0.98);
    box-shadow: var(--shadow);
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--kakao-black);
    /* Black text on Yellow bg */
    font-weight: 600;
}

.btn-primary:hover {
    background-color: #3367d6;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-large {
    padding: 16px 24px;
    font-size: 18px;
    min-height: 52px;
    /* 모바일에서 더 큰 버튼 */
}

.btn-small {
    padding: 10px 16px;
    font-size: 14px;
    min-height: 44px;
    /* 모바일에서도 터치 가능한 크기 */
}

.btn-block {
    width: 100%;
    display: block;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 카드 - 모바일 최적화 */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.card-header {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-body {
    padding: 0;
}

/* 입력 필드 - 모바일 최적화 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 15px;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    /* 모바일에서 더 큰 패딩 */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    /* iOS 줌 방지 */
    min-height: 48px;
    /* 터치 친화적 */
    -webkit-appearance: none;
    appearance: none;
    background-color: white;
}

/* iOS 줌 방지 */
.form-control:focus {
    font-size: 16px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* 체크박스 */
.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
}

.form-check-input {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    flex: 1;
}

/* 메뉴 버튼 그리드 - 모바일 1열 */
.menu-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.menu-card {
    background-color: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    text-align: left;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 80px;
    -webkit-tap-highlight-color: transparent;
}

.menu-card:active {
    transform: scale(0.98);
    background-color: var(--bg-color);
}

.menu-card h3 {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 600;
}

.menu-card .menu-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.menu-card .menu-content {
    flex: 1;
}

.menu-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

/* 상태 뱃지 */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary {
    background-color: #e3f2fd;
    color: var(--primary-color);
}

.badge-success {
    background-color: #e8f5e9;
    color: var(--success-color);
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

/* QR 코드 영역 */
.qr-section {
    text-align: center;
    padding: 24px;
}

.qr-code {
    width: 200px;
    height: 200px;
    background-color: #f0f0f0;
    border: 2px dashed var(--border-color);
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.qr-code::before {
    content: "QR Code";
    color: var(--text-secondary);
}

/* 편집 영역 */
.edit-section {
    margin-bottom: 24px;
}

.edit-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.edit-actions {
    display: flex;
    gap: 8px;
}

/* 행 추가 버튼 */
.row-add-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

/* 예배 순서 행 */
.worship-row {
    background-color: var(--bg-color);
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.worship-row-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

/* 미리보기 영역 - 모바일 최적화 */
.preview-section {
    background-color: #f8f9fa;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    min-height: 300px;
}

.preview-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* 목록 */
.list-item {
    background-color: var(--card-bg);
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.list-item-meta {
    color: var(--text-secondary);
    font-size: 14px;
}

.list-item-actions {
    display: flex;
    gap: 8px;
}

/* 2열 레이아웃 - 항상 1열 (모바일 전용) */
.two-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 탭 스위처 (모바일용) */
.tab-switcher {
    display: flex;
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.tab-button {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
}

.tab-button.active {
    background-color: var(--primary-color);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 탭 스위처는 항상 표시 (모바일 전용) */

/* 인덱스 페이지 */
.screen-list h1 {
    font-size: 24px;
    margin-bottom: 12px;
}

.screen-list>p {
    margin-bottom: 24px;
    color: var(--text-secondary);
}

.screen-list h2 {
    margin: 32px 0 16px;
    font-size: 20px;
    font-weight: 600;
}

.screen-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.screen-card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-primary);
    text-align: left;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 80px;
    -webkit-tap-highlight-color: transparent;
}

.screen-card:active {
    transform: scale(0.98);
    background-color: var(--bg-color);
}

.screen-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.screen-card-content {
    flex: 1;
}

.screen-card h3 {
    margin-bottom: 4px;
    font-size: 17px;
    font-weight: 600;
}

.screen-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

/* 유틸리티 */
.text-center {
    text-align: center;
}

.text-secondary {
    color: var(--text-secondary);
}

.mt-16 {
    margin-top: 16px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-8 {
    gap: 8px;
}

.gap-16 {
    gap: 16px;
}

/* 스크롤 */
.scrollable {
    max-height: 600px;
    overflow-y: auto;
}

/* Beta 태그 스타일 */
.beta-tag {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: normal;
}

/* 뒤로가기 링크 */
.back-link {
    text-decoration: none;
    color: var(--text-primary);
}

.back-link:hover {
    color: var(--primary-color);
}

/* 선택된 주보 정보 표시 */
.selected-bulletin-info {
    margin-bottom: 16px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
}

/* 화면 목록 링크 */
.screen-list-link {
    color: var(--text-secondary);
    font-size: 14px;
    text-decoration: none;
}

.screen-list-link:hover {
    color: var(--primary-color);
}

/* Church Space Card - Redesigned */
.church-space-card {
    background: linear-gradient(135deg, #0046FF 0%, #0066FF 100%);
    color: white;
    border: none;
    overflow: hidden;
    position: relative;
    padding: 0 !important;
}

/* Church Display View (Default) */
.church-display {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    position: relative;
}

.church-photo-display {
    width: 70px;
    height: 70px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.church-photo-display img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-placeholder {
    text-align: center;
}

.church-info-display {
    flex: 1;
}

.church-name-display {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: white;
    letter-spacing: -0.3px;
}

.church-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    font-weight: 400;
}

.church-edit-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.7;
}

.church-edit-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
    transform: scale(1.05);
}

/* Church Edit Form (Hidden by default) */
.church-edit-form {
    padding: 16px;
    background: white;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.edit-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.close-edit-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: none;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-edit-btn:hover {
    background: var(--border-color);
}

/* Small Upload Photo in Edit Form */
.church-photo-upload-small {
    width: 70px;
    height: 70px;
    border-radius: 10px;
    background: var(--bg-color);
    border: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    overflow: hidden;
    position: relative;
}

.church-photo-upload-small:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

.upload-placeholder-small {
    text-align: center;
    color: var(--text-secondary);
}

.church-photo-upload-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Legacy styles - kept for compatibility */
.church-photo-upload {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px dashed rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    overflow: hidden;
    position: relative;
}

.church-photo-upload:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.02);
}

.church-photo-upload .upload-placeholder {
    text-align: center;
    color: white;
}

.church-photo-upload img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Bulletin Structure Builder Styles */
.bulletin-structure {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.structure-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: move;
    transition: all 0.2s;
    user-select: none;
}

.structure-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 1px 4px rgba(0, 70, 255, 0.15);
}

.structure-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.structure-item.drag-over {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-1px);
}

.drag-handle {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: grab;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.section-icon {
    font-size: 18px;
}

.section-name {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.remove-section-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-color);
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.remove-section-btn:hover {
    background: var(--danger-color);
    color: white;
    transform: scale(1.1);
}