:root {
    --primary: #6366F1;
    --primary-light: #818CF8;
    --secondary: #10B981;
    --secondary-light: #4ADE80;
    --accent: #F59E0B;
    --accent-light: #FBBF24;
    --purple: #8B5CF6;
    --pink: #EC4899;
    --cyan: #06B6D4;
    --background: #0F172A;
    --background-light: #1E293B;
    --surface: #334155;
    --text: #E2E8F0;
    --text-dim: #94A3B8;
    --border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--background);
    color: var(--text);
    font-family: 'Space Grotesk', 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, var(--primary), var(--purple));
    border-radius: 4px;
    border: 1px solid var(--border);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, var(--primary-light), var(--pink));
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--background-light);
}

/* AI Grid Background */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(16, 185, 129, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.08) 0%, transparent 50%);
    z-index: -2;
    animation: aiBackgroundShift 15s ease-in-out infinite alternate;
}

@keyframes aiBackgroundShift {
    0% {
        background: 
            radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
            radial-gradient(circle at 80% 70%, rgba(16, 185, 129, 0.12) 0%, transparent 50%),
            radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.08) 0%, transparent 50%);
    }
    100% {
        background: 
            radial-gradient(circle at 90% 80%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
            radial-gradient(circle at 20% 30%, rgba(16, 185, 129, 0.12) 0%, transparent 50%),
            radial-gradient(circle at 70% 20%, rgba(168, 85, 247, 0.08) 0%, transparent 50%);
    }
}

.ai-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: 50px 50px;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    z-index: -1;
    pointer-events: none;
    animation: aiGridPulse 8s ease-in-out infinite;
}

@keyframes aiGridPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* Neural Network Pattern Overlay */
.neural-network {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.1;
    animation: neuralPulse 12s ease-in-out infinite;
}

@keyframes neuralPulse {
    0%, 100% { opacity: 0.05; }
    50% { opacity: 0.15; }
}

/* AI Particles */
.ai-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: linear-gradient(45deg, var(--primary), var(--cyan));
    border-radius: 50%;
    animation: floatParticle 20s linear infinite;
    opacity: 0.6;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

@keyframes floatParticle {
    0% {
        transform: translateY(100vh) translateX(0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
        transform: scale(1);
    }
    90% {
        opacity: 0.6;
        transform: scale(1);
    }
    100% {
        transform: translateY(-100px) translateX(100px) scale(0);
        opacity: 0;
    }
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 25s; }
.particle:nth-child(2) { left: 20%; animation-delay: 5s; animation-duration: 30s; }
.particle:nth-child(3) { left: 30%; animation-delay: 10s; animation-duration: 20s; }
.particle:nth-child(4) { left: 40%; animation-delay: 15s; animation-duration: 35s; }
.particle:nth-child(5) { left: 50%; animation-delay: 20s; animation-duration: 25s; }
.particle:nth-child(6) { left: 60%; animation-delay: 2s; animation-duration: 28s; }
.particle:nth-child(7) { left: 70%; animation-delay: 8s; animation-duration: 22s; }
.particle:nth-child(8) { left: 80%; animation-delay: 12s; animation-duration: 32s; }
.particle:nth-child(9) { left: 90%; animation-delay: 18s; animation-duration: 26s; }

/* Floating AI Icons */
.ai-floating-icons {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.floating-icon {
    position: absolute;
    font-size: 2rem;
    opacity: 0.1;
    animation: floatIcon 15s ease-in-out infinite;
    color: var(--primary);
    text-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

@keyframes floatIcon {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.1;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.3;
    }
}

.floating-icon:nth-child(1) { top: 10%; left: 10%; animation-delay: 0s; }
.floating-icon:nth-child(2) { top: 20%; right: 15%; animation-delay: 3s; }
.floating-icon:nth-child(3) { top: 60%; left: 5%; animation-delay: 6s; }
.floating-icon:nth-child(4) { bottom: 20%; right: 10%; animation-delay: 9s; }
.floating-icon:nth-child(5) { bottom: 10%; left: 15%; animation-delay: 12s; }

/* Top Header Bar */
.top-header-bar {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Back Button */
.header-back-btn {
    flex-shrink: 0;
}

.back-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.1rem;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.back-chevron:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--primary-light);
    transform: translateX(-2px);
}

/* Enhanced Glassmorphism App Name Pill */
.header-logo-pill {
    flex-shrink: 0;
    position: relative;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(25px);
    border: 2px solid transparent;
    border-radius: 25px;
    padding: 0.75rem 1.25rem;
    overflow: hidden;
    animation: pilllGlow 3s ease-in-out infinite alternate;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.app-name-pill::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        var(--primary),
        var(--purple),
        var(--pink),
        var(--cyan),
        var(--secondary)
    );
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    border-radius: 25px;
    z-index: -1;
    padding: 2px;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.app-name-pill::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: linear-gradient(135deg, 
        rgba(0, 0, 0, 0.8), 
        rgba(15, 23, 42, 0.9),
        rgba(30, 41, 59, 0.8)
    );
    border-radius: 23px;
    z-index: -1;
}

