/* ========================================================================
   PERSIAN DOCUMENTATION SYSTEM - PROFESSIONAL DESIGN
   ======================================================================== */

/* ========================================================================
   1. CSS VARIABLES - COLOR PALETTE & DESIGN TOKENS
   ======================================================================== */

:root {
    /* Primary Brand Colors - Inspired by Persian Art */
    --primary-50: #f0f9ff;
    --primary-100: #e0f2fe;
    --primary-200: #bae6fd;
    --primary-300: #7dd3fc;
    --primary-400: #38bdf8;
    --primary-500: #0ea5e9;
    --primary-600: #0284c7;
    --primary-700: #0369a1;
    --primary-800: #075985;
    --primary-900: #0c4a6e;

    /* Neutral Palette - Warm Grays */
    --neutral-50: #fafaf9;
    --neutral-100: #f5f5f4;
    --neutral-200: #e7e5e4;
    --neutral-300: #d6d3d1;
    --neutral-400: #a8a29e;
    --neutral-500: #78716c;
    --neutral-600: #57534e;
    --neutral-700: #44403c;
    --neutral-800: #292524;
    --neutral-900: #1c1917;

    /* Accent Colors */
    --accent-purple: #8b5cf6;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;

    /* Semantic Colors */
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #fafaf9;
    --bg-tertiary: #f5f5f4;
    --bg-code: #1e1e1e;
    --bg-sidebar: linear-gradient(180deg, #fafaf9 0%, #f5f5f4 100%);
    --bg-card: #ffffff;

    /* Borders */
    --border-color: #e7e5e4;
    --border-color-dark: #d6d3d1;
    --border-radius-sm: 6px;
    --border-radius-md: 10px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.15);

    /* Typography */
    --font-display: 'Vazirmatn', system-ui, -apple-system, sans-serif;
    --font-body: 'Vazirmatn', system-ui, -apple-system, sans-serif;
    --font-mono: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Monaco', 'Courier New', monospace;

    /* Spacing */
    --spacing-unit: 8px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --topbar-height: 64px;
    --sidebar-width: 320px;
}

/* ========================================================================
   2. GLOBAL RESET & BASE STYLES
   ======================================================================== */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body.docs-body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    color: var(--neutral-800);
    background: var(--bg-secondary);
    overflow-x: hidden;
}

/* Selection Styling */
::selection {
    background: var(--primary-200);
    color: var(--primary-900);
}

::-moz-selection {
    background: var(--primary-200);
    color: var(--primary-900);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--neutral-100);
}

::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: 5px;
    transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-400);
}

/* ========================================================================
   3. TOPBAR HEADER
   ======================================================================== */

.docs-topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-primary) !important;
    border-bottom: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95) !important;
}

.docs-topbar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--primary-400) 50%,
        transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.docs-topbar:hover::after {
    opacity: 1;
}

.docs-topbar a {
    color: var(--neutral-900);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    transition: all var(--transition-base);
    position: relative;
}

.docs-topbar a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-500);
    transition: width var(--transition-spring);
}

.docs-topbar a:hover {
    color: var(--primary-600);
}

.docs-topbar a:hover::after {
    width: 100%;
}

.docs-topbar .btn {
    font-weight: 600;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-base);
    padding: 0.5rem 1.25rem;
}

.docs-topbar .btn-outline-secondary {
    border: 2px solid var(--neutral-300);
    color: var(--neutral-700);
    background: transparent;
}

.docs-topbar .btn-outline-secondary:hover {
    background: var(--neutral-800);
    border-color: var(--neutral-800);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.docs-topbar .btn-outline-primary {
    border: 2px solid var(--primary-500);
    color: var(--primary-600);
    background: var(--primary-50);
}

.docs-topbar .btn-outline-primary:hover {
    background: var(--primary-600);
    border-color: var(--primary-600);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

/* ========================================================================
   4. SIDEBAR - NAVIGATION
   ======================================================================== */

.docs-sidebar {
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    height: calc(100vh - var(--topbar-height));
    position: sticky;
    top: var(--topbar-height);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Search Input */
.docs-search {
    position: relative;
    margin-bottom: 1.5rem;
}

.docs-search input {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: var(--bg-primary);
    font-size: 0.95rem;
    font-family: var(--font-body);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xs);
}

.docs-search input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1), var(--shadow-sm);
    background: white;
}

.docs-search input::placeholder {
    color: var(--neutral-400);
}

.docs-search::before {
    content: '🔍';
    position: absolute;
    left: 1rem;
    top: 35%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    opacity: 0.5;
    pointer-events: none;
}

.docs-search small {
    font-size: 0.8rem;
    color: var(--neutral-500);
    line-height: 1.4;
}

/* Navigation Structure */
.docs-nav {
    margin-top: 1.5rem;
}

.docs-nav-group {
    margin-bottom: 2rem;
}

