/* =============================================================================
   Global Styles
   ============================================================================= */

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

:root {
    --primary: #3b82f6;
    --primary-dark: #1e40af;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1f2937;
    --dark-light: #374151;
    --light: #f3f4f6;
    --light-dark: #e5e7eb;
    --white: #ffffff;
    --text: #111827;
    --text-light: #6b7280;
    --border-radius: 8px;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

html {
    scroll-behavior: smooth;
}

/* =============================================================================
   Typography
   ============================================================================= */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
}

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

a:hover {
    color: var(--primary-dark);
}

/* =============================================================================
   Layout
   ============================================================================= */

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

.flex {
    display: flex;
}

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

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

.grid {
    display: grid;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.gap-1 { gap: 1rem; }
.gap-2 { gap: 2rem; }
.gap-3 { gap: 3rem; }

/* =============================================================================
   Header & Navigation
   ============================================================================= */

header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    padding: 1rem 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

nav a {
    color: var(--text);
    font-weight: 500;
}

nav a:hover,
nav a.active {
    color: var(--primary);
}

.auth-buttons {
    display: flex;
    gap: 1rem;
}

/* =============================================================================
   Buttons
   ============================================================================= */

button, .btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

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

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

.btn-secondary:hover {
    background: #059669;
}

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

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

.btn-outline {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

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

/* =============================================================================
   Forms
   ============================================================================= */

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

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

input, textarea, select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--light-dark);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.form-error {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-input-error {
    border-color: var(--danger) !important;
}

.form-success {
    color: var(--secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* =============================================================================
   Cards
   ============================================================================= */

.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

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

.card-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--light-dark);
}

.card-body {
    margin-bottom: 1rem;
}

.card-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--light-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* =============================================================================
   Blog Post Styles
   ============================================================================= */

.post-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

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

.post-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.post-content {
    padding: 1.5rem;
}

.post-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

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

.post-excerpt {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.post-link {
    color: var(--primary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.post-link:hover {
    gap: 0.75rem;
}

/* =============================================================================
   Hero Section
   ============================================================================= */

.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 4rem 1.5rem;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

/* =============================================================================
   Comments
   ============================================================================= */

.comments-section {
    margin-top: 2rem;
}

.comment {
    background: var(--light);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-weight: 600;
    color: var(--text);
}

.comment-date {
    color: var(--text-light);
    font-size: 0.875rem;
}

.comment-content {
    color: var(--text);
    line-height: 1.6;
}

/* =============================================================================
   Alerts & Messages
   ============================================================================= */

.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #7f1d1d;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #78350f;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #dbeafe;
    color: #0c2d6b;
    border: 1px solid #bfdbfe;
}

/* =============================================================================
   Footer
   ============================================================================= */

footer {
    background: var(--dark);
    color: var(--white);
    padding: 2rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: var(--white);
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #d1d5db;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--white);
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 1.5rem;
    text-align: center;
    color: #9ca3af;
}

/* =============================================================================
   Admin Styles
   ============================================================================= */

.admin-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: var(--dark);
    color: var(--white);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-main {
    padding: 2rem;
}

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

.admin-menu li {
    margin: 0;
}

.admin-menu a {
    display: block;
    padding: 1rem 1.5rem;
    color: #d1d5db;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.admin-menu a:hover,
.admin-menu a.active {
    background: var(--primary);
    color: var(--white);
    border-left-color: var(--white);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--light-dark);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table thead {
    background: var(--light);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    border-bottom: 2px solid var(--light-dark);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--light-dark);
}

.data-table tbody tr:hover {
    background: var(--light);
}

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

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #78350f;
}

.badge-danger {
    background: #fee2e2;
    color: #7f1d1d;
}

/* =============================================================================
   Pagination
   ============================================================================= */

.pagination {
    display: flex;
    gap: 0.5rem;
    margin: 2rem 0;
    justify-content: center;
}

.pagination a, .pagination span {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--light-dark);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--primary);
    transition: all 0.3s ease;
}

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

.pagination .active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.pagination .disabled {
    color: var(--text-light);
    cursor: not-allowed;
}

/* =============================================================================
   Utility Classes
   ============================================================================= */

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

.text-center { text-align: center; }
.text-light { color: var(--text-light); }
.text-muted { opacity: 0.7; }
.hidden { display: none !important; }
.full-width { width: 100%; }
.max-width { max-width: 100%; }

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--light-dark);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* =============================================================================
   Responsive
   ============================================================================= */

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

    nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .admin-container {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        height: auto;
        position: relative;
    }

    .admin-menu ul {
        display: flex;
        flex-wrap: wrap;
    }

    .admin-menu a {
        padding: 0.75rem 1rem;
    }

    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 0.875rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem;
    }
}