@keyframes pilllGlow {
    0% { 
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.1),
            0 0 20px rgba(99, 102, 241, 0.2);
    }
    100% { 
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.1),
            0 0 30px rgba(99, 102, 241, 0.4);
    }
}

/* Header Content Card */
.header-content-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.header-content-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.header-title-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.header-title-text {
    flex-shrink: 0;
}

.header-title-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(45deg, var(--primary), var(--pink));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

.header-search-section {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    max-width: 300px;
}

/* Desktop: Show search on same line */
@media (min-width: 1025px) {
    .header-content-main {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 2rem;
    }
    
    .header-title-content {
        flex: 0 0 auto;
        width: auto;
        flex-direction: row;
        justify-content: flex-start;
    }
    
    .header-title-content .header-collapse-toggle {
        display: none !important;
    }
    
    .header-search-section {
        display: flex !important;
        opacity: 1 !important;
        max-height: none !important;
        overflow: visible !important;
        margin-top: 0 !important;
        padding-top: 0 !important;
        border-top: none !important;
        transition: none !important;
        flex: 1;
        justify-content: flex-end;
        max-width: 300px;
    }
}

/* Collapsible Toggle Button */
.header-collapse-toggle {
    display: none;
    background: rgba(51, 65, 85, 0.6);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

/* Hide toggle on desktop */
@media (min-width: 1025px) {
    .header-collapse-toggle {
        display: none !important;
    }
}

.header-collapse-toggle:hover {
    background: rgba(51, 65, 85, 0.8);
    color: var(--text);
    border-color: rgba(99, 102, 241, 0.3);
}

.header-collapse-toggle i {
    transition: all 0.3s ease;
}

.header-collapse-toggle.expanded i {
    color: var(--primary-light);
    transform: scale(1.1);
}

.header-logo-pill::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        var(--primary),
        var(--purple),
        var(--pink),
        var(--cyan),
        var(--secondary)
    );
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    border-radius: 25px;
    z-index: -1;
    padding: 2px;
}

.header-logo-pill::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: linear-gradient(135deg, 
        rgba(0, 0, 0, 0.8), 
        rgba(15, 23, 42, 0.9),
        rgba(30, 41, 59, 0.8)
    );
    border-radius: 23px;
    z-index: -1;
}

/* Main Container */
.history-container {
    padding: 120px 20px 20px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
    background: transparent;
    backdrop-filter: blur(2px);
}

/* Search Container */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 280px;
}

.search-icon {
    position: absolute;
    left: 0.875rem;
    color: var(--text-dim);
    z-index: 1;
    font-size: 0.875rem;
}

