/* ==========================================
   Blog Design System — Pure Black & White
   Inspired by Naver Blog Layout
   ========================================== */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

:root {
    --black: #111111;
    --gray-900: #222222;
    --gray-800: #333333;
    --gray-700: #555555;
    --gray-500: #888888;
    --gray-400: #aaaaaa;
    --gray-300: #cccccc;
    --gray-200: #e0e0e0;
    --gray-100: #f0f0f0;
    --gray-50: #f7f7f7;
    --white: #ffffff;
    --bg: #ffffff;
    --border: #e8e8e8;
    --max-width: 760px;
    --transition: 0.15s ease;
}

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

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: var(--bg);
    color: var(--black);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

/* ===== HEADER ===== */
.blog-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 10px 24px;
    min-height: 52px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.blog-logo {
    font-size: 16px;
    font-weight: 800;
    color: var(--black);
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.header-nav-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-btn {
    color: #e53935;
    border: 1px solid #e53935;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: 0.2s;
}

.nav-btn:hover {
    background-color: #ffebee;
    color: #c62828;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.header-btn {
    background: none;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

.header-btn:hover {
    border-color: var(--black);
    color: var(--black);
}

/* ===== BLOG HERO ===== */
.blog-hero {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 56px 24px 40px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.blog-hero-name {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: -1px;
    margin-bottom: 10px;
    color: var(--black);
}

.blog-hero-desc {
    font-size: 14px;
    color: var(--gray-500);
    line-height: 1.5;
}

/* ===== MAIN CONTENT ===== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== CATEGORY TABS ===== */
.category-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.cat-tab {
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: var(--transition);
    font-family: inherit;
}

.cat-tab:hover {
    color: var(--black);
}

.cat-tab.active {
    color: var(--black);
    border-bottom-color: var(--black);
}

/* ===== POST COUNT ===== */
.post-count-bar {
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.post-count {
    font-size: 13px;
    color: var(--gray-500);
}

.post-count strong {
    color: var(--black);
    font-weight: 800;
}

/* ===== SEARCH ===== */
.search-compact {
    position: relative;
}

.search-compact input {
    width: 180px;
    padding: 7px 12px 7px 30px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    background: var(--white);
    transition: var(--transition);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%23aaa' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
}

.search-compact input:focus {
    outline: none;
    border-color: var(--black);
    width: 240px;
}

/* ===== POST LIST ===== */
.post-list {
    display: flex;
    flex-direction: column;
}

.post-item {
    padding: 28px 0;
    border-bottom: 1px solid var(--gray-100);
    display: block;
    cursor: pointer;
    transition: var(--transition);
}

.post-item:last-child {
    border-bottom: 1px solid var(--border);
}

.post-item:hover .post-item-title {
    color: var(--gray-700);
}

.post-item-category {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-500);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.post-item-title {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.4;
    margin-bottom: 8px;
    word-break: keep-all;
    transition: var(--transition);
    letter-spacing: -0.3px;
}

.post-item-summary {
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.6;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-item-meta {
    font-size: 12px;
    color: var(--gray-400);
    display: flex;
    gap: 10px;
    align-items: center;
}

.post-item-thumb {
    font-size: 18px;
    margin-right: 2px;
}

/* ===== EMPTY / LOADING ===== */
.loading-state {
    text-align: center;
    padding: 60px 0;
    color: var(--gray-400);
    font-size: 13px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--black);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--gray-400);
}

.empty-state .emoji {
    font-size: 36px;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 14px;
}

/* ===== ARTICLE VIEW ===== */
.article-wrap {
    padding: 40px 0 60px;
}

.article-category {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-500);
    margin-bottom: 12px;
    letter-spacing: 0.3px;
}

.article-title {
    font-size: 28px;
    font-weight: 900;
    line-height: 1.35;
    margin-bottom: 16px;
    word-break: keep-all;
    letter-spacing: -0.5px;
    overflow-wrap: break-word; /* 긴 단어 대응 */
}

.article-meta {
    font-size: 13px;
    color: var(--gray-400);
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
    display: flex;
    gap: 12px;
}

.article-body {
    font-size: 16px;
    line-height: 1.9;
    color: var(--gray-800);
    word-break: keep-all;
}

.article-body h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--black);
    margin: 44px 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--black);
    letter-spacing: -0.3px;
}

.article-body h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 36px 0 12px;
    color: var(--black);
}

.article-body p {
    margin-bottom: 18px;
}

.article-body ul,
.article-body ol {
    margin: 0 0 18px 20px;
    padding: 0;
}

.article-body li {
    margin-bottom: 6px;
}

.article-body strong {
    font-weight: 800;
    color: var(--black);
}

.article-body blockquote {
    border-left: 3px solid var(--black);
    padding: 14px 20px;
    margin: 24px 0;
    color: var(--gray-700);
    background: var(--gray-50);
}

.article-body img {
    border-radius: 4px;
    margin: 20px 0;
    display: block;
}

/* ===== QUILL ALIGNMENT (must match editor output) ===== */
.article-body .ql-align-center,
.article-body p.ql-align-center,
.article-body h1.ql-align-center,
.article-body h2.ql-align-center,
.article-body h3.ql-align-center {
    text-align: center;
}

.article-body .ql-align-right,
.article-body p.ql-align-right {
    text-align: right;
}

.article-body .ql-align-justify,
.article-body p.ql-align-justify {
    text-align: justify;
}

.article-body .ql-ui {
    display: none;
}

.article-body a {
    color: var(--black);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.article-body pre {
    background: var(--gray-50);
    padding: 16px 20px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 20px 0;
    font-size: 14px;
}

.article-body code {
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 14px;
}

/* ===== ARTICLE NAV ===== */
.article-nav {
    display: flex;
    gap: 10px;
    margin-top: 40px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.article-nav a,
.article-nav button {
    flex: 1;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--gray-900);
}

.btn-outline {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-200) !important;
}

