/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-bg: #f4f5f7;
    --color-surface: #ffffff;
    --color-nav: #1e293b;
    --color-nav-hover: #334155;
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;
    --sidebar-width: 220px;
    --topbar-height: 56px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
}

/* === Login Screen === */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.login-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    margin: 1rem;
}

.login-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-nav);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.75rem;
}

.login-error {
    background: #fef2f2;
    color: var(--color-danger);
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* === Forms === */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.3rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="datetime-local"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color 0.15s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
    text-decoration: none;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

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

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

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

.btn-outline:hover:not(:disabled) {
    background: var(--color-bg);
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
}

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

/* === Top Bar === */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--color-nav);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.25rem;
}

.user-display {
    font-size: 0.85rem;
    opacity: 0.85;
}

.top-bar .btn-outline {
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}

.top-bar .btn-outline:hover {
    background: rgba(255,255,255,0.1);
}

/* === Sidebar === */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: 0.75rem 0;
    overflow-y: auto;
    z-index: 90;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1.25rem;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
}

.nav-link:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.nav-link.active {
    color: var(--color-primary);
    background: #eff6ff;
    font-weight: 600;
}

.nav-icon {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
}

/* === Content Area === */
.content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 1.5rem;
    min-height: calc(100vh - var(--topbar-height));
}

/* === Cards === */
.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

