:root {
    --bg-color: #f3f5f9;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --accent-color: #008069; /* Will be overridden by settings */
    --accent-hover: rgba(0, 128, 105, 0.1); 
    --danger-color: #ef4444;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s, opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-color); /* Add solid background */
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--border-color); /* Subtle separation */
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.topic-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--accent-hover);
    color: var(--accent-color);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.logo-area a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--card-bg);
    border-radius: var(--border-radius-sm);
    color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.header-actions a {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    background: var(--card-bg);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    font-weight: 600;
}

/* Layout container */
.layout-container {
    display: flex;
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 0 2rem 2rem 2rem;
    gap: 1.5rem;
}

/* Sidebar Bento */
.sidebar {
    width: 320px;
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
    height: fit-content;
    position: sticky;
    top: 6rem;
    z-index: 20;
    transition: transform 0.3s ease;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-radius: var(--border-radius-md);
    transition: all 0.2s;
    font-weight: 500;
}

.sidebar-link i {
    font-size: 1.1rem;
}

.sidebar-link:hover, .sidebar-link.active {
    background-color: var(--accent-hover);
    color: var(--accent-color);
}

.admin-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border-color);
}

/* Main Content Bento */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Search Bento */
.search-container {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 0.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
}

.search-input {
    width: 100%;
    padding: 0.9rem 1.25rem 0.9rem 2.8rem;
    font-size: 1rem;
    border: none;
    border-radius: var(--border-radius-md);
    background-color: var(--bg-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    background-color: var(--card-bg);
    box-shadow: 0 0 0 4px var(--accent-hover);
}

.search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.25rem;
}

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-radius: var(--border-radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    z-index: 100;
    display: none;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

.search-result-item {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-sm);
    display: block;
    color: var(--text-primary);
    transition: background-color 0.2s;
    margin-bottom: 0.25rem;
}

.search-result-item:hover {
    background-color: var(--bg-color);
}

/* Card Grid Bento */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
    min-height: 130px;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 0 0 2px transparent inset;
    transition: box-shadow 0.3s;
    pointer-events: none;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.06);
}

.card:hover::before {
    box-shadow: 0 0 0 2px var(--accent-hover) inset;
}

.card-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.card-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Article View Bento */
.article-container {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 3rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
}

.article-header {
    margin-bottom: 0rem;
    padding-bottom: 0rem;
    border-bottom: 1px solid var(--bg-color);
}

.article-title {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.article-meta {
    color: var(--text-secondary);
    display: flex;
    gap: 1.5rem;
    align-items: center;
    font-weight: 500;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article-content {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #334155;
}

.article-content img {
    max-width: 100%;
    border-radius: var(--border-radius-md);
    margin: 2rem 0;
    box-shadow: 0 8px 30px rgba(0,0,0,0.05);
}

.article-content h2 { font-size: 2rem; margin: 3rem 0 1.5rem; font-weight: 700; letter-spacing: -0.5px; color: var(--text-primary); }
.article-content h3 { font-size: 1.5rem; margin: 2rem 0 1rem; font-weight: 600; color: var(--text-primary); }
.article-content p { margin-bottom: 1.5rem; }
.article-content ul, .article-content ol { margin-bottom: 1.5rem; padding-left: 1.5rem; }
.article-content li { margin-bottom: 0.5rem; }

/* Setup & Auth Forms Bento */
.auth-container, .setup-container {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.05);
}

.auth-container { max-width: 450px; margin: 4rem auto; }
.setup-container { max-width: 650px; margin: 3rem auto; }

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

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

.form-input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1.05rem;
    transition: all 0.2s;
    font-family: inherit;
    background-color: var(--bg-color);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background-color: var(--card-bg);
}

/* Buttons completely rounded */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    border-radius: 50px; /* Fully rounded */
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-family: inherit;
}

.btn i {
    font-size: 1.1rem;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 4px 15px var(--accent-hover);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-hover);
    color: white;
}

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

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

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

.btn-text:hover {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

/* Footer Bento */
.main-footer {
    padding: 2rem;
    margin-top: auto;
}

.footer-content {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 2rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
    font-weight: 500;
}

.editor-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
}

.editor-link:hover {
    background: var(--accent-hover);
    color: var(--accent-color);
}

/* Modals Bento */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 450px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    animation: modalIn 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes modalIn {
    to { transform: scale(1); }
}

.modal h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.highlight {
    background-color: var(--accent-hover);
    color: var(--accent-color);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-weight: 600;
}

/* Setup Wizard Steps */
.wizard-step { display: none; }
.wizard-step.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.step-indicator {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}
.step-dot {
    flex: 1;
    height: 6px;
    background: var(--bg-color);
    border-radius: 3px;
    transition: background 0.3s;
}
.step-dot.active {
    background: var(--accent-color);
}

/* Utility classes */
.page-header {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1, .page-header h2 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* Mobile Adjustments */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-primary);
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 15;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.desktop-only {
    display: flex;
}

.mobile-only-menu {
    display: none;
}

@media (max-width: 900px) {
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only-menu {
        display: block;
        margin-top: auto;
        padding-bottom: 2rem;
    }
    
    .layout-container {
        flex-direction: column;
        padding: 0 1rem 1rem 1rem;
    }
    
    .main-header {
        padding: 1rem;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        overflow-y: auto;
        transform: translateX(-100%);
        border-radius: 0;
        border-top-right-radius: var(--border-radius-lg);
        border-bottom-right-radius: var(--border-radius-lg);
        padding-top: 2rem;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

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

    .article-container {
        padding: 1.5rem;
    }
    
    .article-title {
        font-size: 1.8rem;
    }
}
