/**
 * Blog System - Professional Stylesheet
 * Modern, responsive design with best practices
 */

/* ===========================
   CSS Variables & Reset
=========================== */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --text-color: #333;
    --text-light: #666;
    --border-color: #e0e0e0;
    --bg-color: #f5f7fa;
    --white: #ffffff;
    --success: #4caf50;
    --danger: #f44336;
    --warning: #ff9800;
    --info: #2196f3;
    --dark: #2c3e50;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
    --transition: all 0.3s ease;
    --border-radius: 8px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

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

a:hover {
    color: var(--secondary-color);
}

/* ===========================
   Typography
=========================== */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--dark);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

/* ===========================
   Layout Components
=========================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 40px 0;
}

/* ===========================
   Header & Navigation
=========================== */
.site-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 20px 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.site-logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
}

.site-logo:hover {
    color: var(--accent-color);
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center;
}

.main-nav a {
    color: var(--white);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
    background: rgba(255, 255, 255, 0.2);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
}

/* ===========================
   Grid Layout
=========================== */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
    align-items: start;
}

/* ===========================
   Post Cards
=========================== */
.post-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    margin-bottom: 30px;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.post-thumbnail {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.post-content {
    padding: 25px;
}

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

.post-category {
    background: var(--primary-color);
    color: var(--white);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.post-title {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.post-title a {
    color: var(--dark);
    transition: var(--transition);
}

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

.post-excerpt {
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.7;
}

.read-more {
    display: inline-block;
    padding: 10px 25px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
}

.read-more:hover {
    background: var(--secondary-color);
    transform: translateX(5px);
}

/* ===========================
   Single Post
=========================== */
.single-post {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--shadow);
}

.post-header {
    margin-bottom: 30px;
}

.post-featured-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.post-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
}

.post-body h2,
.post-body h3 {
    margin-top: 30px;
    margin-bottom: 15px;
}

.post-body p {
    margin-bottom: 20px;
}

.post-body ul,
.post-body ol {
    margin: 20px 0;
    padding-left: 30px;
}

.post-body li {
    margin-bottom: 10px;
}

.post-body img {
    margin: 30px 0;
    border-radius: var(--border-radius);
}

.post-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 30px 0;
    font-style: italic;
    color: var(--text-light);
}

/* ===========================
   Sidebar
=========================== */
.sidebar {
    position: sticky;
    top: 100px;
}

.widget {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.widget-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.category-list,
.recent-posts-list {
    list-style: none;
}

.category-list li,
.recent-posts-list li {
    margin-bottom: 12px;
}

.category-list a,
.recent-posts-list a {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    color: var(--text-color);
}

.category-list a:hover,
.recent-posts-list a:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.post-count {
    background: var(--primary-color);
    color: var(--white);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
}

.recent-post-item {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.recent-post-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.recent-post-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius);
    flex-shrink: 0;
}

.recent-post-info {
    flex: 1;
}

.recent-post-title {
    font-size: 0.95rem;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recent-post-date {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ===========================
   Pagination
=========================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
}

.pagination a,
.pagination span {
    padding: 10px 15px;
    background: var(--white);
    border-radius: var(--border-radius);
    color: var(--text-color);
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.pagination a:hover,
.pagination .active {
    background: var(--primary-color);
    color: var(--white);
}

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

/* ===========================
   Footer
=========================== */
.site-footer {
    background: var(--dark);
    color: var(--white);
    padding: 40px 0 20px;
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer-widget h3 {
    color: var(--white);
    margin-bottom: 20px;
}

.footer-widget p,
.footer-widget a {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.8;
}

.footer-widget a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

/* ===========================
   Admin Styles
=========================== */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    background: var(--dark);
    color: var(--white);
    padding: 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.admin-logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
    color: var(--white);
}

.admin-nav ul {
    list-style: none;
}

.admin-nav li {
    margin-bottom: 5px;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.8);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.admin-nav a:hover,
.admin-nav a.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.admin-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    background: var(--bg-color);
}

.admin-header {
    background: var(--white);
    padding: 20px 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-title {
    font-size: 1.8rem;
    color: var(--dark);
}

.btn-logout {
    background: var(--danger);
    color: var(--white);
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    opacity: 0.9;
}

/* ===========================
   Forms
=========================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea.form-control {
    min-height: 150px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

/* ===========================
   Buttons
=========================== */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

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

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

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

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

.btn-secondary {
    background: var(--text-light);
    color: var(--white);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-group {
    display: flex;
    gap: 10px;
}

/* ===========================
   Tables
=========================== */
.table-wrapper {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-color);
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--dark);
}

td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: var(--bg-color);
}

/* ===========================
   Alerts
=========================== */
.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-weight: 500;
}

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

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

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

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

/* ===========================
   Ads
=========================== */
.ad-container {
    margin: 30px 0;
    text-align: center;
}

.ad-label {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===========================
   Login Page
=========================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 20px;
}

.login-box {
    background: var(--white);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 100%;
}

.login-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
}

/* ===========================
   Responsive Design
=========================== */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
    }
    
    .admin-sidebar {
        width: 220px;
    }
    
    .admin-content {
        margin-left: 220px;
    }
}

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    
    .menu-toggle {
        display: block;
    }
    
    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--dark);
        padding: 20px;
        display: none;
    }
    
    .main-nav.active {
        display: block;
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 10px;
    }
    
    .main-nav a {
        display: block;
    }
    
    .admin-sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
        z-index: 1000;
    }
    
    .admin-sidebar.active {
        transform: translateX(0);
    }
    
    .admin-content {
        margin-left: 0;
    }
    
    .post-featured-image {
        height: 250px;
    }
    
    .single-post {
        padding: 25px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .post-content {
        padding: 20px;
    }
    
    .login-box {
        padding: 30px 20px;
    }
    
    .table-wrapper {
        padding: 15px;
    }
    
    th, td {
        padding: 10px;
        font-size: 0.9rem;
    }
}

/* ===========================
   Utility Classes
=========================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }
