/* Global Styles */
:root {
    --primary-color: #1976d2;
    --secondary-color: #424242;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --info-color: #2196f3;

    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-dark: #1a1a1a;

    --text-primary: #212121;
    --text-secondary: #757575;
    --text-light: #ffffff;

    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);

    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    --border-radius: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-light);
    padding: var(--spacing-md) 0;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.logo p {
    font-size: 0.875rem;
    opacity: 0.9;
}

.logo a {
    color: inherit;
    text-decoration: none;
}

.main-nav {
    display: flex;
    gap: var(--spacing-md);
}

.main-nav a {
    color: var(--text-light);
    text-decoration: none;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-light);
    padding: var(--spacing-xl) 0;
    text-align: center;
}

.hero-title {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
    font-weight: 700;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-lg);
    opacity: 0.95;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xl);
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Quick Start Section */
.quick-start {
    padding: var(--spacing-xl) 0;
    background-color: var(--bg-primary);
}

.quick-start h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: var(--spacing-lg);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

.card {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-blue { border-left: 4px solid #2196f3; }
.card-green { border-left: 4px solid #4caf50; }
.card-purple { border-left: 4px solid #9c27b0; }
.card-orange { border-left: 4px solid #ff9800; }

.card-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
}

.card h3 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-xs);
}

.card p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    flex-grow: 1;
}

.card-button {
    color: var(--primary-color);
    font-weight: 600;
    display: inline-block;
    margin-top: auto;
}

/* Documentation Section */
.documentation {
    padding: var(--spacing-xl) 0;
    background-color: var(--bg-secondary);
}

.documentation h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: var(--spacing-lg);
}

.doc-category {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow);
}

.doc-category h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--border-color);
}

.doc-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.doc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    gap: var(--spacing-md);
}

.doc-info {
    flex: 1;
}

.doc-item h4 {
    font-size: 1.125rem;
    margin-bottom: var(--spacing-xs);
}

.doc-item p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.doc-meta {
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

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

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background-color: #1565c0;
}

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

.btn-secondary:hover {
    background-color: #303030;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Features Section */
.features {
    padding: var(--spacing-xl) 0;
    background-color: var(--bg-primary);
}

.features h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: var(--spacing-lg);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
}

.feature {
    text-align: center;
    padding: var(--spacing-lg);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
}

.feature h3 {
    font-size: 1.125rem;
    margin-bottom: var(--spacing-xs);
}

.feature p {
    color: var(--text-secondary);
}

/* Roles Section */
.roles {
    padding: var(--spacing-xl) 0;
    background-color: var(--bg-secondary);
}

.roles h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: var(--spacing-lg);
}

.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

.role-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow);
}

.role-card h3 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--border-color);
}

.role-card ul {
    list-style: none;
    margin-bottom: var(--spacing-md);
}

.role-card li {
    padding: var(--spacing-xs) 0;
    color: var(--text-secondary);
}

.role-card li::before {
    content: "✓ ";
    color: var(--success-color);
    font-weight: bold;
    margin-right: var(--spacing-xs);
}

/* Footer */
.footer {
    background-color: var(--bg-dark);
    color: var(--text-light);
    padding: var(--spacing-xl) 0 var(--spacing-md);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.footer-section h4 {
    margin-bottom: var(--spacing-sm);
}

.footer-section p,
.footer-section a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    display: block;
    margin-bottom: var(--spacing-xs);
}

.footer-section a:hover {
    color: var(--text-light);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

/* Viewer Layout */
.viewer-container {
    display: flex;
    min-height: calc(100vh - 80px);
}

.sidebar {
    width: 280px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 80px;
    height: calc(100vh - 80px);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-nav {
    padding: var(--spacing-md);
}

.nav-section {
    margin-bottom: var(--spacing-lg);
}

.nav-section h4 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: var(--spacing-sm);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: var(--transition);
    margin-bottom: 0.25rem;
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--bg-secondary);
}

.nav-icon {
    font-size: 1.125rem;
}

.viewer-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 80px;
    z-index: 100;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.doc-selector {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    font-size: 0.875rem;
}

.document-content {
    flex: 1;
    padding: var(--spacing-lg);
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Markdown Styles */
.markdown-body {
    font-size: 1rem;
    line-height: 1.7;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
    line-height: 1.3;
}

.markdown-body h1 { font-size: 2.5rem; }
.markdown-body h2 { font-size: 2rem; border-bottom: 2px solid var(--border-color); padding-bottom: var(--spacing-xs); }
.markdown-body h3 { font-size: 1.5rem; }
.markdown-body h4 { font-size: 1.25rem; }

.markdown-body p {
    margin-bottom: var(--spacing-sm);
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: var(--spacing-sm);
    padding-left: var(--spacing-lg);
}

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

.markdown-body code {
    background-color: var(--bg-secondary);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-body pre {
    background-color: var(--bg-dark);
    color: var(--text-light);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin-bottom: var(--spacing-md);
}

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

.markdown-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: var(--spacing-md);
    margin: var(--spacing-md) 0;
    color: var(--text-secondary);
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-md);
}

.markdown-body th,
.markdown-body td {
    border: 1px solid var(--border-color);
    padding: var(--spacing-xs) var(--spacing-sm);
    text-align: left;
}

.markdown-body th {
    background-color: var(--bg-secondary);
    font-weight: 600;
}

.markdown-body a {
    color: var(--primary-color);
    text-decoration: none;
}

.markdown-body a:hover {
    text-decoration: underline;
}

.markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    margin: var(--spacing-md) 0;
}

/* Table of Contents */
.toc {
    position: fixed;
    right: var(--spacing-md);
    top: 200px;
    width: 250px;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    box-shadow: var(--shadow);
}

.toc h4 {
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
}

#toc-content {
    font-size: 0.875rem;
}

#toc-content a {
    display: block;
    padding: 0.25rem 0;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

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

/* Loading & Error States */
.loading {
    text-align: center;
    padding: var(--spacing-xl);
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-md);
}

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

.error {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--error-color);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .toc {
        display: none;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        transition: left 0.3s ease;
        z-index: 1001;
    }

    .sidebar.active {
        left: 0;
    }

    .main-nav {
        flex-direction: column;
        gap: var(--spacing-xs);
    }

    .header-content {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .cards-grid,
    .features-grid,
    .roles-grid {
        grid-template-columns: 1fr;
    }

    .doc-item {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.5rem;
    }

    .hero-stats {
        flex-direction: column;
        gap: var(--spacing-md);
    }
}

/* Print Styles */
@media print {
    .header,
    .sidebar,
    .viewer-toolbar,
    .toc,
    .footer {
        display: none;
    }

    .viewer-main {
        max-width: 100%;
    }

    .markdown-body {
        max-width: 100%;
    }
}
