/* ============================================
   Content Agent - Shared Styles
   ============================================ */

/* Navigation */
.top-nav {
    background: hsl(var(--card));
    border-bottom: 1px solid hsl(var(--border));
    position: sticky;
    top: 0;
    z-index: 40;
}

.nav-inner {
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-size: 1rem;
    font-weight: 700;
    color: hsl(var(--primary));
    text-decoration: none;
    letter-spacing: -0.025em;
}

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 8px 14px;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
}

.nav-link.active {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
}

/* Main content */
.main-content {
    max-width: 1024px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgb(0 0 0 / 0.15);
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    max-width: 360px;
}

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

.toast-info {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.toast-success {
    background: hsl(142 76% 36%);
    color: #fff;
}

.toast-error {
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}

/* ============================================
   Dashboard
   ============================================ */

/* Create mode tabs */
.create-mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
}

.create-mode-tab {
    flex: 1;
    padding: 14px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
    border: 1px solid hsl(var(--border));
    border-bottom: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.create-mode-tab:first-child {
    border-radius: var(--radius) 0 0 0;
}

.create-mode-tab:last-child {
    border-radius: 0 var(--radius) 0 0;
    border-left: none;
}

.create-mode-tab.active {
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    border-bottom: 1px solid hsl(var(--card));
    margin-bottom: -1px;
    position: relative;
    z-index: 1;
}

/* Create section */
.create-section {
    margin-bottom: 32px;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 24px;
}

.create-section .form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.create-section textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px 14px;
    font-size: 0.875rem;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    outline: none;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.create-section textarea:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.create-section select {
    height: 40px;
    padding: 0 32px 0 12px;
    font-size: 0.875rem;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    outline: none;
    background: hsl(var(--background));
    cursor: pointer;
    font-family: inherit;
    color: hsl(var(--foreground));
    appearance: none;
    -webkit-appearance: none;
    min-width: 140px;
}

.input-field {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    font-size: 0.875rem;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    outline: none;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.field-hint {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin: 4px 0 0;
}

.required {
    color: hsl(var(--destructive));
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 6px;
}

/* Partner form */
.partner-form {
    max-width: 600px;
}

.btn-full {
    width: 100%;
    margin-top: 8px;
}

/* Image upload slots */
.image-upload-area {
    margin-top: 8px;
}

.image-slots {
    display: flex;
    gap: 12px;
}

.image-slot {
    width: 120px;
    height: 120px;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.image-slot.empty {
    border: 2px dashed hsl(var(--border));
    background: hsl(var(--muted) / 0.3);
}

.image-slot.add {
    border: 2px dashed hsl(var(--muted-foreground) / 0.4);
    background: hsl(var(--muted) / 0.3);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: border-color 0.15s, background 0.15s;
}

.image-slot.add:hover {
    border-color: hsl(var(--primary));
    background: hsl(var(--primary) / 0.05);
}

.image-slot.add span:first-child {
    font-size: 1.5rem;
    color: hsl(var(--muted-foreground));
    line-height: 1;
}

.image-slot-label {
    font-size: 0.6875rem;
    color: hsl(var(--muted-foreground));
}

.image-slot.filled {
    border: 2px solid hsl(var(--border));
}

.image-slot.filled img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-slot-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgb(0 0 0 / 0.6);
    color: #fff;
    font-size: 0.875rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.image-slot-remove:hover {
    background: hsl(var(--destructive));
}

/* Filter tabs */
.filter-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid hsl(var(--border));
    padding-bottom: 0;
}

.filter-tab {
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}

.filter-tab:hover {
    color: hsl(var(--foreground));
}

.filter-tab.active {
    color: hsl(var(--foreground));
    border-bottom-color: hsl(var(--primary));
}

/* Post list */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: hsl(var(--border));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    overflow: hidden;
}

.post-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 16px;
    align-items: center;
    padding: 14px 20px;
    background: hsl(var(--card));
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
    cursor: pointer;
}

.post-item:hover {
    background: hsl(var(--muted) / 0.5);
}

