/* ===== CSS Variables & Reset ===== */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #252540;
    --bg-hover: #2d2d4a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b80;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --success: #10b981;
    --warning: #f59e0b;
    --border-color: #3d3d5c;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== App Container ===== */
.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    text-align: center;
    padding: 30px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    font-size: 2.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo .highlight {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===== Main Content ===== */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 24px;
    flex: 1;
}

/* ===== Panel Styles ===== */
.articles-panel,
.generator-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.panel-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1rem;
}

/* ===== Filter Bar ===== */
.filter-bar {
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.search-input,
.select-input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-input:focus,
.select-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* ===== Articles List ===== */
.articles-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.article-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.article-card:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
}

.article-card.selected {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.article-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.article-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.article-date::before {
    content: "📅 ";
}

.article-category::before {
    content: "🏷️ ";
}

/* ===== Platform Tabs ===== */
.platform-tabs {
    display: flex;
    padding: 16px 20px;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
}

.tab-icon {
    font-size: 1.1rem;
}

/* ===== Post Variants ===== */
.post-variants {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    overflow-y: auto;
}

.variant-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.variant-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-color);
}

.variant-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.copy-btn {
    padding: 6px 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.copy-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.variant-content {
    padding: 16px;
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.placeholder-text {
    color: var(--text-muted);
    font-style: italic;
}

/* ===== Hashtags Section ===== */
.hashtags-section {
    margin: 0 20px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.hashtags-content {
    padding: 16px;
    font-size: 0.9rem;
    color: var(--accent-secondary);
}

/* ===== Selected Badge ===== */
.selected-badge {
    padding: 8px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-badge.hidden {
    display: none;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 24px;
}

.footer-links {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
}

.footer-link {
    color: var(--accent-primary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

.footer-separator {
    color: var(--text-muted);
}

/* ===== Toast Notification ===== */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: var(--success);
    color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.toast.hidden {
    display: none;
}

@keyframes slideIn {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Loading State ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

.loading::after {
    content: "";
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Modal Styles ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    line-height: 1.8;
    color: var(--text-secondary);
}

.modal-body h3 {
    color: var(--text-primary);
    margin-top: 24px;
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    margin-bottom: 16px;
}

.modal-body ul {
    margin-left: 24px;
    margin-bottom: 16px;
}

.modal-body li {
    margin-bottom: 8px;
}

.modal-body a {
    color: var(--accent-primary);
    text-decoration: none;
}

.modal-body a:hover {
    text-decoration: underline;
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .articles-panel {
        max-height: 400px;
    }

    .modal-content {
        max-width: 95%;
    }
}