.docs-nav-group .group-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--neutral-500);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.docs-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.docs-nav-item {
    position: relative;
    margin-bottom: 0.25rem;
}

.docs-nav-item a {
    display: block;
    padding: 0.65rem 1rem;
    color: var(--neutral-700);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.docs-nav-item a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-500);
    transform: scaleY(0);
    transition: transform var(--transition-base);
}

.docs-nav-item a:hover {
    background: var(--neutral-100);
    color: var(--neutral-900);
    padding-right: 1.5rem;
}

.docs-nav-item a:hover::before {
    transform: scaleY(1);
}

.docs-nav-item a.active {
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
    color: var(--primary-700);
    font-weight: 700;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--primary-200);
}

.docs-nav-item a.active::before {
    transform: scaleY(1);
    background: var(--primary-600);
}

/* Child Navigation Items */
.docs-nav-item ul {
    margin-top: 0.5rem;
    padding-right: 1rem;
    border-right: 2px solid var(--border-color);
}

.docs-nav-item ul .docs-nav-item a {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    color: var(--neutral-600);
}

/* Alert in Sidebar */
.docs-sidebar .alert {
    border-radius: var(--border-radius-md);
    border: none;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: var(--primary-800);
    padding: 1rem;
    font-size: 0.95rem;
    box-shadow: var(--shadow-xs);
}

/* ========================================================================
   5. MAIN CONTENT AREA
   ======================================================================== */

.docs-content {
    background: var(--bg-secondary);
    min-height: calc(100vh - var(--topbar-height));
    padding: 2rem;
}

.docs-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.docs-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        var(--primary-500) 0%,
        var(--accent-purple) 50%,
        var(--accent-emerald) 100%);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.docs-card:hover::before {
    opacity: 1;
}

.docs-card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
}

/* ========================================================================
   6. BREADCRUMB
   ======================================================================== */

.docs-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--neutral-50);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.docs-breadcrumb a {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-fast);
    position: relative;
}

.docs-breadcrumb a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--primary-600);
    transition: width var(--transition-base);
}

.docs-breadcrumb a:hover {
    color: var(--primary-700);
}

.docs-breadcrumb a:hover::after {
    width: 100%;
}

.docs-breadcrumb .text-muted {
    color: var(--neutral-400);
}

/* ========================================================================
   7. TYPOGRAPHY - HEADINGS & TEXT
   ======================================================================== */

.docs-card h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--neutral-900);
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
    position: relative;
    display: inline-block;
}

.docs-card h1::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-500), var(--accent-purple));
    border-radius: 2px;
}

.docs-card h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--neutral-800);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.docs-card h2::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 80px;
    height: 2px;
    background: var(--primary-500);
}

.docs-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--neutral-800);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.docs-card h4 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--neutral-700);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.docs-card p {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: var(--neutral-700);
}

/* Meta Information */
.text-muted {
    color: var(--neutral-500) !important;
}

.docs-card code {
    background: var(--neutral-100);
    color: var(--primary-700);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    font-weight: 600;
    border: 1px solid var(--border-color);
}

/* ========================================================================
   8. ARTICLE CONTENT STYLING
   ======================================================================== */

.docs-article {
    margin-top: 2rem;
    font-size: 1.05rem;
    line-height: 1.8;
}

.docs-article h2:first-child {
    margin-top: 0;
}

.docs-article ul,
.docs-article ol {
    margin: 1.5rem 0;
    padding-right: 2rem;
}

.docs-article li {
    margin-bottom: 0.75rem;
    line-height: 1.7;
    position: relative;
}

.docs-article ul li::marker {
    color: var(--primary-500);
    font-size: 1.2em;
}

.docs-article ol li::marker {
    color: var(--primary-600);
    font-weight: 700;
}

.docs-article pre {
    background: var(--bg-code);
    color: #d4d4d4;
    padding: 1.5rem;
    border-radius: var(--border-radius-md);
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--neutral-800);
    box-shadow: var(--shadow-lg);
}

.docs-article pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border: none;
    font-size: 0.95rem;
    line-height: 1.6;
}

.docs-article blockquote {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    border-right: 4px solid var(--primary-500);
    background: linear-gradient(90deg, var(--primary-50) 0%, transparent 100%);
    border-radius: var(--border-radius-sm);
    font-style: italic;
    color: var(--neutral-700);
}

.docs-article table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.docs-article th {
    background: var(--neutral-800);
    color: white;
    padding: 1rem;
    text-align: right;
    font-weight: 700;
}

.docs-article td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.docs-article tr:last-child td {
    border-bottom: none;
}

.docs-article tr:nth-child(even) {
    background: var(--neutral-50);
}

/* Alert Boxes */
.docs-article .alert {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    border-radius: var(--border-radius-md);
    border: none;
    box-shadow: var(--shadow-sm);
}

.docs-article .alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: var(--primary-800);
    border-right: 4px solid var(--primary-500);
}

.docs-article .alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border-right: 4px solid var(--warning);
}