.post-title {
    font-weight: 500;
    color: hsl(var(--foreground));
    font-size: 0.875rem;
}

.post-topic {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-top: 2px;
}

.post-meta {
    text-align: right;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-drafting     { background: hsl(48 96% 89%);  color: hsl(25 95% 43%); }
.badge-draft_ready  { background: hsl(213 94% 90%); color: hsl(213 94% 40%); }
.badge-revision_requested { background: hsl(280 60% 90%); color: hsl(280 60% 40%); }
.badge-revising     { background: hsl(48 96% 89%);  color: hsl(25 95% 43%); }
.badge-approved     { background: hsl(142 76% 90%); color: hsl(142 76% 30%); }
.badge-published_ghost { background: hsl(142 76% 85%); color: hsl(142 76% 25%); }
.badge-sns_converting  { background: hsl(200 80% 90%); color: hsl(200 80% 35%); }
.badge-completed    { background: hsl(142 76% 36%); color: #fff; }
.badge-error        { background: hsl(0 84% 92%);   color: hsl(0 84% 50%); }

/* ============================================
   Post Detail
   ============================================ */

/* Back button */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    margin-bottom: 20px;
    transition: color 0.15s;
}

.back-btn:hover {
    color: hsl(var(--foreground));
}

.back-btn svg {
    width: 16px;
    height: 16px;
}

/* Status banner */
.status-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-banner.loading {
    background: hsl(48 96% 89%);
    color: hsl(25 95% 43%);
}

.status-banner.ready {
    background: hsl(213 94% 90%);
    color: hsl(213 94% 40%);
}

.status-banner.done {
    background: hsl(142 76% 90%);
    color: hsl(142 76% 30%);
}

.status-banner.err {
    background: hsl(0 84% 92%);
    color: hsl(0 84% 50%);
}

.spinner-small {
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Article preview */
.article-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
}

.article-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    margin: 0 0 24px 0;
    line-height: 1.4;
}

.article-body {
    font-size: 0.9375rem;
    line-height: 1.8;
    color: hsl(var(--foreground));
}

.article-body h2 { font-size: 1.25rem; margin: 24px 0 12px; font-weight: 600; }
.article-body h3 { font-size: 1.1rem; margin: 20px 0 10px; font-weight: 600; }
.article-body p { margin: 0 0 16px; }
.article-body ul, .article-body ol { margin: 0 0 16px; padding-left: 24px; }
.article-body li { margin-bottom: 6px; }
.article-body strong { font-weight: 600; }
.article-body a { color: hsl(213 94% 45%); text-decoration: underline; }
.article-body blockquote {
    border-left: 3px solid hsl(var(--border));
    padding-left: 16px;
    margin: 16px 0;
    color: hsl(var(--muted-foreground));
}
.article-body img {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 16px 0;
}

/* Tags */
.tags-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid hsl(var(--border));
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Action buttons row */
.action-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

/* Naver copy dropdown */
.copy-dropdown {
    position: relative;
    display: inline-block;
}

.copy-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgb(0 0 0 / 0.12);
    z-index: 20;
    min-width: 160px;
    overflow: hidden;
}

.copy-menu.show {
    display: block;
}

.copy-menu-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    font-size: 0.8125rem;
    text-align: left;
    background: none;
    border: none;
    color: hsl(var(--foreground));
    cursor: pointer;
    transition: background 0.15s;
}

.copy-menu-item:hover {
    background: hsl(var(--muted));
}

/* Revision history */
.revision-section {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    overflow: hidden;
}

.revision-toggle {
    width: 100%;
    padding: 14px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    color: hsl(var(--foreground));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.revision-toggle:hover {
    background: hsl(var(--muted) / 0.3);
}

.revision-list {
    display: none;
    border-top: 1px solid hsl(var(--border));
}

.revision-list.show {
    display: block;
}

.revision-item {
    padding: 14px 20px;
    border-bottom: 1px solid hsl(var(--border));
    font-size: 0.8125rem;
}

.revision-item:last-child {
    border-bottom: none;
}

.revision-meta {
    color: hsl(var(--muted-foreground));
    margin-bottom: 4px;
}

.revision-feedback {
    color: hsl(var(--foreground));
}

/* ============================================
   SNS Page
   ============================================ */
.sns-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
}

