/* ============================================
   POLANGER DOCUMENTATION - MAIN STYLES
   ============================================ */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #0f172a;
    --accent: #22d3ee;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --sidebar-width: 280px;
    --header-height: 70px;
    --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-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px 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);
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--gray-700);
    background: var(--gray-50);
}

/* ============================================
   HEADER
   ============================================ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--secondary);
    font-weight: 700;
    font-size: 1.25rem;
}

.header-logo img {
    height: 36px;
    width: auto;
}

.header-logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
}

.header-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-search {
    position: relative;
    width: 280px;
}

.header-search input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    background: var(--gray-50);
    transition: var(--transition);
}

.header-search input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.header-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.header-version {
    padding: 6px 12px;
    background: var(--gray-100);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--gray-600);
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: white;
    border-right: 1px solid var(--gray-200);
    overflow-y: auto;
    padding: 24px 0;
    z-index: 900;
    transition: transform 0.3s ease;
}

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-section-title {
    padding: 8px 24px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav-item {
    position: relative;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav-link:hover {
    background: var(--gray-50);
    color: var(--primary);
}

.sidebar-nav-link.active {
    background: rgba(99, 102, 241, 0.05);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar-nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-nav-link .badge {
    margin-left: auto;
    padding: 2px 8px;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 10px;
}

.sidebar-subnav {
    list-style: none;
    display: none;
    padding-left: 54px;
}

.sidebar-nav-item.expanded .sidebar-subnav {
    display: block;
}

.sidebar-subnav-link {
    display: block;
    padding: 6px 24px 6px 0;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
}

.sidebar-subnav-link:hover,
.sidebar-subnav-link.active {
    color: var(--primary);
}

.sidebar-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--gray-400);
    transition: var(--transition);
}

.sidebar-nav-item.expanded .sidebar-toggle {
    transform: translateY(-50%) rotate(180deg);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

.content {
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 40px;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    color: var(--secondary);
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 16px;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 24px;
}

h2 {
    font-size: 1.75rem;
    margin-top: 48px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gray-200);
}

h3 {
    font-size: 1.35rem;
    margin-top: 32px;
}

h4 {
    font-size: 1.1rem;
    margin-top: 24px;
}

p {
    margin-bottom: 16px;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--gray-800) 100%);
    color: white;
    padding: 60px 40px;
    margin: -48px -40px 48px;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.hero h1 {
    color: white;
    margin-bottom: 16px;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--gray-300);
    margin-bottom: 24px;
}

.hero-badges {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--gray-200);
}

.hero-badge svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   FEATURE CARDS
   ============================================ */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 32px 0;
}

.feature-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 24px;
    transition: var(--transition);
}

.feature-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.feature-card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 16px;
}

.feature-card-icon svg {
    width: 24px;
    height: 24px;
}

.feature-card h4 {
    margin-top: 0;
    margin-bottom: 8px;
}

.feature-card p {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* ============================================
   LISTS
   ============================================ */

ul, ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

li {
    margin-bottom: 8px;
}

.feature-list {
    list-style: none;
    padding-left: 0;
}

.feature-list li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 12px;
}

.feature-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

.check-list {
    list-style: none;
    padding-left: 0;
}

.check-list li {
    position: relative;
    padding-left: 32px;
    margin-bottom: 12px;
}

.check-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 0;
    width: 22px;
    height: 22px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ============================================
   TABLES
   ============================================ */

.table-wrapper {
    overflow-x: auto;
    margin: 24px 0;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--gray-50);
}

/* ============================================
   CODE BLOCKS
   ============================================ */

code {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
    font-size: 0.875em;
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--primary-dark);
}

pre {
    background: var(--secondary);
    color: var(--gray-200);
    padding: 20px 24px;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin: 24px 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--gray-800);
    padding: 10px 16px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    margin-bottom: -8px;
}

.code-header span {
    font-size: 0.75rem;
    color: var(--gray-400);
    font-weight: 500;
}

.code-copy {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    transition: var(--transition);
}

.code-copy:hover {
    background: var(--gray-700);
    color: white;
}