.docs-article .alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-right: 4px solid var(--success);
}

.docs-article .alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border-right: 4px solid var(--danger);
}

/* ========================================================================
   9. NAVIGATION BUTTONS (PREV/NEXT)
   ======================================================================== */

.docs-prev-next {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.docs-prev-next .btn {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-spring);
    border: 2px solid;
    position: relative;
    overflow: hidden;
}

.docs-prev-next .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width var(--transition-spring), height var(--transition-spring);
}

.docs-prev-next .btn:hover::before {
    width: 300px;
    height: 300px;
}

.docs-prev-next .btn-outline-secondary {
    border-color: var(--neutral-300);
    color: var(--neutral-700);
    background: transparent;
}

.docs-prev-next .btn-outline-secondary:hover {
    background: var(--neutral-800);
    border-color: var(--neutral-800);
    color: white;
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.docs-prev-next .btn-outline-primary {
    border-color: var(--primary-500);
    color: var(--primary-600);
    background: var(--primary-50);
}

.docs-prev-next .btn-outline-primary:hover {
    background: var(--primary-600);
    border-color: var(--primary-600);
    color: white;
    transform: translateX(-5px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

/* ========================================================================
   10. MOBILE OFFCANVAS SIDEBAR
   ======================================================================== */

.offcanvas {
    background: var(--bg-sidebar);
}

.offcanvas-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.offcanvas-title {
    font-weight: 700;
    color: var(--neutral-900);
    font-size: 1.25rem;
}

.offcanvas-body {
    padding: 1.5rem;
}

/* ========================================================================
   11. RESPONSIVE DESIGN
   ======================================================================== */

@media (max-width: 991px) {
    .docs-content {
        padding: 1.5rem;
    }

    .docs-card {
        padding: 1.5rem !important;
    }

    .docs-card h1 {
        font-size: 2rem;
    }

    .docs-card h2 {
        font-size: 1.5rem;
    }

    .docs-prev-next {
        flex-direction: column;
        align-items: stretch;
    }

    .docs-prev-next > div {
        width: 100%;
        text-align: center !important;
    }

    .docs-prev-next .btn {
        width: 100%;
    }
}

@media (max-width: 575px) {
    html {
        font-size: 14px;
    }

    .docs-topbar a {
        font-size: 1.1rem;
    }

    .docs-card h1 {
        font-size: 1.75rem;
    }

    .docs-content {
        padding: 1rem;
    }

    .docs-breadcrumb {
        font-size: 0.8rem;
    }
}

/* ========================================================================
   12. ANIMATIONS & MICRO-INTERACTIONS
   ======================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.docs-card {
    animation: fadeIn 0.4s ease-out;
}

.docs-nav-item {
    animation: slideInRight 0.3s ease-out;
    animation-fill-mode: both;
}

.docs-nav-item:nth-child(1) { animation-delay: 0.05s; }
.docs-nav-item:nth-child(2) { animation-delay: 0.1s; }
.docs-nav-item:nth-child(3) { animation-delay: 0.15s; }
.docs-nav-item:nth-child(4) { animation-delay: 0.2s; }
.docs-nav-item:nth-child(5) { animation-delay: 0.25s; }
.docs-nav-item:nth-child(6) { animation-delay: 0.3s; }

/* ========================================================================
   13. PRINT STYLES
   ======================================================================== */

@media print {
    .docs-topbar,
    .docs-sidebar,
    .docs-prev-next,
    .btn {
        display: none !important;
    }

    .docs-content {
        padding: 0;
    }

    .docs-card {
        box-shadow: none;
        border: none;
    }

    body {
        background: white;
    }
}

/* ========================================================================
   14. ACCESSIBILITY ENHANCEMENTS
   ======================================================================== */

.docs-nav-item a:focus-visible,
.docs-prev-next .btn:focus-visible,
.docs-topbar a:focus-visible {
    outline: 3px solid var(--primary-500);
    outline-offset: 2px;
}

.docs-search input:focus-visible {
    outline: 3px solid var(--primary-500);
    outline-offset: 2px;
}

/* Reduce Motion for Users with Accessibility Needs */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================================================
   15. EMPTY STATE STYLING
   ======================================================================== */

.docs-card h4 {
    color: var(--neutral-800);
    font-weight: 700;
}

.docs-card p.text-muted {
    font-size: 1rem;
    line-height: 1.6;
}

/* ========================================================================
   16. DARK MODE SUPPORT (Optional - Ready for Future)
   ======================================================================== */

@media (prefers-color-scheme: dark) {
    /* Uncomment to enable auto dark mode
    :root {
        --bg-primary: #1c1917;
        --bg-secondary: #292524;
        --bg-card: #292524;
        --neutral-800: #e7e5e4;
        --neutral-700: #d6d3d1;
        --border-color: #44403c;
    }
    */
}

/* ========================================================================
   END OF STYLESHEET
   ======================================================================== */
