/* ============================================
   SocialAuto — Dark Luxury Editorial Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

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

/* === Design Tokens === */
:root {
    /* Surfaces */
    --bg-base: #0B0B0F;
    --bg-raised: #131318;
    --bg-card: #1A1A22;
    --bg-card-hover: #22222C;
    --bg-input: #16161E;
    --bg-overlay: rgba(0, 0, 0, 0.65);

    /* Accent — warm amber/gold */
    --accent: #F5A623;
    --accent-hover: #FFBE4A;
    --accent-muted: rgba(245, 166, 35, 0.12);
    --accent-border: rgba(245, 166, 35, 0.25);
    --accent-glow: 0 0 20px rgba(245, 166, 35, 0.15);

    /* Semantic */
    --success: #34D399;
    --success-muted: rgba(52, 211, 153, 0.12);
    --danger: #F87171;
    --danger-muted: rgba(248, 113, 113, 0.12);
    --warning: #FBBF24;
    --warning-muted: rgba(251, 191, 36, 0.12);

    /* Text */
    --text-primary: #F0EDE6;
    --text-secondary: #8A8690;
    --text-muted: #5C5868;
    --text-inverse: #0B0B0F;

    /* Borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.12);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.7);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 999px;

    /* Typography */
    --font-display: 'Outfit', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
}

/* === Base === */
body {
    font-family: var(--font-body);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-hover);
}

::selection {
    background: var(--accent);
    color: var(--text-inverse);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* === Container === */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* === Buttons === */
.btn-primary,
.btn-secondary {
    font-family: var(--font-body);
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #E8941C);
    color: var(--text-inverse);
    width: 100%;
    box-shadow: 0 2px 8px rgba(245, 166, 35, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent));
    box-shadow: 0 4px 16px rgba(245, 166, 35, 0.35);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-border);
}

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

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-base);
    position: relative;
    overflow: hidden;
}

/* Animated gradient mesh background */
.login-page::before {
    content: '';
    position: absolute;
    width: 150%;
    height: 150%;
    top: -25%;
    left: -25%;
    background:
        radial-gradient(ellipse 600px 600px at 20% 30%, rgba(245, 166, 35, 0.08), transparent),
        radial-gradient(ellipse 500px 500px at 80% 70%, rgba(139, 92, 246, 0.06), transparent),
        radial-gradient(ellipse 400px 400px at 50% 50%, rgba(52, 211, 153, 0.04), transparent);
    animation: meshFloat 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes meshFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, -2%) rotate(1deg); }
    66% { transform: translate(-1%, 1%) rotate(-0.5deg); }
}

/* Grid pattern overlay */
.login-page::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.3;
    pointer-events: none;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    position: relative;
    z-index: 1;
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(20px);
}

.login-card h1 {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    background: linear-gradient(135deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.login-card .subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 36px;
    font-size: 14px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.login-form .form-group {
    margin-bottom: 22px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: var(--font-body);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all 0.25s ease;
}

.login-form input::placeholder {
    color: var(--text-muted);
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
}

.login-footer a {
    font-size: 13px;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.login-footer a:hover {
    color: var(--accent);
}

.error-message {
    background: var(--danger-muted);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-bottom: 20px;
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.message.success {
    background: var(--success-muted);
    color: var(--success);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-bottom: 20px;
    border: 1px solid rgba(52, 211, 153, 0.2);
}

/* ============================================
   DASHBOARD HEADER / NAVIGATION
   ============================================ */
.dashboard-header {
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
    padding: 0;
    margin-bottom: 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
}

.dashboard-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.dashboard-header h1 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-info span {
    color: var(--text-muted);
    font-size: 13px;
    margin-left: 10px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 7px 16px;
    border-radius: var(--radius-full);
    transition: all 0.25s ease;
    font-family: var(--font-body);
}

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

.nav-link.active {
    background: var(--accent);
    color: var(--text-inverse);
    font-weight: 600;
}

/* ============================================
   CHAT INTERFACE (DASHBOARD)
   ============================================ */
.chat-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
    height: calc(100vh - 120px);
    min-height: 500px;
    animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Sidebar */
.chat-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header h3 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 28px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
}

.action-btn:hover {
    background: var(--accent-muted);
    border-color: var(--accent-border);
    color: var(--accent);
    transform: translateX(4px);
}

.action-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-stats {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.sidebar-stats h4 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.stat-mini {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.stat-number {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.stat-mini .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Chat Main */
.chat-main {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.chat-header h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s ease;
}

.status-dot.success {
    background: var(--success);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.4);
}

.status-dot.error {
    background: var(--danger);
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.4);
}

.status-dot.processing {
    background: var(--accent);
    animation: statusPulse 1.2s ease-in-out infinite;
}

.status-dot.waiting {
    background: var(--warning);
    animation: statusPulse 1.2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(245, 166, 35, 0.4); }
    50% { opacity: 0.4; box-shadow: none; }
}

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: messageSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), #E8941C);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-display);
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.message-user .message-avatar {
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
}

.message-content {
    background: var(--bg-raised);
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    border-top-left-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.6;
    border: 1px solid var(--border);
}

.message-user .message-content {
    background: linear-gradient(135deg, var(--accent), #E8941C);
    color: var(--text-inverse);
    border: none;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-sm);
}

.message-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.message-content li {
    margin-bottom: 4px;
}

.message-content a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,0.4);
    text-underline-offset: 2px;
}

