/* sartUP Wiki System - Custom CSS */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    
    --sidebar-width: 250px;
    --header-height: 60px;
    --footer-height: 80px;
}

/* Layout Base */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f8f9fa;
    scroll-behavior: smooth;
}

/* Smooth transitions */
* {
    transition: all 0.2s ease-in-out;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Hover effects */
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.btn:hover {
    transform: translateY(-1px);
}

/* Focus states */
.btn:focus,
.form-control:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Search suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.suggestion-item:hover {
    background-color: #f8f9fa;
}

.suggestion-item:last-child {
    border-bottom: none;
}

/* Loading spinner */
.loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Improved breadcrumbs */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    color: #6c757d;
    margin-right: 0.5rem;
}

/* Document improvements */
.document-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.document-title {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.document-description {
    color: var(--secondary-color);
    font-size: 1.1rem;
}

/* Table of contents */
.toc {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 2rem;
}

.toc h6 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.toc ul {
    margin: 0;
    padding-left: 1rem;
}

.toc li {
    margin-bottom: 0.25rem;
}

.toc a {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

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

/* TOC Sidebar */
.toc-sidebar {
    position: sticky;
    top: 2rem;
    height: fit-content;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.toc-sidebar-content {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.toc-section {
    margin-bottom: 1.5rem;
}

.toc-section h6 {
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toc-item {
    margin-bottom: 0.25rem;
}

.toc-link {
    display: block;
    padding: 0.25rem 0.5rem;
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.toc-link:hover {
    color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.1);
}

.toc-level-1 {
    font-weight: 600;
    margin-left: 0;
}

.toc-level-2 {
    margin-left: 1rem;
    font-size: 0.8rem;
}

.toc-level-3 {
    margin-left: 2rem;
    font-size: 0.75rem;
    color: #6c757d;
}

.toc-level-4 {
    margin-left: 3rem;
    font-size: 0.7rem;
    color: #6c757d;
}

/* Quick Info */
.quick-info {
    margin-bottom: 1.5rem;
}

.quick-info h6 {
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--secondary-color);
    padding: 0.25rem 0;
}

.info-item i {
    width: 16px;
    text-align: center;
    color: var(--primary-color);
}

/* Related Documents */
.related-docs {
    margin-bottom: 1rem;
}

.related-docs h6 {
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.related-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.related-item {
    margin-bottom: 0.25rem;
}

.related-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.8rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.related-link:hover {
    color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.1);
}

.related-link i {
    width: 16px;
    text-align: center;
    color: var(--primary-color);
}

/* Document Actions */
.document-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.document-actions .btn {
    font-size: 0.85rem;
    padding: 0.375rem 0.75rem;
}

/* Improved Document Layout */
.main-content {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-bottom: 2rem;
}

.document-content {
    line-height: 1.7;
    font-size: 1rem;
}

.document-content h1,
.document-content h2,
.document-content h3,
.document-content h4,
.document-content h5,
.document-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-weight: 600;
}

.document-content h1 {
    font-size: 2rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.document-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.25rem;
}

.document-content h3 {
    font-size: 1.25rem;
    color: var(--secondary-color);
}

.document-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

.document-content ul,
.document-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.document-content li {
    margin-bottom: 0.5rem;
}

.document-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: var(--secondary-color);
}

.document-content code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.9em;
    color: #e83e8c;
}

.document-content pre {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.document-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Code blocks with copy button */
.code-block {
    position: relative;
    margin: 1rem 0;
}

.code-block pre {
    margin: 0;
    border-radius: 0.375rem 0.375rem 0 0;
}

.code-block .copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.code-block .copy-btn:hover {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    min-width: 300px;
}

.toast-notification.show {
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-success .toast-content i {
    color: var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--danger-color);
}

.toast-error .toast-content i {
    color: var(--danger-color);
}

.toast-info {
    border-left: 4px solid var(--info-color);
}

.toast-info .toast-content i {
    color: var(--info-color);
}

/* Active TOC link */
.toc-link.active {
    background-color: var(--primary-color);
    color: white !important;
    font-weight: 600;
}

/* ASCII Art Styling */
.ascii-art-container {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    overflow-x: auto;
    position: relative;
}

.ascii-art-container::before {
    content: "📊 Diagramma Architetturale";
    position: absolute;
    top: -0.75rem;
    left: 1rem;
    background: white;
    padding: 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
}

.ascii-art {
    font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.2;
    margin: 0;
    padding: 0;
    white-space: pre;
    color: #2c3e50;
    background: transparent;
    border: none;
    overflow-x: auto;
}

/* Miglioramenti per caratteri box drawing */
.ascii-art {
    font-feature-settings: "liga" 1;
    text-rendering: optimizeLegibility;
}

/* Evidenziazione sezioni nell'ASCII art */
.ascii-art-container .ascii-art {
    position: relative;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .toc-sidebar {
        position: static;
        margin-top: 2rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .document-actions {
        flex-direction: column;
    }
    
    .document-actions .btn {
        width: 100%;
    }
    
    .toast-notification {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        min-width: auto;
    }
    
    .ascii-art-container {
        margin: 1rem 0;
        padding: 1rem;
        font-size: 0.75rem;
    }
    
    .ascii-art {
        font-size: 0.7rem;
    }
}

/* Header */
.navbar-brand {
    font-weight: bold;
    font-size: 1.25rem;
}

.navbar-brand i {
    margin-right: 0.5rem;
}

/* Sidebar */
.sidebar {
    background-color: white;
    border-right: 1px solid #dee2e6;
    min-height: calc(100vh - var(--header-height));
    padding: 0;
    position: sticky;
    top: var(--header-height);
}

.sidebar-content {
    padding: 1rem;
}

.sidebar-title {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

/* Category List */
.category-list {
    margin-bottom: 2rem;
}

.category-item {
    margin-bottom: 0.5rem;
}

.category-link {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    text-decoration: none;
    color: var(--dark-color);
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.category-link:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
    text-decoration: none;
}

.category-icon {
    font-size: 1.2rem;
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
    color: var(--primary-color);
}

.category-icon i {
    display: inline-block;
    vertical-align: middle;
}

.category-name {
    flex: 1;
    font-weight: 500;
}

.category-count {
    background-color: var(--secondary-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Stats */
.stats {
    background-color: var(--light-color);
    padding: 1rem;
    border-radius: 0.375rem;
    margin-top: 1rem;
}

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

.stat-label {
    font-weight: 500;
    color: var(--secondary-color);
}

.stat-value {
    font-weight: bold;
    color: var(--primary-color);
}

/* Main Content */
.main-content {
    padding: 2rem;
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
}

.content-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-color);
}

.page-title {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.page-description {
    color: var(--secondary-color);
    font-size: 1.1rem;
    margin-bottom: 0;
}

/* Welcome Section */
.welcome-section {
    margin-bottom: 3rem;
}

.features ul {
    list-style: none;
    padding: 0;
}

.features li {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.features i {
    color: var(--success-color);
    margin-right: 0.75rem;
    width: 20px;
}

/* Category Cards */
.category-card {
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #dee2e6;
}

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

.category-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.category-icon-large {
    font-size: 2rem;
    margin-right: 1rem;
    color: var(--primary-color);
    text-align: center;
    display: block;
    margin-bottom: 1rem;
}

.category-icon-large i {
    display: inline-block;
    vertical-align: middle;
}

.category-title {
    margin: 0;
    color: var(--primary-color);
}

.category-description {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.category-meta {
    margin-bottom: 1rem;
}

/* Quick Actions */
.quick-actions-section {
    margin-bottom: 3rem;
}

.quick-action-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 1.5rem;
    background: white;
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
    text-align: center;
    height: 100%;
}

.quick-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
}

.quick-action-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.quick-action-card h6 {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.quick-action-card p {
    color: var(--secondary-color);
    margin: 0;
    font-size: 0.9rem;
}

/* Document Content */
.document-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-color);
}

.document-title {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 1rem;
}

.document-description {
    color: var(--secondary-color);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

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

.document-content {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.content-body {
    line-height: 1.8;
}

.content-body h1,
.content-body h2,
.content-body h3,
.content-body h4,
.content-body h5,
.content-body h6 {
    color: var(--primary-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.content-body h1 {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.content-body p {
    margin-bottom: 1rem;
}

.content-body ul,
.content-body ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.content-body li {
    margin-bottom: 0.5rem;
}

.content-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--secondary-color);
    font-style: italic;
}

.content-body table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.content-body th,
.content-body td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    text-align: left;
}

.content-body th {
    background-color: var(--light-color);
    font-weight: 600;
}

/* Code Blocks */
.content-body pre {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.content-body code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.content-body pre code {
    background: none;
    padding: 0;
}

/* Code Analysis */
.code-analysis-section {
    margin-bottom: 2rem;
}

.code-block-card {
    height: 100%;
}

.code-block-card .card-header {
    background-color: var(--light-color);
    border-bottom: 1px solid #dee2e6;
}

.code-block-card pre {
    max-height: 300px;
    overflow-y: auto;
    margin: 0;
}

.code-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

/* Screenshots */
.screenshots-section {
    margin-bottom: 2rem;
}

.screenshot-card {
    height: 100%;
}

.screenshot-image {
    cursor: pointer;
    border-radius: 0.375rem;
    transition: transform 0.2s ease;
}

.screenshot-image:hover {
    transform: scale(1.02);
}

.screenshot-caption {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--secondary-color);
    text-align: center;
}

/* App Integrations */
.app-integrations-section {
    margin-bottom: 2rem;
}

.integration-item {
    background: var(--light-color);
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.integration-item h6 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.integration-item ul {
    margin: 0;
    padding-left: 1.5rem;
}

.integration-item li {
    margin-bottom: 0.25rem;
}

/* Related Documents */
.related-documents-section {
    margin-bottom: 2rem;
}

.related-doc-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.related-doc-link {
    text-decoration: none;
    color: var(--dark-color);
    display: flex;
    align-items: center;
}

.related-doc-link:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.related-doc-link i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

/* Table of Contents */
.toc-section {
    margin-bottom: 2rem;
}

.toc {
    max-height: 400px;
    overflow-y: auto;
}

.toc-item {
    margin-bottom: 0.25rem;
}

.toc-item a {
    text-decoration: none;
    color: var(--dark-color);
    display: block;
    padding: 0.25rem 0;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.toc-item a:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
}

.toc-level-1 { padding-left: 0; }
.toc-level-2 { padding-left: 1rem; }
.toc-level-3 { padding-left: 2rem; }
.toc-level-4 { padding-left: 3rem; }
.toc-level-5 { padding-left: 4rem; }
.toc-level-6 { padding-left: 5rem; }

/* Document Info */
.document-info {
    background: var(--light-color);
    padding: 1rem;
    border-radius: 0.375rem;
    margin-top: 1rem;
}

.document-info h6 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.info-item {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.info-item strong {
    color: var(--dark-color);
}

.info-item code {
    background-color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
}

/* Footer */
.footer {
    background-color: var(--dark-color);
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer p {
    margin: 0;
}

/* Developer Mode */
.developer-mode .sidebar {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

.developer-mode .sidebar-title {
    color: #4CAF50;
}

.developer-mode .category-link {
    color: #e0e0e0;
}

.developer-mode .category-link:hover {
    background-color: #333;
    color: #4CAF50;
}

.developer-mode .main-content {
    background-color: #f5f5f5;
}

.developer-mode .document-content {
    background-color: white;
    border: 2px solid #4CAF50;
}

.developer-mode .code-block-card {
    border: 1px solid #4CAF50;
}

.developer-mode .code-block-card .card-header {
    background-color: #4CAF50;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: static;
        min-height: auto;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .document-actions {
        flex-direction: column;
    }
    
    .quick-action-card {
        margin-bottom: 1rem;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .navbar,
    .footer,
    .document-actions {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .document-content {
        box-shadow: none;
        border: none;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.document-content {
    animation: fadeIn 0.5s ease;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