.search-input {
    background: rgba(51, 65, 85, 0.6);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.625rem 0.875rem 0.625rem 2.25rem;
    color: var(--text);
    font-size: 0.875rem;
    width: 100%;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(51, 65, 85, 0.8);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.export-btn {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.export-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

/* Filters Section */
.filters-section {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.filters-container {
    display: flex;
    align-items: end;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-dim);
}

.filter-select {
    background: rgba(51, 65, 85, 0.6);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.clear-filters-btn {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: #F87171;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: fit-content;
}

.clear-filters-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Stats Section */
.stats-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.main-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.platform-stats-row {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.stat-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-card.small {
    padding: 0.75rem;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, var(--primary), var(--cyan));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.stat-card.small .stat-number {
    font-size: 1.25rem;
}

.stat-label {
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 500;
}

.platform-stat-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    min-width: 60px;
    justify-content: center;
}

.platform-stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.platform-stat-card.twitter {
    border-color: rgba(29, 161, 242, 0.3);
    color: #1DA1F2;
}

.platform-stat-card.linkedin {
    border-color: rgba(0, 119, 181, 0.3);
    color: #0077B5;
}

.platform-stat-card.instagram {
    border-color: rgba(225, 48, 108, 0.3);
    color: #E1306C;
}

.platform-stat-card.whatsapp {
    border-color: rgba(37, 211, 102, 0.3);
    color: #25D366;
}

.platform-count {
    font-weight: 600;
}

/* Posts Grid - Updated for True Masonry Layout */
.posts-grid {
    column-count: auto;
    column-width: 350px;
    column-gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Loading State - Updated for Masonry Layout */
.loading-state {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    break-inside: avoid;
    column-span: all; /* Spans across all columns */
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State - Updated for Masonry Layout */
.empty-state {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    break-inside: avoid;
    column-span: all; /* Spans across all columns */
}

.empty-icon {
    font-size: 4rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--text);
}

.empty-state p {
    color: var(--text-dim);
    margin: 0 0 2rem;
}

.create-post-btn {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.create-post-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* Post Card - Masonry Layout */
.post-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
    margin-bottom: 1.5rem;
    break-inside: avoid; /* Prevents cards from breaking across columns */
    page-break-inside: avoid; /* Fallback for older browsers */
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border-color: rgba(99, 102, 241, 0.3);
}

.post-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.post-platforms {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.platform-badge {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary-light);
}

.platform-badge.twitter { 
    background: rgba(29, 161, 242, 0.2); 
    border-color: rgba(29, 161, 242, 0.3);
    color: #1DA1F2;
}

.platform-badge.linkedin { 
    background: rgba(0, 119, 181, 0.2); 
    border-color: rgba(0, 119, 181, 0.3);
    color: #0077B5;
}

.platform-badge.instagram { 
    background: rgba(225, 48, 108, 0.2); 
    border-color: rgba(225, 48, 108, 0.3);
    color: #E1306C;
}

.platform-badge.whatsapp { 
    background: rgba(37, 211, 102, 0.2); 
    border-color: rgba(37, 211, 102, 0.3);
    color: #25D366;
}

.post-date {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.post-content {
    margin: 1rem 0;
}

.post-preview {
    background: rgba(51, 65, 85, 0.4);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 1rem;
    overflow: visible;
    position: relative;
}

.post-preview.expanded {
    max-height: none;
}

.post-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, 100px);
    gap: 0.5rem;
    margin: 1rem 0;
    justify-content: start;
}

.post-image {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.1);
    cursor: pointer;
    width: 100px;
    height: 100px;
}

.post-image img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.post-image:hover img {
    transform: scale(1.05);
}

.thread-indicator {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: var(--purple);
    margin-bottom: 0.5rem;
    display: inline-block;
}

.post-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.post-actions-left {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.action-btn {
    background: rgba(51, 65, 85, 0.6);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    color: var(--text-dim);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: fit-content;
}

.action-btn:hover {
    background: rgba(51, 65, 85, 0.8);
    color: var(--text);
}

.action-btn.primary {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--primary-light);
}

.action-btn.primary:hover {
    background: rgba(99, 102, 241, 0.3);
}

/* AweSM Check button specific styling */
.action-btn[onclick*="runAweSMCheck"] {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    border-color: rgba(249, 115, 22, 0.3);
    font-weight: 500;
}

.action-btn[onclick*="runAweSMCheck"]:hover {
    background: linear-gradient(135deg, #ea580c, #dc2626);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

/* Delete button stays on the right */
.action-btn.delete-btn {
    margin-left: auto;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    .post-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .post-actions-left {
        justify-content: flex-start;
        width: 100%;
    }
    
    .action-btn {
        flex: 1;
        justify-content: center;
        min-width: 0;
        font-size: 0.75rem;
        padding: 0.5rem 0.6rem;
    }
    
    .action-btn.delete-btn {
        margin-left: 0;
        order: 1;
    }
}

@media (max-width: 480px) {
    .post-actions-left {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        width: 100%;
    }
    
    .action-btn {
        font-size: 0.7rem;
        padding: 0.4rem 0.5rem;
        gap: 0.2rem;
    }
    
    /* Make AweSM Check button span full width on very small screens if needed */
    .action-btn[onclick*="runAweSMCheck"] {
        grid-column: span 2;
    }
}

.expand-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.25rem 0;
    margin-top: 0.5rem;
}

.expand-btn:hover {
    color: var(--primary-light);
}

/* Post Content with Images - Updated for 100px x 100px Thumbnails */
.post-content {
    margin: 1rem 0;
}

.post-preview {
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 1rem;
}

.post-preview.expanded {
    max-height: none;
}

.post-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, 100px);
    gap: 0.5rem;
    margin: 1rem 0;
    justify-content: start;
}

.post-image {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.1);
    cursor: pointer;
    width: 100px;
    height: 100px;
}