/* Typing indicator */
.typing {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
    align-items: center;
}

.typing-dot {
    width: 7px;
    height: 7px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat Input */
.chat-input-area {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
}

.input-options {
    margin-bottom: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
}

.chat-input-wrapper textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    font-size: 14px;
    resize: none;
    font-family: var(--font-body);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all 0.25s ease;
}

.chat-input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.chat-input-wrapper textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.btn-send {
    width: 48px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

/* ============================================
   STATISTICS
   ============================================ */
.stats-section {
    margin-bottom: 40px;
}

.stats-section h2 {
    font-size: 20px;
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: all 0.25s ease;
}

.stat-card:hover {
    border-color: var(--accent-border);
    box-shadow: var(--accent-glow);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 4px;
    line-height: 1;
}

.stat-label {
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ============================================
   MANUAL RUN SECTION
   ============================================ */
.manual-run-section {
    margin-bottom: 40px;
}

.manual-run-section .btn-primary {
    width: auto;
    padding: 12px 32px;
    font-size: 15px;
}

.manual-run-section .form-group {
    margin: 20px 0;
}

.manual-run-section label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.manual-run-section .form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-body);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all 0.25s ease;
}

.manual-run-section .form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.manual-run-section .form-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Run Logs */
.run-logs {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-top: 16px;
}

.run-logs h3 {
    font-size: 16px;
    margin-bottom: 12px;
}

.log-entries {
    background: var(--bg-base);
    border-radius: var(--radius-md);
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.7;
    border: 1px solid var(--border);
}

.log-entry {
    display: flex;
    gap: 12px;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.log-entry.log-error { color: var(--danger); }
.log-entry.log-warning { color: var(--warning); }

.log-timestamp {
    color: var(--text-muted);
    white-space: nowrap;
    font-size: 12px;
}

.log-message {
    flex: 1;
    word-wrap: break-word;
}

/* Run Status */
.run-status {
    padding: 16px;
    border-radius: var(--radius-md);
    margin-top: 16px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid;
}

.run-status.info {
    background: rgba(96, 165, 250, 0.1);
    border-color: rgba(96, 165, 250, 0.2);
    color: #60A5FA;
}

.run-status.success {
    background: var(--success-muted);
    border-color: rgba(52, 211, 153, 0.2);
    color: var(--success);
}

.run-status.error {
    background: var(--danger-muted);
    border-color: rgba(248, 113, 113, 0.2);
    color: var(--danger);
}

/* Run Log */
.run-log {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 16px;
}

.run-log h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.run-log .log-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.run-log .log-section:last-child {
    border-bottom: none;
}

.run-log .log-section strong {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.run-log .log-section p {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    margin: 8px 0;
}

.run-log .log-section.errors {
    background: var(--danger-muted);
    border: 1px solid rgba(248, 113, 113, 0.2);
    padding: 16px;
    border-radius: var(--radius-md);
}

.run-log .log-section.errors ul {
    margin-left: 20px;
    color: var(--danger);
    font-size: 13px;
}

.run-log .error-text {
    color: var(--danger);
    font-weight: 500;
}

.run-log img {
    max-width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.run-log a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
    margin-top: 8px;
}

.run-log a:hover {
    color: var(--accent-hover);
}

/* ============================================
   POSTS SECTION
   ============================================ */
.posts-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 20px;
}

.loading-message,
.empty-message {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-muted);
    font-size: 15px;
}

.posts-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Post Card */
.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.25s ease;
}

.post-card:hover {
    border-color: var(--border-strong);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
}

.post-date {
    font-size: 13px;
    color: var(--text-muted);
}

.post-status {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.post-status.success {
    background: var(--success-muted);
    color: var(--success);
}

.post-status.failed {
    background: var(--danger-muted);
    color: var(--danger);
}

.post-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    padding: 20px;
}

.post-image {
    position: relative;
}

