:root {
    --bg-base: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --bg-panel-hover: rgba(51, 65, 85, 0.8);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --border-color: rgba(255, 255, 255, 0.08);
    --font-sans: 'Noto Sans KR', 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    line-height: 1.6;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Glassmorphism utility */
.glass {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-color);
}

/* Sidebar */
.sidebar {
    width: 380px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-color);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header h1 i {
    -webkit-text-fill-color: var(--accent-blue);
}

.sidebar-header p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.auth-status {
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.auth-status a {
    color: var(--accent-blue);
    text-decoration: none;
}

.auth-status a:hover {
    text-decoration: underline;
}

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

.text-locked-notice {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
}

.text-locked-notice a {
    color: var(--accent-blue);
    font-weight: 600;
    text-decoration: none;
}

.text-locked-notice a:hover {
    text-decoration: underline;
}

/* Search */
.search-container {
    padding: 20px 24px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-container input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.search-container input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Sermon List */
.sermon-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sermon-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sermon-item {
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.sermon-item:hover {
    background: var(--bg-panel-hover);
    border-color: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.sermon-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border-color: var(--accent-blue);
    box-shadow: inset 4px 0 0 var(--accent-blue);
}

.sermon-item h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sermon-item .meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sermon-item .channel {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sermon-item .tags-preview {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag-mini {
    font-size: 0.7rem;
    padding: 2px 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    color: var(--accent-blue);
}

/* Pagination */
.pagination {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-panel);
}

.btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

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

#pageInfo {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.welcome-screen {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-secondary);
    animation: fadeIn 0.8s ease;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 24px;
    color: rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-screen h2 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.hidden {
    display: none !important;
}

/* Detail Screen */
.detail-screen {
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.video-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
}

.detail-header {
    margin-bottom: 40px;
}

.detail-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 20px;
    align-items: center;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.hashtag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-large {
    padding: 6px 14px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tag-large:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

/* Pericope / Scripture / Hymn sections */
.pericope-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.08);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.confidence-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    background: #94a3b8; /* 기본: 회색(미확정/낮음) */
}

.confidence-dot.high { background: #34d399; }   /* >=0.99 */
.confidence-dot.medium { background: #fbbf24; } /* >=0.90 */

.reference-section {
    margin-bottom: 28px;
}

.reference-section h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.reference-chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.scripture-chip {
    padding: 6px 14px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.hymn-chip {
    padding: 6px 14px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.pericope-detail-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
}

.pericope-detail-badge .source-note {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.detail-body {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px;
    backdrop-filter: blur(12px);
}

.detail-body h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    margin-bottom: 24px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.text-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #cbd5e1;
    white-space: pre-wrap;
}

/* 검색 조건 / 본문 순위 버튼 */
.search-btn-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.search-btn-row .filter-trigger-btn {
    margin-top: 0;
}

.filter-trigger-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-trigger-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.filter-count {
    background: var(--accent-blue);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* 검색 조건 팝업 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

.modal-box {
    width: 360px;
    max-width: 90vw;
    background: #1e293b;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-back-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-back-btn:hover {
    color: var(--text-primary);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 8px;
    cursor: pointer;
    border-radius: 8px;
    user-select: none;
}

.filter-option:hover {
    background: rgba(255, 255, 255, 0.04);
}

.filter-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.filter-option span {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.btn-primary {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* 성구 순위 팝업 */
.ranking-modal-box {
    width: 560px;
    max-width: 92vw;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
}

.ranking-hint {
    padding: 10px 20px 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.ranking-body {
    padding: 8px 0 4px;
    overflow-y: auto;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.ranking-table th {
    position: sticky;
    top: 0;
    background: #1e293b;
    text-align: left;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.78rem;
    border-bottom: 1px solid var(--border-color);
}

.ranking-table td {
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-color);
}

.ranking-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

.ranking-row:hover {
    background: rgba(59, 130, 246, 0.08);
}

/* Loading Spinner */
.loader {
    border: 3px solid rgba(255,255,255,0.1);
    border-top: 3px solid var(--accent-blue);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