.sns-tab {
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
    border: none;
    border-radius: var(--radius) var(--radius) 0 0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sns-tab.active {
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    box-shadow: 0 -1px 0 hsl(var(--primary)) inset;
}

.sns-panel {
    display: none;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 0 var(--radius) var(--radius) var(--radius);
    padding: 24px;
}

.sns-panel.active {
    display: block;
}

.sns-content-area {
    width: 100%;
    min-height: 200px;
    padding: 14px;
    font-size: 0.875rem;
    font-family: inherit;
    line-height: 1.7;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--muted) / 0.3);
    color: hsl(var(--foreground));
    resize: none;
}

.sns-hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.sns-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* ============================================
   Settings Page
   ============================================ */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.settings-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
}

.settings-card h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin: 0 0 4px;
}

.settings-card .desc {
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
    margin: 0 0 20px;
}

/* Tag list */
.tag-group-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 16px 0 8px;
}

.tag-group-label:first-child {
    margin-top: 0;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: hsl(var(--secondary));
    border-radius: 9999px;
    font-size: 0.8125rem;
    color: hsl(var(--foreground));
}

.tag-chip.inactive {
    opacity: 0.4;
    text-decoration: line-through;
}

.tag-chip-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}

.tag-chip-btn:hover {
    color: hsl(var(--destructive));
}

.tag-add-row {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    align-items: center;
}

.tag-add-row input {
    flex: 1;
    height: 36px;
    padding: 0 12px;
    font-size: 0.8125rem;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    outline: none;
    font-family: inherit;
    color: hsl(var(--foreground));
    background: hsl(var(--background));
}

.tag-add-row select {
    height: 36px;
    padding: 0 28px 0 10px;
    font-size: 0.8125rem;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    outline: none;
    font-family: inherit;
    color: hsl(var(--foreground));
    background: hsl(var(--background));
    appearance: none;
    cursor: pointer;
}

/* Category list */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    font-size: 0.8125rem;
}

.category-item input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.8125rem;
    font-family: inherit;
    color: hsl(var(--foreground));
    background: transparent;
}

.category-item .cat-order {
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
    min-width: 20px;
}

/* Style guide */
.style-guide-item {
    margin-bottom: 20px;
}

.style-guide-item:last-child {
    margin-bottom: 0;
}

.style-guide-item label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 6px;
}

.style-guide-item .sg-desc {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 8px;
}

.style-guide-item textarea {
    width: 100%;
    min-height: 160px;
    padding: 12px 14px;
    font-size: 0.8125rem;
    font-family: inherit;
    line-height: 1.6;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    outline: none;
    color: hsl(var(--foreground));
    background: hsl(var(--background));
    resize: vertical;
    transition: border-color 0.2s;
}

.style-guide-item textarea:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

/* ============================================
   Modal
   ============================================ */
.modal-body textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 14px;
    font-size: 0.875rem;
    font-family: inherit;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    outline: none;
    color: hsl(var(--foreground));
    background: hsl(var(--background));
    resize: vertical;
    margin-bottom: 16px;
}

.modal-body textarea:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

/* ============================================
   Utilities
   ============================================ */
.text-muted {
    color: hsl(var(--muted-foreground));
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8125rem;
}

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

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 640px) {
    .main-content {
        padding: 20px 16px;
    }

    .create-section .form-row {
        flex-direction: column;
    }

    .action-row {
        flex-direction: column;
    }

    .post-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .post-meta {
        text-align: left;
    }

    .article-card {
        padding: 20px;
    }

    .tag-add-row {
        flex-direction: column;
    }

    .image-slots {
        flex-wrap: wrap;
    }

    .image-slot {
        width: 100px;
        height: 100px;
    }
}