/* ============================================
   ALERTS / CALLOUTS
   ============================================ */

.callout {
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin: 24px 0;
    display: flex;
    gap: 12px;
}

.callout-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.callout-content {
    flex: 1;
}

.callout-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.callout-info {
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--primary);
    color: var(--primary-dark);
}

.callout-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--warning);
    color: #92400e;
}

.callout-danger {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--danger);
    color: #991b1b;
}

.callout-success {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--success);
    color: #065f46;
}

/* ============================================
   TABS
   ============================================ */

.tabs {
    margin: 24px 0;
}

.tabs-header {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    gap: 4px;
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.tab-content {
    display: none;
    padding: 24px 0;
}

.tab-content.active {
    display: block;
}

/* ============================================
   ACCORDION
   ============================================ */

.accordion {
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    margin: 24px 0;
    overflow: hidden;
}

.accordion-item {
    border-bottom: 1px solid var(--gray-200);
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    width: 100%;
    padding: 16px 20px;
    background: white;
    border: none;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.accordion-header:hover {
    background: var(--gray-50);
}

.accordion-header svg {
    width: 20px;
    height: 20px;
    color: var(--gray-400);
    transition: transform 0.2s ease;
}

.accordion-item.active .accordion-header svg {
    transform: rotate(180deg);
}

.accordion-body {
    display: none;
    padding: 0 20px 20px;
    color: var(--gray-600);
}

.accordion-item.active .accordion-body {
    display: block;
}

/* ============================================
   BADGES & TAGS
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
}

.badge-primary {
    background: var(--primary);
    color: white;
}

.badge-success {
    background: var(--success);
    color: white;
}

.badge-warning {
    background: var(--warning);
    color: white;
}

.badge-danger {
    background: var(--danger);
    color: white;
}

.badge-gray {
    background: var(--gray-200);
    color: var(--gray-600);
}

/* ============================================
   SECTION NAVIGATION
   ============================================ */

.section-nav {
    position: sticky;
    top: calc(var(--header-height) + 24px);
    margin-left: 40px;
    padding-left: 20px;
    border-left: 2px solid var(--gray-200);
    font-size: 0.85rem;
}

.section-nav-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    margin-bottom: 12px;
}

.section-nav-list {
    list-style: none;
    padding: 0;
}

.section-nav-list a {
    display: block;
    padding: 6px 0;
    color: var(--gray-500);
    text-decoration: none;
    transition: var(--transition);
}

.section-nav-list a:hover,
.section-nav-list a.active {
    color: var(--primary);
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    margin-left: var(--sidebar-width);
    padding: 40px;
    background: white;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    color: var(--gray-500);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
}

.footer-links a {
    color: var(--gray-600);
}

.footer-links a:hover {
    color: var(--primary);
}

/* ============================================
   SEARCH RESULTS
   ============================================ */

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: var(--transition);
}

.search-result-item:hover {
    background: var(--gray-50);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-title {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 4px;
}

.search-result-excerpt {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.search-result-excerpt mark {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-dark);
    padding: 0 2px;
    border-radius: 2px;
}

.search-no-results {
    padding: 24px 16px;
    text-align: center;
    color: var(--gray-500);
}

/* ============================================
   BACK TO TOP
   ============================================ */

.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
    }

    .footer {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .header-search {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 16px;
    }

    .header-search {
        display: none;
    }

    .content {
        padding: 32px 20px;
    }

    .hero {
        padding: 40px 20px;
        margin: -32px -20px 32px;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .hero-badges {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================
   SIDEBAR OVERLAY (Mobile)
   ============================================ */

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 899;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .header,
    .sidebar,
    .back-to-top,
    .footer {
        display: none;
    }

    .main {
        margin-left: 0;
        margin-top: 0;
    }

    .content {
        max-width: 100%;
        padding: 0;
    }

    .hero {
        background: none;
        color: black;
        padding: 20px 0;
        margin: 0 0 20px;
    }

    .hero h1 {
        color: black;
    }

    a {
        color: black;
        text-decoration: underline;
    }
}