.post-image img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.post-image:hover img {
    transform: scale(1.05);
}

.expand-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.25rem 0;
    transition: color 0.2s ease;
}

.expand-btn:hover {
    color: var(--primary-light);
}

/* Tablet and Mobile Responsive Styles */
@media (max-width: 1024px) {
    .top-header-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-content-card {
        position: relative;
    }

    .header-content-main {
        gap: 0;
        flex-direction: column;
        align-items: stretch;
    }

    .header-title-content {
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        width: 100%;
        flex-direction: row;
    }

    .header-title-text h1 {
        font-size: 1.2rem;
        margin-bottom: 0;
    }

    /* Show collapse toggle on tablets and mobile */
    .header-collapse-toggle {
        display: flex;
    }

    /* Move search to next line on tablets and mobile */
    .header-search-section {
        display: none;
        width: 100%;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        justify-content: stretch;
        max-width: none;
        opacity: 0;
        max-height: 0;
        overflow: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Show search when expanded */
    .header-content-card.expanded .header-search-section {
        display: flex;
        opacity: 1;
        max-height: 100px;
        overflow: visible;
    }

    /* Compact header when collapsed */
    .header-content-card.collapsed {
        padding: 0.75rem 1rem;
    }

    .header-content-card.collapsed .header-title-text h1 {
        font-size: 1.2rem;
        margin-bottom: 0;
    }

    /* Tablet and mobile search styling */
    .header-search-section .search-container {
        max-width: none;
        width: 100%;
    }

    .header-search-section .search-input {
        padding: 0.6rem 0.875rem 0.6rem 2.25rem;
        font-size: 0.9rem;
    }

    /* Adjust main container padding for tablets and mobile */
    .history-container {
        padding: 140px 10px 20px;
    }
}

@media (max-width: 640px) {
    .header-content-card.collapsed .header-title-text h1 {
        font-size: 1rem;
    }
}

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

/* Responsive Design - Updated for Masonry Layout */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }
    
    .right-sidebar {
        width: 100%;
        position: static;
        max-height: 400px;
        order: -1;
    }
    
    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .image-card img {
        height: 100px;
    }
    
    .posts-grid {
        column-width: 300px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 0 1rem;
        gap: 1rem;
    }
    
    .posts-grid {
        column-width: 280px;
    }
    
    .filters-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .main-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .platform-stats-row {
        justify-content: space-between;
        margin: 0 1rem;
    }
    
    .platform-stat-card {
        min-width: 50px;
        font-size: 0.8rem;
    }
    
    .right-sidebar {
        padding: 1rem;
    }
    
    .images-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .post-images {
        grid-template-columns: repeat(auto-fit, 80px);
    }
    
    .post-image {
        width: 80px;
        height: 80px;
    }
    
    .post-image img {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .posts-grid {
        column-count: 1;
        column-width: auto;
    }
    
    .post-images {
        grid-template-columns: repeat(auto-fit, 70px);
    }
    
    .post-image {
        width: 70px;
        height: 70px;
    }
    
    .post-image img {
        width: 70px;
        height: 70px;
    }
}

/* Sidebar Images - Updated for Smaller Thumbnails */
.right-sidebar {
    background: rgba(51, 65, 85, 0.4);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    height: fit-content;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    position: sticky;
    top: 2rem;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.sidebar-header h3 {
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.images-count {
    color: var(--text-dim);
    font-size: 0.85rem;
    background: rgba(99, 102, 241, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.75rem;
}

.image-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.image-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.15);
}

.image-card img {
    width: 100%;
    height: 90px; /* Smaller sidebar thumbnails */
    object-fit: cover;
    display: block;
}

.image-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 0.4rem;
    color: white;
    font-size: 0.7rem;
}

.image-platforms {
    display: flex;
    gap: 0.2rem;
    margin-bottom: 0.2rem;
    flex-wrap: wrap;
}

.image-platform-badge {
    background: var(--primary);
    color: white;
    padding: 0.1rem 0.25rem;
    border-radius: 3px;
    font-size: 0.55rem;
    font-weight: 500;
}

.image-date {
    opacity: 0.8;
    font-size: 0.6rem;
}

.images-loading, .images-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-dim);
}

.images-loading .loading-spinner {
    width: 24px;
    height: 24px;
    margin: 0 auto 1rem;
}

.images-empty .empty-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Platform-Specific Post Card Styles */
.post-card {
    background: rgba(51, 65, 85, 0.4);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.post-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.15);
}

