:root {
    --primary-color: #39aa9b;
    --primary-dark: #2d8a7e;
    --primary-light: #4fc4b3;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --bg-color: #f8f9fa;
    --white: #ffffff;
    --border-color: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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);
}

.navbar {
    background-color: var(--white);
    box-shadow: var(--shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-text {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-user {
    color: var(--text-light);
    padding: 0.5rem 1rem;
    background-color: var(--bg-color);
    border-radius: 20px;
    font-size: 0.9rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.main-content {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

.hero-section {
    text-align: center;
    padding: 1rem 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--white);
    border-radius: 12px;
    margin-bottom: 2rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
}

.hero-subtitle {
    font-size: 1.3rem;
    opacity: 0.95;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.page-header h1 {
    font-size: 2rem;
    color: var(--secondary-color);
}

.page-actions {
    display: flex;
    gap: 1rem;
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: #34495e;
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--accent-color);
    color: var(--white);
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.3rem;
    transition: transform 0.2s ease;
}

.btn-icon:hover {
    transform: scale(1.2);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.dashboard-card {
    background-color: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.dashboard-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.quick-links {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.directory-list,
.page-list {
    list-style: none;
}

.directory-list li,
.page-list li {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
}

.directory-list li:last-child,
.page-list li:last-child {
    border-bottom: none;
}

.directory-list a,
.page-list a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.directory-list a:hover,
.page-list a:hover {
    color: var(--primary-dark);
}

.directory-description,
.page-meta {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 0.3rem;
}

.welcome-message {
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.welcome-message h2 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.welcome-message p {
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.directory-tree {
    background-color: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.tree-list {
    list-style: none;
}

.tree-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.tree-item:hover {
    background-color: var(--bg-color);
}

.tree-item:last-child {
    border-bottom: none;
}

.tree-item-content {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.tree-icon {
    font-size: 1.3rem;
}

.tree-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    flex: 1;
}

.tree-link:hover {
    color: var(--primary-dark);
}

.tree-actions {
    display: flex;
    gap: 0.5rem;
}

.tree-description {
    margin-top: 0.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
    padding-left: 2.5rem;
}

.badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-restricted {
    background-color: #fff3cd;
    color: #856404;
}

.form-container {
    background-color: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    /*max-width: 800px;*/
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.form-control {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-text {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.text-danger {
    color: var(--accent-color);
    font-size: 0.9rem;
    margin-top: 0.3rem;
    display: block;
}

.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-light);
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.content-section {
    background-color: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.content-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.list-icon {
    margin-right: 0.5rem;
}

.item-description {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.3rem;
    margin-left: 1.5rem;
}

.empty-message {
    color: var(--text-light);
    font-style: italic;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-light);
}

.empty-state p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.page-card {
    background-color: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.page-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.page-card h3 {
    margin-bottom: 0.8rem;
}

.page-card h3 a {
    color: var(--primary-color);
    text-decoration: none;
}

.page-card h3 a:hover {
    color: var(--primary-dark);
}

.page-updated {
    margin-top: 0.5rem;
    color: var(--text-light);
}

.info-separator {
    margin: 0 0.5rem;
}

.page-info {
    background-color: var(--bg-color);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.author-info,
.update-info {
    margin: 0.3rem 0;
}

.page-content {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.page-content h1,
.page-content h2,
.page-content h3,
.page-content h4,
.page-content h5,
.page-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.page-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

.page-content code {
    background-color: var(--bg-color);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.page-content pre {
    background-color: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
}

.page-footer {
    display: flex;
    gap: 1rem;
}

#editor-container {
    min-height: 400px;
    background-color: var(--white);
    border: 2px solid var(--border-color);
    border-radius: 6px;
}

.ql-toolbar {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    position: sticky;
    top: 0;
    z-index: 1000; /* Ensure it stays above other elements */
    background-color: white; /* Match the editor's background */
    border-bottom: 1px solid #ccc; /* Optional: Add a border for separation */
}

.ql-container {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

.revisions-list {
    background-color: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.revision-item {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.revision-item:last-child {
    border-bottom: none;
}

.revision-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.revision-date {
    color: var(--text-light);
    font-size: 0.9rem;
}

.revision-description {
    color: var(--text-light);
    font-size: 0.9rem;
}

.footer {
    background-color: var(--white);
    padding: 2rem 0;
    text-align: center;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 2rem;
}

.login-card {
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 3rem;
    max-width: 450px;
    width: 100%;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-light);
    font-size: 1rem;
}

.form-checkbox {
    display: flex;
    align-items: center;
}

.form-checkbox label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal;
}

.form-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.btn-block {
    width: 100%;
}

.ai-search-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 1rem;
    background-color: var(--primary-color);
    color: var(--white);
    text-decoration: none;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.ai-search-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.ai-search-button svg {
    flex-shrink: 0;
}

.chat-container {
    max-width: 900px;
    margin: 0 auto;
    height: calc(100vh - 250px);
    display: flex;
    flex-direction: column;
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--white);
    padding: 1rem 1.5rem;
    text-align: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-welcome {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-light);
}

.chat-welcome h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.message {
    display: flex;
    max-width: 80%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    align-self: flex-end;
}

.user-message .message-content {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 1rem 1.3rem;
    border-radius: 18px 18px 4px 18px;
}

.ai-message {
    align-self: flex-start;
}

.ai-message .message-content {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 1rem 1.3rem;
    border-radius: 18px 18px 18px 4px;
}

.typing-indicator {
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: var(--text-light);
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

.chat-input-container {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--white);
}

#chatForm {
    display: flex;
    gap: 0.8rem;
}

.chat-input {
    flex: 1;
    padding: 0.8rem 1.2rem;
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chat-send-btn {
    padding: 0.8rem 2rem;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-btn:hover:not(:disabled) {
    background-color: var(--primary-dark);
}

.chat-send-btn:disabled {
    background-color: var(--text-light);
    cursor: not-allowed;
    opacity: 0.6;
}

.button-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error-message .message-content {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.statistics-response {
    line-height: 1.8;
}

.statistics-response p {
    margin: 0.8rem 0;
}

.statistics-response ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.statistics-response li {
    margin: 0.3rem 0;
}

.statistics-response strong {
    color: var(--primary-color);
}

.ai-result-card {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin: 0.8rem 0;
}

.ai-result-card h4 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
}

.ai-result-card h4 a {
    color: var(--primary-color);
    text-decoration: none;
}

.ai-result-card h4 a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.ai-result-card p {
    margin: 0.5rem 0;
    color: var(--text-color);
}

.ai-result-card small {
    color: var(--text-light);
    font-size: 0.85rem;
}

.directory-tree-container {
    background-color: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.directory-tree-container h2 {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

.directory-tree {
    list-style: none;
    padding-left: 0;
}

.directory-tree ul {
    list-style: none;
    padding-left: 2rem;
    margin-top: 0.5rem;
}

.tree-node {
    padding: 0.5rem 0;
}

.tree-node-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tree-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-light);
    padding: 0.2rem 0.5rem;
    transition: color 0.2s ease;
}

.tree-toggle:hover {
    color: var(--primary-color);
}

.tree-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.tree-link:hover {
    color: var(--primary-dark);
}

.login-container-inline {
    max-width: 500px;
    margin: 2rem auto;
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .navbar-menu {
        flex-wrap: wrap;
        gap: 0.8rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    .login-card {
        padding: 2rem 1.5rem;
    }
}