/* === Status Badges === */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-draft { background: #dbeafe; color: #1d4ed8; }
.badge-scheduled { background: #fef3c7; color: #b45309; }
.badge-publishing { background: #e0e7ff; color: #4338ca; }
.badge-published { background: #dcfce7; color: #15803d; }
.badge-partial_fail { background: #fed7aa; color: #c2410c; }
.badge-failed { background: #fecaca; color: #b91c1c; }

.badge-pending { background: #f1f5f9; color: #475569; }
.badge-processing { background: #e0e7ff; color: #4338ca; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-fail { background: #fecaca; color: #b91c1c; }

.badge-active { background: #dcfce7; color: #15803d; }
.badge-expired { background: #fef3c7; color: #b45309; }
.badge-error { background: #fecaca; color: #b91c1c; }

/* === Platform Icons (text-based) === */
.platform-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
}

.platform-tag-ig { background: #fce7f3; color: #be185d; }
.platform-tag-fb { background: #dbeafe; color: #1d4ed8; }
.platform-tag-x { background: #1e293b; color: #fff; }
.platform-tag-tiktok { background: #111; color: #fff; }
.platform-tag-youtube { background: #fecaca; color: #b91c1c; }

/* === Post List === */
.post-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.post-card-body {
    flex: 1;
    min-width: 0;
}

.post-caption {
    font-size: 0.9rem;
    color: var(--color-text);
    margin-bottom: 0.5rem;
    white-space: pre-wrap;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* === Grid Layout === */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* === Stats Row === */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* === Page Header === */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
}

/* === Loading / Empty States === */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--color-text-muted);
}

.spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--color-text-muted);
}

.empty-state p {
    margin-bottom: 1rem;
}

/* === Checkbox / Toggle Row === */
.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.checkbox-row label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    cursor: pointer;
}

/* === Utility === */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--color-text-muted); }
.text-small { font-size: 0.8rem; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* === Calendar Grid === */
.cal-card {
    padding: 1rem;
}

.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.cal-month-label {
    font-size: 1.1rem;
    font-weight: 700;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--color-border);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.cal-header {
    background: var(--color-bg);
    padding: 0.4rem 0.25rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.cal-cell {
    background: var(--color-surface);
    min-height: 70px;
    padding: 0.3rem;
    position: relative;
}

.cal-cell.cal-empty {
    background: var(--color-bg);
}

.cal-cell.cal-today {
    background: #eff6ff;
}

.cal-cell.cal-today .cal-day-num {
    color: var(--color-primary);
    font-weight: 700;
}

.cal-day-num {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 0.2rem;
}

.cal-posts {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.cal-post-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}

.cal-post-dot:hover {
    transform: scale(1.4);
}

.cal-more {
    font-size: 0.65rem;
    color: var(--color-text-muted);
    line-height: 10px;
}

.cal-platform-icons {
    display: inline-flex;
    gap: 0.2rem;
    font-size: 0.85rem;
}

.platform-status-icon {
    font-size: 0.85rem;
    cursor: default;
}

/* === Post Creator === */
.pc-dropzone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.pc-dropzone:hover,
.pc-dropzone-hover {
    border-color: var(--color-primary);
    background: #eff6ff;
}

.pc-dropzone-inner {
    pointer-events: none;
}

.pc-dropzone-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

/* Upload thumbnail grid */
.pc-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.pc-thumb-item {
    position: relative;
    width: 100px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--color-bg);
    cursor: grab;
    transition: opacity 0.15s, box-shadow 0.15s;
}

.pc-thumb-item:active {
    cursor: grabbing;
}

.pc-thumb-dragging {
    opacity: 0.4;
}

.pc-thumb-dragover {
    box-shadow: 0 0 0 2px var(--color-primary);
}

.pc-thumb-img {
    width: 100%;
    height: 70px;
    object-fit: cover;
    display: block;
}

.pc-thumb-placeholder {
    width: 100%;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--color-text-muted);
    background: var(--color-bg);
}

.pc-thumb-name {
    display: block;
    padding: 0.2rem 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pc-thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.pc-thumb-remove:hover {
    background: var(--color-danger);
}

/* Caption */
.pc-caption-count {
    text-align: right;
    margin-top: 0.25rem;
}

.pc-overrides {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--color-bg);
    border-radius: var(--radius);
}

/* Platform checkboxes with connection indicators */
.pc-platforms {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.pc-platform-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: background 0.12s, border-color 0.12s;
}

.pc-platform-label:has(input:checked) {
    border-color: var(--color-primary);
    background: #eff6ff;
}

.pc-platform-label:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
}

.pc-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.pc-dot-green {
    background: var(--color-success);
}

.pc-dot-red {
    background: var(--color-danger);
}

/* Audio section panel */
.pc-audio-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

/* Toggle labels */
.pc-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    cursor: pointer;
}

/* Schedule options */
.pc-schedule-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Submit actions */
.pc-actions {
    margin-top: 0.5rem;
    margin-bottom: 2rem;
}

.pc-actions .btn {
    min-width: 160px;
}

/* === Media Preview === */
.mp-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.mp-media-row {
    margin-bottom: 1rem;
}

.mp-media-label {
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.media-preview-container {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
}

.preview-card {
    flex-shrink: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.preview-card-label {
    padding: 0.35rem 0.5rem;
    font-weight: 600;
    text-align: center;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.preview-card-image {
    position: relative;
    overflow: hidden;
    background: #111;
}

.preview-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.preview-card-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.crop-overlay {
    position: absolute;
    inset: 0;
    cursor: crosshair;
    z-index: 3;
    transition: background 0.1s;
}

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

.crop-overlay-active {
    background: rgba(59, 130, 246, 0.12);
}

.crop-crosshair {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    transition: left 0.05s, top 0.05s;
}

.preview-card-scrubber {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    border-top: 1px solid var(--color-border);
}

.preview-scrub-slider {
    flex: 1;
    height: 4px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.preview-card-dims {
    text-align: center;
    padding: 0.25rem 0.5rem;
    border-top: 1px solid var(--color-border);
}

/* === Video Thumbnail Picker === */
.pc-video-thumbnail-picker {
    width: 100%;
    flex-basis: 100%;
    margin-bottom: 0.75rem;
}

.vt-picker {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.vt-preview-wrap {
    position: relative;
    width: 100%;
    height: 180px;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vt-preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.vt-preview-placeholder {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem;
}

.vt-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    z-index: 2;
}

.vt-loader .spinner {
    width: 1.5rem;
    height: 1.5rem;
    border-width: 2px;
}

.vt-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.vt-slider {
    flex: 1;
    height: 6px;
    cursor: pointer;
    accent-color: var(--color-primary);
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-border);
    border-radius: 3px;
    outline: none;
}

.vt-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.vt-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.vt-time-label {
    white-space: nowrap;
    min-width: 3.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* === Audio Picker Modal === */
.ap-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ap-modal {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

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

.ap-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.ap-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
    line-height: 1;
    padding: 0 0.25rem;
}

.ap-close:hover {
    color: var(--color-text);
}

/* Tabs */
.ap-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
}

.ap-tab {
    flex: 1;
    padding: 0.65rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s;
}

.ap-tab:hover {
    color: var(--color-text);
}

.ap-tab-active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Tab bodies */
.ap-tab-body {
    padding: 1rem 1.25rem;
}

/* Search */
.ap-search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ap-search-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
}

.ap-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.ap-results {
    max-height: 240px;
    overflow-y: auto;
}

.ap-result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--color-border);
    gap: 0.75rem;
}

.ap-result-row:last-child {
    border-bottom: none;
}

.ap-result-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.ap-result-title {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ap-result-meta {
    margin-top: 0.1rem;
}

.ap-result-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

/* Upload */
.ap-upload-zone {
    text-align: center;
    padding: 1.5rem 1rem;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
}

.ap-upload-text {
    margin-bottom: 0.75rem;
    color: var(--color-text-muted);
}

.ap-upload-progress {
    margin-top: 0.75rem;
}

.ap-progress-bar {
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.35rem;
}

.ap-progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    transition: width 0.2s;
    width: 0%;
}

.ap-upload-success {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #dcfce7;
    color: #15803d;
    border-radius: var(--radius);
    font-size: 0.85rem;
}

/* Scrubber */
.ap-scrubber-section {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

.ap-scrubber-header {
    margin-bottom: 0.6rem;
}

.ap-scrubber-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.ap-slider {
    flex: 1;
    height: 6px;
    cursor: pointer;
    accent-color: var(--color-primary);
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-border);
    border-radius: 3px;
    outline: none;
}

.ap-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ap-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ap-time-label {
    min-width: 2.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.ap-scrubber-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Footer */
.ap-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-border);
}

/* === Platform Manager === */
.pm-card {
    position: relative;
}

.pm-card-connected {
    border-left: 3px solid var(--color-success);
}

.pm-card-disconnected {
    border-left: 3px solid var(--color-border);
}

.pm-platform-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pm-icon {
    font-size: 1.2rem;
}

.pm-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.pm-detail {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.pm-detail-label {
    color: var(--color-text-muted);
}

.pm-detail-value {
    color: var(--color-text);
    font-weight: 500;
}

.pm-actions {
    display: flex;
    gap: 0.5rem;
}

.pm-x-form {
    border-left: 3px solid var(--color-primary);
}

/* === Post Detail === */
.pd-media-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.pd-media-thumb {
    position: relative;
    width: 120px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--color-bg);
}

.pd-media-img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
}

.pd-media-placeholder {
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--color-text-muted);
    background: var(--color-bg);
}

.pd-media-name {
    display: block;
    padding: 0.2rem 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pd-media-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.pd-platform-card {
    position: relative;
}

.pd-platform-published {
    border-left: 3px solid var(--color-success);
}

.pd-platform-success {
    border-left: 3px solid var(--color-success);
}

.pd-platform-failed,
.pd-platform-fail {
    border-left: 3px solid var(--color-danger);
}

.pd-platform-pending {
    border-left: 3px solid var(--color-border);
}

.pd-platform-publishing,
.pd-platform-processing {
    border-left: 3px solid var(--color-info);
}

.pd-error-msg {
    background: #fef2f2;
    color: var(--color-danger);
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 0.4rem 0.6rem;
}

.pd-inbox-notice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fef3c7;
    color: #b45309;
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.pd-inbox-icon {
    font-size: 1.1rem;
}

/* === Mobile === */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 2px 0 8px rgba(0,0,0,0.15);
    }

    .content {
        margin-left: 0;
        padding: 1rem;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .post-card {
        flex-direction: column;
    }

    .pd-media-grid {
        gap: 0.5rem;
    }

    .pd-media-thumb {
        width: 100px;
    }

    .pd-media-img {
        height: 70px;
    }

    .pd-media-placeholder {
        height: 70px;
    }

    .pc-platforms {
        flex-direction: column;
        gap: 0.5rem;
    }

    .pc-schedule-options {
        flex-direction: column;
        gap: 0.5rem;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .cal-cell {
        min-height: 50px;
    }

    .cal-header {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 1.75rem 1.25rem;
    }
}
