/* === Organic Farm-Inspired Wikipedia Style === */

:root {
    /* Earthy, natural palette inspired by farm aesthetics */
    --cream: #FAF7F2;
    --sage: #8FA68E;
    --sage-light: #E8F0E8;
    --sage-dark: #5C7A5C;
    --earth: #8B7355;
    --earth-light: #D4C5B5;
    --warm-white: #FDFCFA;
    --text-dark: #2C2416;
    --text-muted: #6B5D4D;
    --border: #D9D0C3;
    --warning: #D4A574;
    --danger: #C17B7B;
    --success: #7BA37B;
    
    --sidebar-width: 220px;
    --header-height: 60px;
}

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

body {
    font-family: 'Source Sans Pro', -apple-system, sans-serif;
    background-color: var(--cream);
    color: var(--text-dark);
    line-height: 1.7;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d9d0c3' fill-opacity='0.15'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Typography */
h1, h2, h3, h4 {
    font-family: 'Merriweather', Georgia, serif;
    color: var(--sage-dark);
    font-weight: 700;
    margin-bottom: 0.8em;
}

h1 { font-size: 2.2rem; border-bottom: 2px solid var(--sage-light); padding-bottom: 0.3em; }
h2 { font-size: 1.6rem; margin-top: 1.5em; }
h3 { font-size: 1.3rem; color: var(--earth); }

a {
    color: var(--sage-dark);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--earth);
    text-decoration: underline;
}

/* Layout */
.wiki-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.wiki-header {
    background: linear-gradient(135deg, var(--sage-dark) 0%, var(--sage) 100%);
    color: white;
    padding: 0 2rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(44, 36, 22, 0.1);
}

.logo a {
    font-family: 'Merriweather', serif;
    font-size: 1.4rem;
    color: white;
    text-decoration: none;
    font-weight: 700;
}

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

.top-nav a {
    color: rgba(255,255,255,0.9);
    font-weight: 600;
    font-size: 0.95rem;
}

.top-nav a:hover {
    color: white;
    text-decoration: none;
}

.user-greeting {
    color: var(--sage-light);
    font-size: 0.9rem;
}

.wiki-container {
    display: flex;
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem;
    gap: 2rem;
}

/* Sidebar */
.wiki-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-height) + 2rem);
    height: fit-content;
}

.sidebar-section {
    background: var(--warm-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.2rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

.sidebar-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--earth);
    margin-bottom: 0.8rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--earth-light);
}

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

.sidebar-section li {
    margin-bottom: 0.4rem;
}

.sidebar-section a {
    font-size: 0.92rem;
    color: var(--text-muted);
    display: block;
    padding: 0.2rem 0;
}

.sidebar-section a:hover {
    color: var(--sage-dark);
}

.admin-panel {
    border-left: 3px solid var(--warning);
}

/* Main Content */
.wiki-content {
    flex: 1;
    background: var(--warm-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    min-height: 600px;
}

/* Article Styles */
.article-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--sage-light);
}

.article-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.article-body {
    font-size: 1.05rem;
    line-height: 1.8;
}

.article-body p {
    margin-bottom: 1.2rem;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1.5rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* YouTube Embed */
.youtube-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    max-width: 100%;
    margin: 1.5rem 0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.youtube-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Article Gallery */
.article-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.article-gallery img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
    transition: transform 0.2s;
}

.article-gallery img:hover {
    transform: scale(1.03);
}

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

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--sage-dark);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--cream);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--sage);
    box-shadow: 0 0 0 3px var(--sage-light);
}

textarea.form-control {
    min-height: 400px;
    font-family: 'Source Sans Pro', monospace;
    line-height: 1.6;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--sage);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(92, 122, 92, 0.3);
}

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

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

/* Alerts */
.alert {
    padding: 1rem 1.2rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-success { background: #e8f5e9; border-color: var(--success); color: #2e7d32; }
.alert-danger { background: #ffebee; border-color: var(--danger); color: #c62828; }
.alert-warning { background: #fff3e0; border-color: var(--warning); color: #e65100; }
.alert-info { background: #e3f2fd; border-color: #90caf9; color: #1565c0; }

/* Article Cards (Homepage) */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.article-card {
    background: var(--warm-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    transition: box-shadow 0.2s, transform 0.2s;
}

.article-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.article-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.article-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Admin Table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.admin-table th,
.admin-table td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    background: var(--sage-light);
    color: var(--sage-dark);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.admin-table tr:hover {
    background: var(--cream);
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-published { background: var(--sage-light); color: var(--sage-dark); }
.badge-pending { background: #fff3e0; color: #e65100; }
.badge-rejected { background: #ffebee; color: #c62828; }

/* Footer */
.wiki-footer {
    background: var(--text-dark);
    color: var(--earth-light);
    text-align: center;
    padding: 2rem;
    margin-top: auto;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 900px) {
    .wiki-container {
        flex-direction: column;
        padding: 1rem;
    }
    
    .wiki-sidebar {
        width: 100%;
        position: static;
    }
    
    .wiki-content {
        padding: 1.5rem;
    }
}