.post-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.post-platforms {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.platform-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    border: 1px solid;
}

/* Platform-specific colors */
.platform-badge.twitter {
    background: rgba(29, 161, 242, 0.1);
    color: #1DA1F2;
    border-color: rgba(29, 161, 242, 0.3);
}

.platform-badge.linkedin {
    background: rgba(0, 119, 181, 0.1);
    color: #0077B5;
    border-color: rgba(0, 119, 181, 0.3);
}

.platform-badge.instagram {
    background: rgba(225, 48, 108, 0.1);
    color: #E1306C;
    border-color: rgba(225, 48, 108, 0.3);
}

.platform-badge.whatsapp {
    background: rgba(37, 211, 102, 0.1);
    color: #25D366;
    border-color: rgba(37, 211, 102, 0.3);
}

.post-date {
    color: var(--text-dim);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Platform Preview Styles - Updated to match dashboard.js */
.platform-preview {
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    position: relative;
}

.platform-preview.twitter {
    background: rgba(29, 161, 242, 0.05);
    border-color: rgba(29, 161, 242, 0.2);
}

.platform-preview.linkedin {
    background: rgba(0, 119, 181, 0.05);
    border-color: rgba(0, 119, 181, 0.2);
}

.platform-preview.instagram {
    background: rgba(225, 48, 108, 0.05);
    border-color: rgba(225, 48, 108, 0.2);
}

.platform-preview.whatsapp {
    background: rgba(37, 211, 102, 0.05);
    border-color: rgba(37, 211, 102, 0.2);
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.preview-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
}

.preview-user-info {
    flex: 1;
}

.preview-username {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

.preview-handle {
    color: var(--text-dim);
    font-size: 0.8rem;
}

.preview-time {
    color: var(--text-dim);
    font-size: 0.8rem;
}

.preview-content {
    line-height: 1.5;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.preview-content .hashtag {
    color: var(--primary);
    font-weight: 500;
}

.preview-content .mention {
    color: var(--primary);
}

.preview-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.thread-indicator {
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: inline-block;
}

.char-count {
    font-family: 'Courier New', monospace;
}

.char-count.warning {
    color: var(--warning);
}

.char-count.danger {
    color: var(--danger);
}

/* Post Content with Images */
.post-content {
    margin: 1rem 0;
}

.post-preview {
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 1rem;
}

.post-preview.expanded {
    max-height: none;
}

.post-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, 100px);
    gap: 0.5rem;
    margin: 1rem 0;
    justify-content: start;
}

.post-image {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.1);
    cursor: pointer;
    width: 100px;
    height: 100px;
}

.post-image img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.post-image:hover img {
    transform: scale(1.05);
}

.expand-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.25rem 0;
    transition: color 0.2s ease;
}

.expand-btn:hover {
    color: var(--primary-light);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagination-btn {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--primary-light);
}

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

.pagination-info {
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 2rem;
}

.modal-content {
    background: var(--background-light);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #F87171;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.loading-content {
    text-align: center;
}

.loading-content .loading-spinner {
    margin: 0 auto 1rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Thread Styling */
.ml-13 {
    margin-left: 3.25rem;
}

.absolute {
    position: absolute;
}

.left-9 {
    left: 2.25rem;
}

.top-0 {
    top: 0;
}

.w-0\.5 {
    width: 0.125rem;
}

.h-10 {
    height: 2.5rem;
}

.h-full {
    height: 100%;
}

.bg-gray-600 {
    background-color: #4b5563;
}

.z-0 {
    z-index: 0;
}

.z-10 {
    z-index: 10;
}

.w-10 {
    width: 2.5rem;
}

.h-10 {
    height: 2.5rem;
}

.rounded-t-xl {
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
}

.rounded-b-xl {
    border-bottom-left-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
}

.ml-2 {
    margin-left: 0.5rem;
}

.mx-1 {
    margin-left: 0.25rem;
    margin-right: 0.25rem;
}

.text-blue-400 {
    color: #60a5fa;
}

.bg-blue-600 {
    background-color: #2563eb;
}

.flex-shrink-0 {
    flex-shrink: 0;
}

/* Thread indicator and platform preview styling */
.thread-indicator {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: var(--purple);
    margin-bottom: 0.5rem;
    display: inline-block;
}

/* Phase 13: Enhanced Action Button Styles */
.action-btn.edit-btn:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    color: #4ADE80;
}

.action-btn.image-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    color: #818CF8;
}

