* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Header */
.header {
    background: #667eea;
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.header nav {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.header nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 5px;
    transition: background 0.3s;
}

.header nav a:hover {
    background: rgba(255,255,255,0.1);
}

.btn-admin {
    background: rgba(255,255,255,0.2) !important;
}

/* Main Content */
main {
    padding: 40px 20px;
    min-height: calc(100vh - 200px);
}

h2 {
    font-size: 32px;
    margin-bottom: 30px;
    color: #333;
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.post-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.post-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.post-card h3 {
    padding: 15px;
    font-size: 20px;
}

.post-card h3 a {
    color: #333;
    text-decoration: none;
}

.post-card h3 a:hover {
    color: #667eea;
}

.post-card p {
    padding: 0 15px 15px;
    color: #666;
    font-size: 14px;
}

.post-meta {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
}

/* Footer */
.footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px;
}

/* Error Container */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 20px;
}

.error-container h1 {
    color: #dc3545;
    margin-bottom: 20px;
}

.error-details {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    color: #721c24;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

.btn:hover {
    background: #5568d3;
}

/* Responsive */
@media (max-width: 768px) {
    .posts-grid {
        grid-template-columns: 1fr;
    }
    
    .header nav {
        flex-direction: column;
        gap: 10px;
    }
}