/* app/static/style.css */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 700px;
    margin: 40px auto;
    padding: 0 20px;
}

h1 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #03c75a;
}

h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #555;
}

/* --- Step transitions --- */
.step {
    display: none;
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    animation: fadeIn 0.25s ease;
}

.step.active {
    display: block;
}

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

.step-back {
    font-size: 13px;
    color: #888;
    cursor: pointer;
    margin-bottom: 12px;
}
.step-back:hover { color: #03c75a; }

/* --- Guide --- */
.guide {
    background: #f0faf4;
    border-left: 3px solid #03c75a;
    padding: 14px 18px;
    margin-bottom: 20px;
    border-radius: 0 6px 6px 0;
    font-size: 14px;
    color: #555;
}

.guide p { margin-bottom: 8px; }

.guide ol {
    padding-left: 20px;
    margin: 0;
}

.guide li {
    padding: 2px 0;
    color: #666;
}

.free-notice {
    margin-top: 8px;
    font-size: 13px;
    color: #03c75a;
    font-weight: 500;
}
.access-code-group {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}
.access-code-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}
.access-code-label {
    font-size: 13px;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}
.access-code-bar input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
.access-code-hint {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}
.access-code-hint.code-valid {
    color: #03c75a;
    font-weight: 500;
}
.access-code-hint.code-master {
    color: #03c75a;
    font-weight: 600;
}
.access-code-hint.code-invalid {
    color: #e74c3c;
    font-weight: 500;
}
.btn-check-code {
    padding: 8px 16px;
    background: #03c75a;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}
.btn-check-code:hover {
    background: #02b350;
}

/* --- Keyword --- */
.keyword-group {
    margin-bottom: 16px;
}

.keyword-input-row {
    display: flex;
    gap: 8px;
}

.keyword-input-row input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.keyword-input-row input:focus { outline: none; border-color: #03c75a; }

.keyword-hint {
    font-size: 12px;
    color: #aaa;
    margin-top: 6px;
}

/* --- Keyword Search Results --- */
.keyword-loading { margin: 16px 0; }
.keyword-loading-text { font-size: 14px; color: #666; margin-top: 8px; }
.keyword-loading-fill { width: 100%; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

.keyword-results-header {
    font-weight: 600;
    color: #03c75a;
    margin-bottom: 12px;
    font-size: 15px;
}

.keyword-results-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 6px;
}

.keyword-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: background 0.1s;
}
.keyword-result-item:hover { background: #f9f9f9; }
.keyword-result-item:last-child { border-bottom: none; }
.keyword-result-item .post-title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.keyword-result-item .post-date {
    flex-shrink: 0;
    font-size: 12px;
    color: #999;
    white-space: nowrap;
}
.keyword-result-item input[type="checkbox"] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: #03c75a;
}

.select-all-label {
    font-size: 13px;
    font-weight: 400;
    color: #888;
    cursor: pointer;
    margin-left: 8px;
}
.select-all-label input { vertical-align: middle; accent-color: #03c75a; }

.keyword-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.selected-count {
    font-size: 13px;
    color: #888;
}
.sort-option {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #555;
    margin: 8px 0;
}
.sort-option label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}
.sort-option input[type="radio"] {
    accent-color: #03c75a;
}

.search-loading {
    color: #888;
    padding: 12px 8px;
    animation: pulse 1.5s ease-in-out infinite;
}

.category-generate {
    margin-top: 16px;
    padding: 16px;
    background: #f0faf4;
    border: 1px solid #03c75a;
    border-radius: 6px;
    animation: fadeIn 0.25s ease;
}

.category-generate-summary {
    margin-bottom: 12px;
    color: #555;
    font-size: 14px;
}

.btn-secondary {
    background: #888;
}
.btn-secondary:hover { background: #666; }

/* --- Inputs & Buttons --- */
.input-group {
    display: flex;
    gap: 8px;
}

.input-group input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.input-group input:focus { outline: none; border-color: #03c75a; }

button, .download-btn {
    padding: 10px 20px;
    background: #03c75a;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

button:hover, .download-btn:hover { background: #02b351; }
button:disabled { background: #ccc; cursor: not-allowed; }

#cancel-btn { background: #e74c3c; }
#cancel-btn:hover { background: #c0392b; }

.toggle-direct { margin-top: 10px; font-size: 13px; color: #888; }

/* --- Search Results --- */
.results-list { margin-top: 15px; }

.result-item {
    padding: 12px 16px;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.result-item:hover { background: #f0faf4; border-color: #03c75a; }

.result-item .name { font-weight: 600; }
.result-item .desc { font-size: 13px; color: #888; margin-top: 4px; }

/* --- Categories --- */
.category-item {
    padding: 12px 16px;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.category-item:hover { background: #f0faf4; border-color: #03c75a; }
.category-item.selected { background: #f0faf4; border-color: #03c75a; }

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

.category-header .name { font-weight: 600; }
.category-header .count { font-size: 12px; color: #03c75a; white-space: nowrap; margin-left: 12px; }

.preview-list {
    list-style: none;
    margin-top: 8px;
    padding-left: 8px;
    border-left: 2px solid #e0e0e0;
}

.preview-post {
    font-size: 13px;
    color: #666;
    padding: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-date {
    font-size: 11px;
    color: #aaa;
    margin-left: 8px;
}

/* --- PDF Options --- */
.option-group { margin-bottom: 16px; }
.option-group > label { font-weight: 600; display: block; margin-bottom: 8px; }
.radio-group { display: flex; gap: 20px; }
.radio-group label { font-weight: 400; }

/* --- Progress --- */
.progress-bar {
    width: 100%;
    height: 24px;
    background: #eee;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: #03c75a;
    width: 0%;
    transition: width 0.3s;
    border-radius: 12px;
}

#progress-text { font-size: 14px; color: #666; margin-bottom: 12px; }

/* --- Error & Warning --- */
.error {
    background: #fdf0f0;
    border: 1px solid #e74c3c;
    color: #c0392b;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

#exceeded-warning {
    background: #fef9e7;
    border: 1px solid #f39c12;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

/* --- Download --- */
.btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