.btn-outline:hover {
    border-color: var(--black) !important;
    color: var(--black);
}

/* ===== FOOTER ===== */
.blog-footer {
    max-width: var(--max-width);
    margin: 0 auto;
    text-align: center;
    padding: 40px 24px;
    color: var(--gray-400);
    font-size: 12px;
    border-top: 1px solid var(--border);
}

.blog-footer a {
    color: var(--gray-400);
}

.blog-footer a:hover {
    color: var(--black);
}

/* ===== ADMIN: LOGIN ===== */
.login-container {
    max-width: 360px;
    margin: 100px auto;
    padding: 0 20px;
}

.login-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px 28px;
    text-align: center;
}

.login-card h1 {
    font-size: 20px;
    margin-bottom: 6px;
    font-weight: 800;
}

.login-card p {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 24px;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 12px;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-500);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--white);
    color: var(--black);
}

.form-input:focus {
    outline: none;
    border-color: var(--black);
}

.btn-full {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    background: var(--black);
    color: var(--white);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    margin-top: 8px;
}

.btn-full:hover {
    background: var(--gray-900);
}

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

/* ===== EDITOR ===== */
.editor-meta {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 12px;
}

.editor-meta .form-group:last-child {
    margin-bottom: 0;
}

.meta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.editor-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.ql-container {
    font-family: 'Pretendard', sans-serif !important;
}

.ql-editor {
    min-height: 400px;
    font-size: 16px;
    line-height: 1.85;
}

.ql-toolbar {
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
    background: var(--gray-50);
}

.ql-container {
    border: none !important;
}

.publish-bar {
    position: sticky;
    bottom: 0;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    z-index: 50;
}

/* ===== MANAGE LIST ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h2 {
    font-size: 16px;
    font-weight: 800;
}

.manage-list {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.manage-card {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    gap: 10px;
    border-bottom: 1px solid var(--gray-100);
    background: var(--white);
}

.manage-card:last-child {
    border-bottom: none;
}

.manage-info {
    flex: 1;
}

.manage-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}

.manage-date {
    font-size: 12px;
    color: var(--gray-400);
}

.manage-actions {
    display: flex;
    gap: 4px;
}

.btn-sm {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--gray-300);
    background: var(--white);
    color: var(--gray-700);
    font-family: inherit;
    transition: var(--transition);
    text-decoration: none;
}

.btn-sm:hover {
    border-color: var(--black);
    color: var(--black);
}

.btn-sm.danger:hover {
    border-color: #c00;
    color: #c00;
}

/* ===== CATEGORY MANAGE ===== */
.category-manage {
    margin-bottom: 28px;
}

.category-manage h2 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 12px;
}

.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.category-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

.category-tag button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: var(--gray-400);
    padding: 0;
    line-height: 1;
}

.category-tag button:hover {
    color: #c00;
}

.category-add {
    display: flex;
    gap: 6px;
}

.category-add input {
    flex: 1;
    padding: 7px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
}

.category-add input:focus {
    outline: none;
    border-color: var(--black);
}

.category-add button {
    padding: 7px 16px;
    background: var(--black);
    color: var(--white);
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--black);
    color: var(--white);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    z-index: 9999;
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ===== PREMIUM AI BUTTONS (Global) ===== */
.ai-button-container {
    text-align: center;
    margin: 40px 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

@keyframes pulseGlow {
    0% { transform: scale(1); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); }
    50% { transform: scale(1.05); box-shadow: 0 4px 20px rgba(229, 57, 53, 0.4); }
    100% { transform: scale(1); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); }
}

.premium-ai-btn {
    display: inline-block;
    padding: 18px 36px;
    background: linear-gradient(135deg, #d32f2f 0%, #f44336 100%);
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 50px;
    font-weight: bold;
    font-size: 18px;
    animation: pulseGlow 2s infinite;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: fit-content;
}

.premium-ai-btn.lotto {
    background: linear-gradient(135deg, #1976d2 0%, #2196f3 100%);
}

.premium-ai-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .premium-ai-btn {
        padding: 14px 28px;
        font-size: 16px;
        border-radius: 15px;
        width: 90%;
        max-width: 320px;
    }
    .ai-button-container {
        gap: 10px;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .header-inner {
        padding: 5px 12px;
        min-height: 52px;
        height: auto;
    }

    .header-left {
        gap: 4px; /* 버튼 2개를 위한 최소 간격 */
        flex-wrap: nowrap;
    }

    .header-nav-links {
        gap: 4px; /* 버튼 간격 축소 */
        flex-wrap: nowrap;
    }

    .nav-btn {
        padding: 4px 6px; /* 패딩 축소 */
        font-size: 11px; /* 폰트 축소 */
        letter-spacing: -0.6px;
        white-space: nowrap;
    }

    .blog-logo {
        font-size: 13.5px; /* 로고 소폭 축소 */
        letter-spacing: -0.6px;
    }

    .header-btn {
        padding: 4px 10px; /* 보조 버튼 축소 */
        font-size: 11px;
        white-space: nowrap;
    }

    .blog-hero {
        padding: 40px 16px 32px;
    }

    .blog-hero-name {
        font-size: 26px;
    }

    .container {
        padding: 0 16px;
    }

    .post-item-title {
        font-size: 17px;
    }

    .article-title {
        font-size: 1.35rem; /* 약 21.6px */
        line-height: 1.4;
    }

    .meta-row {
        grid-template-columns: 1fr;
    }

    .search-compact input {
        width: 140px;
    }

    .search-compact input:focus {
        width: 180px;
    }

    .blog-footer {
        padding: 32px 16px;
    }
}