﻿/* Modern User Guide Styles */
:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --text-color: #413f3f;
    --text-muted: #6c757d;
    --sidebar-width: 500px;
    --header-height: 60px;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

* {
    box-sizing: border-box;
}

.user-guide-app {
    display: flex;
    min-height: 100vh;
    background: #f5f6fa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
}

    .sidebar-header h2 {
        margin: 0;
        font-size: 1.2rem;
        font-weight: 600;
    }

    .sidebar-header i {
        margin-right: 0.5rem;
    }

.search-section {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    position: relative;
}

    .search-box i {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-muted);
    }

    .search-box input {
        width: 100%;
        padding: 0.75rem 0.75rem 0.75rem 2.5rem;
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
        font-size: 0.9rem;
        transition: border-color 0.3s, box-shadow 0.3s;
    }

        .search-box input:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
        }

.admin-controls {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    flex-direction: column;
}

.btn-add {
    padding: 0.75rem 1rem;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .btn-add:hover {
        background: #218838;
        transform: translateY(-1px);
    }

    .btn-add i {
        margin-right: 0.5rem;
    }

.categories-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.category-item {
    margin-bottom: 0.5rem;
}

.category-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    border-left: 3px solid transparent;
}

    .category-header:hover {
        background: var(--light-color);
    }

    .category-header.active {
        background: #e3f2fd;
        border-left-color: var(--primary-color);
    }

.category-icon {
    margin-right: 0.75rem;
    color: var(--primary-color);
    min-width: 16px;
}

.category-name {
    flex: 1;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1.3rem;
}

