* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: #0a0a0f;
    color: #e0e0e0;
    min-height: 100vh;
    line-height: 1.6;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.app-header {
    text-align: center;
    padding: 30px 0 20px;
    border-bottom: 1px solid #1e1e2e;
    margin-bottom: 30px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.logo-icon {
    font-size: 2rem;
}

.app-header h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #0077b5, #00a0dc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: #888;
    margin-top: 8px;
    font-size: 0.95rem;
}

.control-panel {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .control-panel {
        grid-template-columns: 1fr;
    }
}

.panel-card {
    background: #12121a;
    border: 1px solid #1e1e2e;
    border-radius: 12px;
    padding: 18px;
}

.panel-card h3 {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    font-size: 0.65rem;
    background: #0077b5;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-field {
    flex: 1;
    background: #1a1a26;
    border: 1px solid #2a2a3e;
    color: #e0e0e0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-field:focus {
    border-color: #0077b5;
}

.input-field::placeholder {
    color: #555;
}

.hint {
    font-size: 0.75rem;
    color: #666;
    margin-top: 6px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.settings-row label {
    font-size: 0.85rem;
    color: #aaa;
}

.settings-row select {
    background: #1a1a26;
    border: 1px solid #2a2a3e;
    color: #e0e0e0;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
}

.actions-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}

.btn-primary, .btn-secondary, .btn-sm {
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #0077b5, #005c8a);
    color: white;
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0088cc, #006699);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0,119,181,0.3);
}

.btn-secondary {
    background: #1e1e2e;
    color: #ccc;
    padding: 10px 20px;
    font-size: 0.9rem;
    border: 1px solid #2a2a3e;
}

.btn-secondary:hover:not(:disabled) {
    background: #2a2a3e;
}

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

.btn-sm {
    background: #1e1e2e;
    color: #ccc;
    padding: 6px 14px;
    font-size: 0.8rem;
    border: 1px solid #2a2a3e;
}

.btn-sm:hover {
    background: #2a2a3e;
}

.hidden {
    display: none !important;
}

.loader {
    text-align: center;
    padding: 60px 0;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #1e1e2e;
    border-top: 3px solid #0077b5;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

#loading-text {
    color: #888;
    font-size: 0.9rem;
}

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

.section-header h2 {
    font-size: 1.2rem;
    color: #ccc;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.post-card {
    background: #12121a;
    border: 1px solid #1e1e2e;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
}

.post-card:hover {
    border-color: #0077b5;
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,119,181,0.15);
}

.post-card.selected {
    border-color: #0077b5;
    box-shadow: 0 0 0 2px rgba(0,119,181,0.3);
}

.post-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #1a1a26;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    font-size: 0.8rem;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-card-body {
    padding: 16px;
}

.post-card-category {
    font-size: 0.7rem;
    color: #0077b5;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.post-card-headline {
    font-size: 1rem;
    font-weight: 600;
    color: #eee;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-preview {
    font-size: 0.82rem;
    color: #888;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}

.post-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.post-card-actions button {
    flex: 1;
    min-width: 80px;
    padding: 6px 12px;
    border: 1px solid #2a2a3e;
    background: #1a1a26;
    color: #bbb;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.post-card-actions button:hover {
    background: #2a2a3e;
    color: #fff;
}

.post-card-actions .download-active {
    background: #0077b5;
    border-color: #0077b5;
    color: white;
}

.preview-content {
    background: #12121a;
    border: 1px solid #1e1e2e;
    border-radius: 12px;
    padding: 30px;
    max-width: 680px;
    margin: 0 auto;
}

.preview-content .post-header {
    font-size: 1.1rem;
    color: #888;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-content .post-headline {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
    line-height: 1.3;
}

.preview-content .post-body {
    font-size: 0.95rem;
    color: #ccc;
    white-space: pre-wrap;
    margin-bottom: 20px;
    line-height: 1.7;
}

.preview-content .post-hashtags {
    color: #0077b5;
    font-size: 0.85rem;
    word-break: break-word;
}

.preview-content .post-image-container {
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
}

.preview-content .post-image-container img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
}

.preview-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
}

.preview-actions button {
    padding: 10px 24px;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e1e2e;
    color: #e0e0e0;
    padding: 12px 24px;
    border-radius: 8px;
    border: 1px solid #2a2a3e;
    font-size: 0.9rem;
    z-index: 1000;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    animation: fadeInUp 0.3s ease;
}

.toast.success {
    border-color: #00a86b;
}

.toast.error {
    border-color: #e74c3c;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}