.action-btn.delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #F87171;
}

/* Phase 13: Thread Selector Modal Styles */
.thread-action-modal {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.thread-action-modal .modal-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.thread-action-modal .modal-header h3 {
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.thread-action-modal .modal-header p {
    color: var(--text-dim);
    font-size: 0.875rem;
    margin: 0;
}

.thread-posts-selector {
    max-height: 400px;
    overflow-y: auto;
    margin: 1.5rem 0;
}

.thread-post-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.thread-post-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.post-indicator {
    flex-shrink: 0;
    text-align: center;
    width: 60px;
}

.post-number {
    display: block;
    font-size: 1.25rem;
    font-weight: bold;
    color: #60a5fa;
    line-height: 1;
}

.post-label {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.post-preview {
    flex: 1;
    color: var(--text);
    line-height: 1.4;
}

.post-preview p {
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.select-post-btn {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #e9d5ff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.select-post-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: rgba(99, 102, 241, 0.6);
    color: white;
    transform: translateY(-1px);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.modal-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.2);
}

.modal-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.modal-btn.primary {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    color: white;
    border: none;
}

.modal-btn.primary:hover {
    background: linear-gradient(135deg, #7c3aed, #9333ea);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

/* Modal Edit Interface */
.modal-edit-interface {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.modal-edit-header {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-edit-header h4 {
    margin: 0;
    color: #f1f5f9;
    font-size: 1.1rem;
    font-weight: 600;
}

.edit-instructions {
    color: #94a3b8;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.modal-edit-content {
    margin: 1rem 0;
}

.modal-edit-textarea {
    width: 100%;
    min-height: 120px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #f1f5f9;
    padding: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    transition: all 0.3s ease;
}

.modal-edit-textarea:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.modal-edit-char-count {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

.modal-edit-char-count .char-count {
    font-weight: 600;
    margin-right: 0.25rem;
}

.modal-edit-char-count .char-count.warning {
    color: #f59e0b;
}

.modal-edit-char-count .char-count.danger {
    color: #ef4444;
}

.modal-edit-char-count .char-limit {
    color: #64748b;
}

.modal-edit-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    min-width: 120px;
    justify-content: center;
}

.modal-edit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-edit-btn.save-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border-color: rgba(34, 197, 94, 0.3);
}

.modal-edit-btn.save-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a, #15803d);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.modal-edit-btn.cancel-btn {
    background: rgba(107, 114, 128, 0.2);
    color: #d1d5db;
    border-color: rgba(107, 114, 128, 0.4);
}

.modal-edit-btn.cancel-btn:hover:not(:disabled) {
    background: rgba(107, 114, 128, 0.3);
    border-color: rgba(107, 114, 128, 0.6);
}

.modal-edit-btn.ai-btn {
    background: rgba(168, 85, 247, 0.2);
    color: #ddd6fe;
    border-color: rgba(168, 85, 247, 0.4);
}

.modal-edit-btn.ai-btn:hover:not(:disabled) {
    background: rgba(168, 85, 247, 0.3);
    border-color: rgba(168, 85, 247, 0.6);
    color: white;
}

/* AI Edit Prompt Modal */
.ai-edit-prompt-modal .modal-content {
    max-width: 500px;
    width: 90%;
}

.ai-edit-prompt-content {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(139, 92, 246, 0.05));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.ai-prompt-section {
    margin-bottom: 1.5rem;
}

.ai-prompt-section label {
    display: block;
    margin-bottom: 0.5rem;
    color: #f1f5f9;
    font-weight: 500;
}

.ai-prompt-section textarea {
    width: 100%;
    min-height: 80px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #f1f5f9;
    padding: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    transition: all 0.3s ease;
}

.ai-prompt-section textarea:focus {
    outline: none;
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);
}

.ai-prompt-examples {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-prompt-examples p {
    margin: 0 0 0.75rem 0;
    color: #cbd5e1;
    font-size: 0.875rem;
}

.prompt-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.example-btn {
    background: rgba(168, 85, 247, 0.2);
    color: #ddd6fe;
    border: 1px solid rgba(168, 85, 247, 0.3);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.example-btn:hover {
    background: rgba(168, 85, 247, 0.3);
    border-color: rgba(168, 85, 247, 0.5);
    color: white;
}

/* AI Suggestions Overlay */
.ai-suggestions-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: inherit;
}

.ai-suggestions-popup {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 16px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 70vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.suggestions-header {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(139, 92, 246, 0.15));
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.suggestions-header h4 {
    margin: 0 0 0.5rem 0;
    color: #f1f5f9;
    font-size: 1.2rem;
    font-weight: 600;
}

.suggestions-header p {
    margin: 0;
    color: #cbd5e1;
    font-size: 0.875rem;
    font-style: italic;
}

.suggestions-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.suggestions-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.suggestions-content {
    padding: 1.5rem;
    max-height: 50vh;
    overflow-y: auto;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.suggestion-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.suggestion-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(168, 85, 247, 0.3);
    transform: translateY(-2px);
}

.suggestion-text {
    color: #e2e8f0;
    line-height: 1.6;
    margin-bottom: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border-left: 4px solid rgba(168, 85, 247, 0.5);
    font-size: 0.9rem;
}

.suggestion-apply-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.suggestion-apply-btn:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.suggestions-footer {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
}

.suggestions-cancel-btn {
    background: rgba(107, 114, 128, 0.2);
    color: #d1d5db;
    border: 1px solid rgba(107, 114, 128, 0.4);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.suggestions-cancel-btn:hover {
    background: rgba(107, 114, 128, 0.3);
    border-color: rgba(107, 114, 128, 0.6);
}

/* Pulse animation for save button */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Responsive modal editing */
@media (max-width: 768px) {
    .modal-edit-actions {
        flex-direction: column;
    }
    
    .modal-edit-btn {
        width: 100%;
        margin: 0;
    }
    
    .modal-edit-interface {
        padding: 1rem;
        margin: 0.5rem 0;
    }
    
    .modal-edit-textarea {
        min-height: 100px;
        font-size: 0.875rem;
    }
}

/* Phase 14: Image Generation Modal Styles */
.image-generation-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

.image-generation-modal-backdrop .modal-content {
    background-color: #1F2937; /* bg-gray-800 */
    color: var(--text);
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    transform: scale(0.95);
    animation: scaleIn 0.3s forwards;
}

.image-generation-modal-backdrop .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}

.image-generation-modal-backdrop .modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #F9FAFB; /* text-gray-50 */
}

.image-generation-modal-backdrop .modal-header p {
    font-size: 1rem;
    color: #9CA3AF; /* text-gray-400 */
    margin-top: 0.25rem;
}

.image-generation-modal-backdrop .close-modal-btn {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: #9CA3AF; /* text-gray-400 */
    cursor: pointer;
    transition: color 0.2s ease;
}

.image-generation-modal-backdrop .close-modal-btn:hover {
    color: #F9FAFB; /* text-gray-50 */
}

.image-generation-modal-backdrop .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1.5rem;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.image-generation-modal-backdrop .modal-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-generation-modal-backdrop .modal-btn.back-btn,
.image-generation-modal-backdrop .modal-btn.skip-btn {
    background-color: #374151; /* bg-gray-700 */
    color: #F9FAFB;
}

.image-generation-modal-backdrop .modal-btn.back-btn:hover,
.image-generation-modal-backdrop .modal-btn.skip-btn:hover {
    background-color: #4B5563; /* bg-gray-600 */
}

.image-generation-modal-backdrop .modal-btn.next-btn,
.image-generation-modal-backdrop .modal-btn.generate-btn,
.image-generation-modal-backdrop .modal-btn.create-poster-btn {
    background-color: var(--primary);
    color: white;
}

.image-generation-modal-backdrop .modal-btn:disabled {
    background-color: #4B5563; /* bg-gray-600 */
    color: #9CA3AF;
    cursor: not-allowed;
}

/* Thread Post Selection */
.thread-posts-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    padding: 0.5rem;
    margin: -0.5rem;
}

.thread-post-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: #374151; /* bg-gray-700 */
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.thread-post-option:hover {
    background-color: #4B5563; /* bg-gray-600 */
}

.thread-post-option.selected {
    border-color: var(--primary);
    background-color: rgba(99, 102, 241, 0.2);
}

.thread-post-option .post-number {
    font-weight: bold;
    font-size: 1.25rem;
    color: var(--primary);
}

.thread-post-option .post-content-preview {
    flex-grow: 1;
    color: #D1D5DB; /* text-gray-300 */
}

.thread-post-option .post-image-status {
    font-size: 0.875rem;
    color: #6B7280; /* text-gray-500 */
    font-style: italic;
}

/* Reference Image Selection */
.reference-images-content {
    overflow-y: auto;
    padding-right: 1rem;
    margin-right: -1rem;
}

.reference-images-content .upload-section {
    margin-bottom: 1.5rem;
}

.reference-images-content .upload-btn {
    display: block;
    width: 100%;
    padding: 1rem;
    text-align: center;
    background-color: #374151;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.reference-images-content .upload-btn:hover {
    background-color: #4B5563;
}

.reference-images-content h4 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #E5E7EB; /* text-gray-200 */
}

.reference-images-content .image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.reference-image-option {
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
}

.reference-image-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reference-image-option:hover {
    transform: scale(1.05);
}

.reference-image-option.selected {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.reference-images-content .description-section {
    margin-top: 1.5rem;
}

.reference-images-content .reference-description {
    width: 100%;
    min-height: 80px;
    background-color: #111827; /* bg-gray-900 */
    border: 1px solid #4B5563;
    border-radius: 8px;
    padding: 0.75rem;
    color: #F9FAFB;
}

/* Generation Type Selection */
.generation-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 2rem 0;
}

.generation-type-card {
    padding: 2rem;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    background-color: #374151;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.generation-type-card:hover {
    transform: translateY(-5px);
    background-color: #4B5563;
}

.generation-type-card.selected {
    border-color: var(--primary);
    color: var(--primary);
    background-color: rgba(99, 102, 241, 0.2);
}

.generation-type-card[disabled] {
    background-color: #4B5563;
    color: #9CA3AF;
    cursor: not-allowed;
    transform: none;
}

/* Style Selection */
.style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
    overflow-y: auto;
    padding: 0.5rem;
}

.style-item {
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.style-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.style-item img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.style-item p {
    font-weight: 500;
}

.style-item.selected {
    border-color: var(--primary);
    background-color: rgba(99, 102, 241, 0.1);
}

/* Poster Templates */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    overflow-y: auto;
    padding: 0.5rem;
}

.template-card {
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 1rem;
    background-color: #374151;
    transition: all 0.2s ease;
}

.template-card:hover {
    transform: translateY(-5px);
}

.template-card img {
    width: 100%;
    aspect-ratio: 1 / 1.2;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border: 1px solid #4B5563;
}

.template-card h4 {
    font-weight: 600;
}

.template-card.selected {
    border-color: var(--primary);
    background-color: rgba(99, 102, 241, 0.1);
}

/* Poster Customization */
.poster-customization-container {
    display: flex;
    gap: 2rem;
    height: 50vh;
}

.poster-inputs {
    flex: 1;
    overflow-y: auto;
    padding-right: 1rem;
}

.poster-inputs .form-group {
    margin-bottom: 1rem;
}

.poster-inputs label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: capitalize;
}

.poster-inputs .overlay-input {
    width: 100%;
    background-color: #111827;
    border: 1px solid #4B5563;
    border-radius: 8px;
    padding: 0.75rem;
    color: #F9FAFB;
}

.poster-preview {
    flex: 1;
    border: 1px solid #4B5563;
    border-radius: 8px;
    overflow: hidden;
    background-color: #111827;
}

#poster-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    transform: scale(0.95);
    transform-origin: top left;
}

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

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* PostEditor Integration Styles */
.edit-actions-container {
    background: rgba(30, 41, 59, 0.8);
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-top: 1rem;
}

