/* style.css */
:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --error: #ef4444;
    --success: #10b981;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

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

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.header-nav {
    margin-top: 15px;
}

.header-nav a {
    display: inline-block;
}

@media (max-width: 768px) {
    header {
        padding: 20px 15px;
        margin-bottom: 20px;
        border-radius: 8px;
    }
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary);
}

.subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

.stats {
    margin-top: 15px;
    display: flex;
    gap: 20px;
    justify-content: center;
    font-size: 0.95rem;
    color: var(--text-light);
}

.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    min-height: 44px; /* Touch-friendly size */
}

@media (max-width: 768px) {
    .btn-primary,
    .btn-secondary {
        padding: 12px 16px;
        font-size: 0.95rem;
    }
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

.btn-secondary:hover {
    background: var(--background);
}

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

select {
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 1rem;
}

.search-box {
    flex: 1;
    min-width: 250px;
}

#search-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.error {
    background: #fef2f2;
    border: 1px solid var(--error);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: var(--error);
}

.error button {
    margin-top: 15px;
}

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

.post-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

@media (max-width: 768px) {
    .post-card {
        padding: 15px;
        border-radius: 8px;
    }
}

.post-card:hover {
    box-shadow: var(--shadow-lg);
    border-left-color: var(--primary);
    transform: translateY(-2px);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
    gap: 15px;
}

.post-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    flex: 1;
}

@media (max-width: 768px) {
    .post-title {
        font-size: 1.1rem;
    }
}

.post-title a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

.post-title a:hover {
    color: var(--primary);
}

.post-date {
    color: var(--text-light);
    font-size: 0.9rem;
    white-space: nowrap;
}

.post-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-light);
    flex-wrap: wrap;
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.feed-badge {
    background: var(--primary);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
}

.post-summary {
    color: var(--text);
    line-height: 1.7;
    margin-top: 12px;
    padding: 12px;
    background: var(--background);
    border-radius: 8px;
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .post-summary {
        font-size: 0.9rem;
        padding: 10px;
    }
}

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

.post-link:hover {
    text-decoration: underline;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 40px;
    padding: 20px;
}

#page-info {
    color: var(--text-light);
}

.sidebar {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    margin-top: 30px;
    box-shadow: var(--shadow);
}

.sidebar h3 {
    margin-bottom: 15px;
    color: var(--text);
}

.feed-item {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.feed-item:last-child {
    border-bottom: none;
}

.feed-title {
    font-weight: 500;
    color: var(--text);
}

.feed-count {
    color: var(--text-light);
    font-size: 0.9rem;
}

footer {
    text-align: center;
    margin-top: 60px;
    padding: 20px;
    color: var(--text-light);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.last-updated {
    margin-top: 10px;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .stats {
        flex-direction: column;
        gap: 8px;
    }

    .post-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .post-date {
        white-space: normal;
        font-size: 0.85rem;
    }

    .post-meta {
        gap: 10px;
        font-size: 0.85rem;
    }

    .feed-badge {
        font-size: 0.8rem;
        padding: 2px 8px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .search-box {
        width: 100%;
        min-width: 0;
    }

    #search-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    select {
        font-size: 0.95rem;
        min-height: 44px;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 10px;
        padding: 15px 10px;
    }

    #page-info {
        width: 100%;
        text-align: center;
        order: -1;
        margin-bottom: 10px;
    }
}