.post-image img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.post-details {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.post-section {
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.post-section:last-child {
    border-bottom: none;
}

.post-section strong {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.post-section p {
    color: var(--text-primary);
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.topic-text { font-size: 13px; line-height: 1.5; }
.tweet-text { font-size: 14px; line-height: 1.5; }
.linkedin-text { font-size: 13px; line-height: 1.6; }

.post-link {
    display: inline-block;
    margin-top: 8px;
    color: var(--accent);
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
}

.post-link:hover {
    color: var(--accent-hover);
}

.error-list {
    margin-left: 20px;
    color: var(--danger);
    font-size: 13px;
}

.errors {
    background: var(--danger-muted);
    border: 1px solid rgba(248, 113, 113, 0.2);
    padding: 16px;
    border-radius: var(--radius-md);
}

/* ============================================
   SETTINGS PAGE
   ============================================ */
.settings-section {
    margin-bottom: 40px;
    animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-section h2 {
    font-size: 28px;
    margin-bottom: 28px;
    font-weight: 700;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    overflow: hidden;
    transition: all 0.25s ease;
}

.settings-card:hover {
    border-color: var(--border-strong);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
}

.settings-header h3 {
    font-size: 16px;
    margin: 0;
    font-weight: 600;
}

.settings-body {
    padding: 28px 24px;
}

/* Status Badges */
.status-badge {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.status-badge.success {
    background: var(--success-muted);
    color: var(--success);
}

.status-badge.warning {
    background: var(--warning-muted);
    color: var(--warning);
}

/* API Status Grid */
.api-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.api-status-item {
    padding: 20px;
    background: var(--bg-raised);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.25s ease;
}

.api-status-item:hover {
    border-color: var(--border-strong);
}

.api-name {
    font-family: var(--font-display);
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 14px;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.api-actions {
    margin-top: 12px;
}

.api-actions .btn-secondary,
.api-actions .btn-small {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-body);
    transition: all 0.2s ease;
}

.api-actions .btn-secondary:hover,
.api-actions .btn-small:hover {
    border-color: var(--accent-border);
    color: var(--accent);
}

/* Status Indicators */
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-indicator.success {
    background: var(--success);
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.4);
}

.status-indicator.error {
    background: var(--danger);
    box-shadow: 0 0 6px rgba(248, 113, 113, 0.4);
}

.status-indicator.warning {
    background: var(--warning);
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
}

.status-indicator.loading {
    background: var(--text-muted);
    animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.unknown {
    background: var(--text-muted);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Alerts */
.alert {
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-warning {
    background: var(--warning-muted);
    border: 1px solid rgba(251, 191, 36, 0.2);
    color: var(--warning);
}

.alert-info {
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.2);
    color: #93BBFB;
}

.alert strong {
    display: block;
    margin-bottom: 8px;
    font-family: var(--font-display);
}

.alert p {
    margin: 8px 0;
    font-size: 14px;
}

.alert pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    overflow-x: auto;
    margin: 8px 0;
    font-family: var(--font-mono);
    border: 1px solid var(--border);
}

.alert a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.alert ul {
    margin: 8px 0 0 20px;
}

.alert li {
    margin-bottom: 4px;
}

/* Setup Steps */
.setup-steps {
    margin-left: 20px;
    counter-reset: step;
}

.setup-steps li {
    margin-bottom: 24px;
    line-height: 1.6;
}

.setup-steps strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 6px;
    font-family: var(--font-display);
}

.setup-steps p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 4px 0;
}

.setup-steps pre {
    background: var(--bg-base);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    overflow-x: auto;
    margin: 8px 0;
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    color: var(--accent);
}

.setup-steps a {
    color: var(--accent);
}

.oauth-info {
    max-width: 600px;
}

.oauth-info p {
    margin: 12px 0;
    font-size: 14px;
}

.info-text {
    color: var(--text-muted);
    font-size: 13px;
}

.success-text {
    color: var(--success);
    font-weight: 600;
}

.token-status {
    background: var(--success-muted);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin: 16px 0;
    border: 1px solid rgba(52, 211, 153, 0.2);
}

/* ============================================
   HISTORY PAGE
   ============================================ */
.history-container {
    max-width: 1000px;
    margin: 0 auto;
    animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-header {
    margin-bottom: 28px;
}

.history-header h2 {
    font-size: 28px;
    margin-bottom: 8px;
    font-weight: 700;
}

.history-header .subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* History Toolbar */
.history-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.history-toolbar .history-filters {
    margin-bottom: 0;
}

.history-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 18px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font-body);
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.25s ease;
}

.filter-btn:hover {
    border-color: var(--accent-border);
    color: var(--accent);
}

.filter-btn.active {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
    font-weight: 600;
}

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

/* History Grid */
.history-grid {
    display: grid;
    gap: 16px;
}

.history-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.25s ease;
}

.history-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.history-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-muted);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
}

.history-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-card-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-card-date {
    font-size: 13px;
    color: var(--text-muted);
}

