/* ===== Reset & Basics ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* ===== Header ===== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

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

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== Main Content ===== */
.main {
    flex: 1;
    padding: 2rem 0;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-large {
    padding: 0.8rem 2rem;
    font-size: 1rem;
}

.btn-active {
    background: #667eea;
    color: white;
}

/* ===== Alert ===== */
.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 5px;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== Posts Grid ===== */
.posts-container {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.posts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.posts-header h2 {
    color: #333;
    font-size: 1.8rem;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-buttons .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}

.filter-buttons .btn:hover {
    background: #e0e0e0;
}

.filter-buttons .btn-active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

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

.post-card {
    background: #f9f9f9;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.post-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: #e0e0e0;
}

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

.no-image {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #999;
}

.no-image i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.post-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

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

.post-header h3 {
    color: #333;
    font-size: 1.1rem;
    margin: 0;
}

.badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-draft {
    background: #fff3cd;
    color: #856404;
}

.badge-published {
    background: #d4edda;
    color: #155724;
}

.post-category {
    color: #667eea;
    font-weight: 500;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.post-text {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
    flex: 1;
    line-height: 1.5;
}

.post-date {
    color: #999;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

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

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #999;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.page-link {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 5px;
    color: #667eea;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.page-link:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.page-link.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* ===== Forms ===== */
.create-post-container,
.edit-post-container {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.create-post-container h2,
.edit-post-container h2 {
    margin-bottom: 2rem;
    color: #333;
}

.create-post-form,
.edit-form {
    max-width: 800px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.3rem;
    color: #999;
    font-size: 0.85rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* ===== Edit Content ===== */
.edit-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
}

.edit-preview {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.edit-preview h3 {
    margin-bottom: 1rem;
    color: #333;
}

.preview-img {
    width: 100%;
    height: auto;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.no-image-preview {
    width: 100%;
    height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #999;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.no-image-preview i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.post-meta {
    font-size: 0.9rem;
    color: #666;
}

.post-meta p {
    margin-bottom: 0.5rem;
}

.edit-actions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #ddd;
}

.edit-actions h4 {
    margin-bottom: 1rem;
}

.edit-actions .btn {
    display: block;
    width: 100%;
    margin-bottom: 0.5rem;
}

/* ===== Progress Bar ===== */
.progress-container {
    margin-top: 2rem;
    padding: 2rem;
    background: #f9f9f9;
    border-radius: 10px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.progress-text {
    color: #667eea;
    font-weight: 500;
}

/* ===== Preview Container ===== */
.preview-container {
    margin-top: 2rem;
    padding: 2rem;
    background: #f9f9f9;
    border-radius: 10px;
    border: 2px solid #667eea;
}

.preview-container h3 {
    margin-bottom: 1.5rem;
    color: #333;
}

.preview-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
}

.preview-image {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-image img {
    width: 100%;
    height: auto;
    display: block;
}

.preview-text h4 {
    margin-bottom: 1rem;
    color: #333;
}

.preview-text p {
    color: #666;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.preview-meta {
    background: white;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1.5rem;
}

.preview-meta p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.preview-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== Notification ===== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
    z-index: 1000;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.notification-success {
    background: #d4edda;
    color: #155724;
}

.notification-error {
    background: #f8d7da;
    color: #721c24;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Footer ===== */
.footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
    border-top: 1px solid #34495e;
}

.footer p {
    margin: 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .posts-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .edit-content {
        grid-template-columns: 1fr;
    }

    .edit-preview {
        position: static;
    }

    .preview-content {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    html {
        font-size: 14px;
    }

    .notification {
        left: 10px;
        right: 10px;
    }
}
