/* ================================================
   Shirinzad E-Commerce Platform - HTML Documentation
   Modern Professional Styling with Dark Theme
   ================================================ */

/* ===== CSS Variables ===== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #0891b2;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --info-color: #0284c7;

    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --bg-code: #1e293b;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border-color: #cbd5e1;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Monaco, "Courier New", monospace;
}

/* ===== Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===== Layout ===== */
.container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow);
}

.main-content {
    flex: 1;
    padding: 2rem 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== Sidebar Navigation ===== */
.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-logo:hover {
    text-decoration: none;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.nav-menu {
    list-style: none;
}

.nav-menu li {
    margin-bottom: 0.5rem;
}

.nav-menu a {
    display: block;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.nav-menu a:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
    text-decoration: none;
    transform: translateX(4px);
}

.nav-menu a.active {
    background-color: var(--primary-color);
    color: white;
}

/* ===== Header ===== */
.page-header {
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.page-title {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

/* ===== Breadcrumbs ===== */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.breadcrumbs a {
    color: var(--text-muted);
}

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

.breadcrumbs-separator {
    color: var(--text-muted);
}

/* ===== Cards & Sections ===== */
.card {
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.section {
    margin-bottom: 3rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
}

/* ===== Code Blocks ===== */
pre {
    background-color: var(--bg-code);
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin: 1.5rem 0;
    position: relative;
    font-size: 0.875rem;
    line-height: 1.7;
}

code {
    font-family: var(--font-mono);
}

pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    color: inherit;
}

:not(pre) > code {
    background-color: var(--bg-tertiary);
    color: var(--danger-color);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.875em;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #334155;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    margin-bottom: -0.5rem;
}

.code-language {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.copy-button {
    background-color: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.copy-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: white;
}

/* ===== Tables ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

thead {
    background-color: var(--primary-color);
    color: white;
}

thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

tbody tr:nth-child(even) {
    background-color: var(--bg-secondary);
}

tbody tr:hover {
    background-color: #e0f2fe;
}

tbody td {
    padding: 1rem;
    color: var(--text-secondary);
}

/* ===== Badges & Status ===== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background-color: #d1fae5;
    color: var(--success-color);
}

.badge-warning {
    background-color: #fed7aa;
    color: var(--warning-color);
}

.badge-danger {
    background-color: #fecaca;
    color: var(--danger-color);
}

.badge-info {
    background-color: #dbeafe;
    color: var(--info-color);
}

.badge-primary {
    background-color: #dbeafe;
    color: var(--primary-color);
}

/* ===== Lists ===== */
ul, ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

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

ul.checklist li::before {
    content: '✓';
    display: inline-block;
    width: 1.5rem;
    color: var(--success-color);
    font-weight: 700;
}

/* ===== Alerts & Callouts ===== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    margin: 1.5rem 0;
    border-left: 4px solid;
}

.alert-info {
    background-color: #dbeafe;
    border-color: var(--info-color);
    color: #0c4a6e;
}

.alert-success {
    background-color: #d1fae5;
    border-color: var(--success-color);
    color: #064e3b;
}

.alert-warning {
    background-color: #fed7aa;
    border-color: var(--warning-color);
    color: #78350f;
}

.alert-danger {
    background-color: #fecaca;
    border-color: var(--danger-color);
    color: #7f1d1d;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
}

/* ===== Search Box ===== */
.search-container {
    margin-bottom: 2rem;
}

.search-box {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.search-box:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ===== Collapsible Sections ===== */
.collapsible {
    cursor: pointer;
    padding: 1rem 1.5rem;
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s ease;
}

.collapsible:hover {
    background-color: var(--bg-tertiary);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible-content.active {
    max-height: 5000px;
}

.collapsible-icon {
    transition: transform 0.3s ease;
}

.collapsible.active .collapsible-icon {
    transform: rotate(180deg);
}

/* ===== Grid System ===== */
.grid {
    display: grid;
    gap: 2rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ===== Stat Cards ===== */
.stat-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

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

/* ===== Mermaid Diagrams ===== */
.mermaid {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin: 2rem 0;
    text-align: center;
}

/* ===== Back to Top Button ===== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--primary-dark);
    transform: translateY(-4px);
}

/* ===== Table of Contents ===== */
.toc {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.toc-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.toc ul {
    list-style: none;
    padding-left: 1rem;
}

.toc a {
    color: var(--text-secondary);
}

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

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 250px;
    }

    .main-content {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .main-content {
        padding: 1.5rem;
    }

    .page-title {
        font-size: 2rem;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
}

/* ===== Print Styles ===== */
@media print {
    .sidebar,
    .back-to-top,
    .search-container,
    .copy-button {
        display: none !important;
    }

    .main-content {
        max-width: 100%;
        padding: 0;
    }

    .card,
    table {
        box-shadow: none;
        page-break-inside: avoid;
    }

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

    pre {
        border: 1px solid var(--border-color);
    }
}

/* ===== Custom Utilities ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }

/* ===== Loading Spinner ===== */
.spinner {
    border: 3px solid var(--bg-tertiary);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* ===== Syntax Highlighting (Prism.js compatible) ===== */
.token.comment { color: #6a9955; }
.token.keyword { color: #569cd6; }
.token.string { color: #ce9178; }
.token.number { color: #b5cea8; }
.token.function { color: #dcdcaa; }
.token.operator { color: #d4d4d4; }
.token.property { color: #9cdcfe; }
.token.punctuation { color: #d4d4d4; }