.category-count {
    background: var(--text-muted);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.category-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.category-header:hover .category-actions {
    opacity: 1;
}

.action-btn {
    padding: 0.25rem 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: background-color 0.3s, color 0.3s;
}

    .action-btn:hover.edit-btn {
        background: var(--info-color);
        color: white;
    }

    .action-btn:hover.delete-btn {
        background: var(--danger-color);
        color: white;
    }

.articles-list {
    padding-left: 2rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

    .articles-list.expanded {
        max-height: 500px;
    }

.article-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    cursor: pointer;
    transition: color 0.3s;
}

    .article-item:hover {
        color: var(--primary-color);
    }

    .article-item.active {
        color: var(--primary-color);
        font-weight: 500;
    }

.article-icon {
    margin-right: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.article-title {
    flex: 1;
    font-size: 1.2rem;
}

.featured-badge {
    color: var(--warning-color);
    margin-left: 0.5rem;
    font-size: 0.8rem;
}

.article-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.article-item:hover .article-actions {
    opacity: 1;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    margin: 1rem;
    margin-left: 0;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.content-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: white;
}

.breadcrumb {
    font-size: 0.9rem;
    color: var(--text-muted);
}

    .breadcrumb span {
        margin-right: 0.5rem;
    }

    .breadcrumb .separator {
        margin: 0 0.5rem;
        color: var(--text-muted);
    }

.content-body {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.welcome-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

    .welcome-content h1 {
        font-size: 2.5rem;
        margin-bottom: 1rem;
        color: var(--text-color);
        font-weight: 300;
    }

    .welcome-content p {
        font-size: 1.1rem;
        color: var(--text-muted);
        margin-bottom: 3rem;
        line-height: 1.6;
    }

.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.stat-card {
    display: flex;
    align-items: center;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

    .stat-card:hover {
        transform: translateY(-5px);
    }

    .stat-card i {
        font-size: 3rem;
        margin-right: 1.5rem;
        opacity: 0.8;
    }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1.1rem;
    opacity: 0.9;
}

.article-content {
    line-height: 1.7;
    font-size: 1.1rem;
    color: var(--text-color);
    padding: 15px;
    border: solid 1px #dbd2d2;
    margin-top: 15px;
}

    .article-content h1,
    .article-content h2,
    .article-content h3,
    .article-content h4,
    .article-content h5,
    .article-content h6 {
        margin-top: 2rem;
        margin-bottom: 1rem;
        color: var(--dark-color);
    }

    .article-content h1 {
        font-size: 2.5rem;
        border-bottom: 2px solid var(--primary-color);
        padding-bottom: 0.5rem;
    }

    .article-content h2 {
        font-size: 2rem;
    }

    .article-content p {
        margin-bottom: 1.5rem;
    }

    .article-content img {
        max-width: 100%;
        height: auto;
        border-radius: var(--border-radius);
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        margin: 2rem 0;
    }

    .article-content blockquote {
        padding: 1.5rem;
        margin: 2rem 0;
        border-left: 4px solid var(--primary-color);
        background: #f8f9fa;
        border-radius: 0 var(--border-radius) var(--border-radius) 0;
        font-style: italic;
    }

    .article-content code {
        background: #f1f3f4;
        padding: 0.2rem 0.4rem;
        border-radius: 4px;
        font-size: 0.9rem;
        color: #c7254e;
    }

    .article-content pre {
        background: #2d3748;
        color: #e2e8f0;
        padding: 1.5rem;
        border-radius: var(--border-radius);
        overflow-x: auto;
        margin: 2rem 0;
        position: relative;
    }

        .article-content pre code {
            background: transparent;
            color: inherit;
            padding: 0;
        }

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    backdrop-filter: blur(3px);
}

    .modal-overlay.show {
        display: flex;
        align-items: center;
        justify-content: center;
        animation: fadeIn 0.3s ease;
    }

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

    .modal-content.modal-large {
        max-width: 800px;
    }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

    .modal-header h3 {
        margin: 0;
        font-size: 1.3rem;
        color: var(--text-color);
    }

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s, color 0.3s;
}

    .modal-close:hover {
        background: var(--light-color);
        color: var(--text-color);
    }

.modal-body {
    padding: 1.5rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.form-group.flex-2 {
    flex: 2;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.required {
    color: var(--danger-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

    .form-group input:focus,
    .form-group textarea:focus,
    .form-group select:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
    }

.checkbox-label {
    display: flex !important;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0 !important;
}

    .checkbox-label input[type="checkbox"] {
        width: auto !important;
        margin-right: 0.5rem;
    }

.checkmark {
    margin-left: 0.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

    .btn-primary:hover {
        background: var(--primary-hover);
        transform: translateY(-1px);
    }

.btn-secondary {
    background: var(--text-muted);
    color: white;
}

    .btn-secondary:hover {
        background: #545b62;
    }

.btn-danger {
    background: var(--danger-color);
    color: white;
}

    .btn-danger:hover {
        background: #c82333;
    }

/* CKEditor Custom Styles */
.ck-editor__editable {
    min-height: 300px !important;
}

.ck-editor {
    margin-top: 0.5rem;
}

/* Loading and Error States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
}

.error {
    color: var(--danger-color);
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

.success {
    color: var(--success-color);
    background: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Search Results */
.search-results {
    margin-top: 2rem;
}

    .search-results h2 {
        color: var(--text-color);
        margin-bottom: 1rem;
    }

.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

    .no-results i {
        font-size: 4rem;
        margin-bottom: 1rem;
        opacity: 0.5;
    }

.no-articles {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

    .no-articles a {
        color: var(--primary-color);
        text-decoration: none;
    }

        .no-articles a:hover {
            text-decoration: underline;
        }

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.article-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

    .article-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        border-color: var(--primary-color);
    }

    .article-card h3 {
        margin: 0 0 1rem 0;
        color: var(--text-color);
        font-size: 1.1rem;
        line-height: 1.4;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .article-card p {
        color: var(--text-muted);
        margin: 0 0 1rem 0;
        line-height: 1.5;
        font-size: 0.95rem;
    }

    .article-card .article-meta {
        display: flex;
        gap: 1rem;
        font-size: 0.85rem;
        color: var(--text-muted);
    }

.category-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
    gap: 0.5rem;
}

    .loading i {
        animation: spin 1s linear infinite;
    }

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .user-guide-app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
    }

    .main-content {
        margin: 0;
        border-radius: 0;
    }

    .form-row {
        flex-direction: column;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .welcome-content h1 {
        font-size: 2rem;
    }

    .quick-stats {
        grid-template-columns: 1fr;
    }
}

/* Dark mode support (optional) */
/*@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #413f3f;
        --text-muted: #adb5bd;
        --border-color: #495057;
        --light-color: #343a40;
    }
}*/