.history-card-status {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.history-card-status.success {
    background: var(--success-muted);
    color: var(--success);
}

.history-card-status.failed {
    background: var(--danger-muted);
    color: var(--danger);
}

.history-card-body {
    padding: 20px;
}

.history-card-topic {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text-primary);
    line-height: 1.5;
}

.history-card-posts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.history-post-item {
    padding: 14px;
    background: var(--bg-raised);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: border-color 0.2s ease;
}

.history-post-item:hover {
    border-color: var(--border-strong);
}

.history-post-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.history-post-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-post-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.history-post-link:hover {
    color: var(--accent-hover);
}

/* Card Checkbox */
.card-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Delete Buttons */
.btn-danger {
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-body);
    background: var(--danger);
    color: white;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: #EF4444;
    box-shadow: 0 2px 8px rgba(248, 113, 113, 0.3);
}

.btn-danger-outline {
    padding: 6px 14px;
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-body);
    background: transparent;
    color: var(--danger);
    transition: all 0.2s ease;
}

.btn-danger-outline:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-delete-sm {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-delete-sm:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}

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

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    animation: modalSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-raised);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    color: var(--text-secondary);
}

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

.confirm-warning {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Approval Content */
.approval-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.approval-section h4 {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.approval-card {
    background: var(--bg-raised);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

/* Approval inline in chat */
.approval-inline h4 {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--accent);
}

.approval-inline .approval-section {
    margin-bottom: 12px;
}

.approval-inline .approval-section strong {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 6px;
}

.approval-inline .approval-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    padding: 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
}

.approval-inline .approval-actions .btn-primary {
    width: auto;
    padding: 8px 20px;
}

/* ============================================
   RESULTS
   ============================================ */
.results-summary {
    font-size: 14px;
}

.result-item {
    margin-bottom: 8px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.result-platform {
    font-weight: 600;
    font-family: var(--font-display);
}

.result-success {
    border-left: 3px solid var(--success);
    padding-left: 12px;
}

.result-error {
    border-left: 3px solid var(--danger);
    padding-left: 12px;
}

.result-warning {
    border-left: 3px solid var(--warning);
    padding-left: 12px;
}

.result-errors {
    margin-top: 12px;
    padding: 14px;
    background: var(--danger-muted);
    border-radius: var(--radius-md);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

/* ============================================
   SPINNER
   ============================================ */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.7s linear infinite;
}

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

/* ============================================
   OAUTH RESULT PAGE
   ============================================ */
.result-container {
    max-width: 540px;
    margin: 100px auto;
    padding: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    text-align: center;
    animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-icon {
    font-size: 56px;
    margin-bottom: 20px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    border-radius: 50%;
}

.result-success {
    color: var(--success);
    background: var(--success-muted);
}

.result-error {
    color: var(--danger);
    background: var(--danger-muted);
}

.result-message {
    margin: 24px 0;
    font-size: 15px;
    color: var(--text-secondary);
}

.result-message p {
    margin: 8px 0;
}

.back-button {
    margin-top: 32px;
}

.back-button .btn-primary {
    width: auto;
    display: inline-block;
    padding: 12px 32px;
}

/* ============================================
   LOAD MORE
   ============================================ */
.load-more-container {
    text-align: center;
    margin-top: 24px;
}

.load-more-container .btn-secondary {
    padding: 10px 32px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .post-content {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-header .container {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        height: auto;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .user-info {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 6px;
    }

    .user-info span {
        margin-left: auto;
    }

    .api-status-grid {
        grid-template-columns: 1fr;
    }

    .chat-container {
        grid-template-columns: 1fr;
        height: auto;
        min-height: auto;
    }

    .chat-sidebar {
        display: none;
    }

    .chat-main {
        height: calc(100vh - 120px);
    }

    .history-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .login-card {
        padding: 36px 28px;
    }

    .modal-content {
        width: 95%;
        margin: 16px;
    }

    .settings-section h2 {
        font-size: 24px;
    }

    .history-header h2 {
        font-size: 24px;
    }

    .history-card-posts {
        grid-template-columns: 1fr;
    }

    .nav-link {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* ============================================
   MICRO-INTERACTIONS & POLISH
   ============================================ */

/* Stagger animation for page-load elements */
.dashboard-page .settings-card:nth-child(1) { animation: fadeUp 0.4s 0.05s cubic-bezier(0.16, 1, 0.3, 1) both; }
.dashboard-page .settings-card:nth-child(2) { animation: fadeUp 0.4s 0.15s cubic-bezier(0.16, 1, 0.3, 1) both; }
.dashboard-page .settings-card:nth-child(3) { animation: fadeUp 0.4s 0.25s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* Focus ring for accessibility */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Smooth transitions for interactive elements */
button, a, input, textarea {
    transition: all 0.2s ease;
}

/* Grain overlay for texture (subtle) */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}