.action-buttons {
    padding: 1rem;
}

.action-buttons .save-btn,
.action-buttons .cancel-btn,
.action-buttons .ai-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    min-height: 40px;
}

.action-buttons .save-btn {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
}

.action-buttons .save-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
}

.action-buttons .cancel-btn {
    background: rgba(107, 114, 128, 0.8);
    color: white;
}

.action-buttons .cancel-btn:hover {
    background: rgba(75, 85, 99, 0.9);
    transform: translateY(-1px);
}

.action-buttons .ai-btn {
    background: linear-gradient(135deg, #8B5CF6, #A855F7);
    color: white;
}

.action-buttons .ai-btn:hover {
    background: linear-gradient(135deg, #7C3AED, #9333EA);
    transform: translateY(-1px);
}

/* AI Suggestions Modal Styles */
.image-generation-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

#aiSuggestionsModal .modal-content {
    background: linear-gradient(135deg, var(--background-light), var(--surface));
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
}

#aiSuggestionsModal .modal-header {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: white;
    border-radius: 16px 16px 0 0;
}

#aiSuggestionsModal .modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    border-radius: 6px;
}

#aiSuggestionsModal .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

#aiChangesInput {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text);
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.9rem;
    resize: vertical;
    transition: all 0.2s ease;
}

#aiChangesInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-top: 2px solid #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
} 