/* ============================================
   APPY DOCUMENTATION - TAILWIND CSS v4
   ============================================ */

/* Import Tailwind CSS v4 */
@import "tailwindcss";

/* Import Highlight.js theme */
@import "highlight.js/styles/github-dark.css";

/* Flowbite Plugin */
@plugin "flowbite/plugin";
@source "../../../node_modules/flowbite";

/* Content Sources for Class Detection */
@source "../../**/*.html";
@source "../js/**/*.js";

/* Dark Mode Configuration (Class-Based) */
@variant dark (&:is(.dark *));

/* Custom Theme - Match main Appy app */
@theme {
    --color-primary-50: #eff6ff;
    --color-primary-100: #dbeafe;
    --color-primary-200: #bfdbfe;
    --color-primary-300: #93c5fd;
    --color-primary-400: #60a5fa;
    --color-primary-500: #3b82f6;
    --color-primary-600: #2563eb;
    --color-primary-700: #1d4ed8;
    --color-primary-800: #1e40af;
    --color-primary-900: #1e3a8a;
    --color-primary-950: #172554;
    --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
}

/* ============================================
   BASE STYLES
   ============================================ */

/* Alpine.js x-cloak directive */
[x-cloak] {
    display: none !important;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Body base colors */
body {
    color: #1f2937;
    background-color: #f9fafb;
}

.dark body,
body.dark,
html.dark body {
    color: #f3f4f6;
    background-color: #111827;
}

/* ============================================
   DOCUMENTATION LAYOUT
   ============================================ */

/* Sidebar */
.docs-sidebar {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.docs-sidebar:hover {
    scrollbar-color: #d1d5db #f3f4f6;
}

.dark .docs-sidebar:hover {
    scrollbar-color: #4b5563 #1f2937;
}

/* Main content area */
.docs-content {
    max-width: 48rem;
}

.docs-content > * + * {
    margin-top: 1.5rem;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

.docs-content h1 {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #111827;
}

.dark .docs-content h1 {
    color: #ffffff;
}

.docs-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    color: #111827;
}

.dark .docs-content h2 {
    border-bottom-color: #374151;
    color: #f9fafb;
}

.docs-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: #1f2937;
}

.dark .docs-content h3 {
    color: #f3f4f6;
}

.docs-content h4 {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: #1f2937;
}

.dark .docs-content h4 {
    color: #e5e7eb;
}

.docs-content p {
    line-height: 1.75;
    margin-bottom: 1rem;
    color: #4b5563;
}

.dark .docs-content p {
    color: #d1d5db;
}

/* Preserve text colors inside gradient backgrounds */
.docs-content .bg-gradient-to-r p,
.docs-content .bg-gradient-to-br p,
.docs-content [class*="bg-gradient"] p {
    color: inherit;
}

.dark .docs-content .bg-gradient-to-r p,
.dark .docs-content .bg-gradient-to-br p,
.dark .docs-content [class*="bg-gradient"] p {
    color: inherit;
}

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

.docs-content ul {
    list-style-type: disc;
}

.docs-content ol {
    list-style-type: decimal;
}

.docs-content li {
    margin-bottom: 0.5rem;
    line-height: 1.75;
    color: #4b5563;
}

.dark .docs-content li {
    color: #d1d5db;
}

.docs-content strong {
    font-weight: 600;
    color: #1f2937;
}

.dark .docs-content strong {
    color: #f3f4f6;
}

/* Links - Only apply to inline text links, NOT buttons */
.docs-content p a,
.docs-content li a,
.docs-content td a {
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.docs-content p a:hover,
.docs-content li a:hover,
.docs-content td a:hover {
    color: #1d4ed8;
}

.dark .docs-content p a,
.dark .docs-content li a,
.dark .docs-content td a {
    color: #60a5fa;
}

.dark .docs-content p a:hover,
.dark .docs-content li a:hover,
.dark .docs-content td a:hover {
    color: #93c5fd;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none !important;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-primary {
    background-color: #2563eb;
    color: white !important;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #1f2937 !important;
    border: 1px solid #e5e7eb;
}

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

.dark .btn-secondary {
    background-color: #374151;
    color: #f3f4f6 !important;
    border-color: #4b5563;
}

.dark .btn-secondary:hover {
    background-color: #4b5563;
}

/* ============================================
   CODE BLOCKS
   ============================================ */

.docs-content code:not(pre code) {
    background-color: #f3f4f6;
    color: #1f2937;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.dark .docs-content code:not(pre code) {
    background-color: #374151;
    color: #f3f4f6;
}

.code-block {
    position: relative;
    background-color: #1f2937;
    border-radius: 0.5rem;
    margin: 1rem 0;
    overflow: hidden;
}

.code-block pre {
    padding: 1rem;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.7;
}

.code-block code {
    color: #e5e7eb;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.code-block .copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.375rem 0.75rem;
    background-color: #374151;
    color: #9ca3af;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background-color 0.2s;
    text-decoration: none !important;
}

.code-block:hover .copy-btn {
    opacity: 1;
}

.code-block .copy-btn:hover {
    background-color: #4b5563;
    color: #f3f4f6;
}

.code-block .copy-btn.copied {
    background-color: #065f46;
    color: #a7f3d0;
}

/* ============================================
   ALERTS / CALLOUTS
   ============================================ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0.5rem;
    border-left-width: 4px;
}

.alert-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
}

.alert-text {
    flex: 1;
}

.alert-text p {
    margin: 0;
}

.alert-info {
    background-color: #eff6ff;
    border-left-color: #3b82f6;
}

.alert-info .alert-icon {
    color: #3b82f6;
}

.alert-info .alert-text {
    color: #1e40af;
}

.dark .alert-info {
    background-color: rgba(59, 130, 246, 0.15);
}

.dark .alert-info .alert-text {
    color: #93c5fd;
}

.alert-warning {
    background-color: #fffbeb;
    border-left-color: #f59e0b;
}

.alert-warning .alert-icon {
    color: #f59e0b;
}

.alert-warning .alert-text {
    color: #92400e;
}

.dark .alert-warning {
    background-color: rgba(245, 158, 11, 0.15);
}

.dark .alert-warning .alert-text {
    color: #fcd34d;
}

.alert-success {
    background-color: #ecfdf5;
    border-left-color: #10b981;
}

.alert-success .alert-icon {
    color: #10b981;
}

.alert-success .alert-text {
    color: #065f46;
}

.dark .alert-success {
    background-color: rgba(16, 185, 129, 0.15);
}

.dark .alert-success .alert-text {
    color: #6ee7b7;
}

.alert-danger {
    background-color: #fef2f2;
    border-left-color: #ef4444;
}

.alert-danger .alert-icon {
    color: #ef4444;
}

.alert-danger .alert-text {
    color: #991b1b;
}

.dark .alert-danger {
    background-color: rgba(239, 68, 68, 0.15);
}

.dark .alert-danger .alert-text {
    color: #fca5a5;
}

/* ============================================
   STEP INDICATORS
   ============================================ */

.step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.step-number {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    background-color: #2563eb;
    color: white;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.step-content {
    flex: 1;
}

.step-content h4 {
    margin-top: 0;
    margin-bottom: 0.25rem;
}

.step-content p {
    margin-bottom: 0;
}

/* ============================================
   IMAGES & SCREENSHOTS
   ============================================ */

.docs-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    margin: 1rem 0;
}

.dark .docs-content img {
    border-color: #374151;
}

.screenshot {
    display: block;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    overflow: hidden;
}

.dark .screenshot {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
}

.screenshot-caption {
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
    font-style: italic;
}

.dark .screenshot-caption {
    color: #9ca3af;
}

/* Screenshot placeholder for missing images */
.screenshot-placeholder {
    background-color: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

.dark .screenshot-placeholder {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #9ca3af;
}

/* ============================================
   TABLES
   ============================================ */

.docs-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.875rem;
}

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

.dark .docs-content th,
.dark .docs-content td {
    border-bottom-color: #374151;
}

.docs-content th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #1f2937;
}

.dark .docs-content th {
    background-color: #1f2937;
    color: #f3f4f6;
}

.docs-content td {
    color: #4b5563;
}

.dark .docs-content td {
    color: #d1d5db;
}

/* ============================================
   NAVIGATION
   ============================================ */

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    color: #4b5563;
    font-size: 0.875rem;
    text-decoration: none !important;
    transition: all 0.15s;
}

.nav-link:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

.dark .nav-link {
    color: #9ca3af;
}

.dark .nav-link:hover {
    background-color: #374151;
    color: #f9fafb;
}

.nav-link.active {
    background-color: #eff6ff;
    color: #2563eb;
    font-weight: 500;
}

.dark .nav-link.active {
    background-color: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
}

/* Prev/Next navigation */
.prev-next-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.dark .prev-next-nav {
    border-top-color: #374151;
}

.prev-next-link {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    max-width: 45%;
    text-decoration: none !important;
    transition: all 0.2s;
}

.prev-next-link:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.dark .prev-next-link {
    border-color: #374151;
}

.dark .prev-next-link:hover {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

.prev-next-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.dark .prev-next-label {
    color: #9ca3af;
}

.prev-next-title {
    font-weight: 600;
    color: #1f2937;
}

.dark .prev-next-title {
    color: #f9fafb;
}

/* ============================================
   TABLE OF CONTENTS
   ============================================ */

.toc {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
}

.dark .toc {
    background-color: #1f2937;
    border-color: #374151;
}

.toc h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
}

.dark .toc h4 {
    color: #f3f4f6;
}

.toc ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

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

.toc a {
    color: #4b5563;
    font-size: 0.875rem;
    text-decoration: none !important;
}

.toc a:hover {
    color: #2563eb;
}

.dark .toc a {
    color: #9ca3af;
}

.dark .toc a:hover {
    color: #60a5fa;
}

/* ============================================
   FEATURE CARDS (for index.html)
   ============================================ */

.feature-card {
    display: block;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-decoration: none !important;
    transition: all 0.2s;
}

.feature-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.dark .feature-card {
    background-color: #1f2937;
    border-color: #374151;
}

.dark .feature-card:hover {
    border-color: #3b82f6;
}

.feature-card h3 {
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.dark .feature-card h3 {
    color: #f3f4f6;
}

.feature-card p {
    margin-bottom: 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.dark .feature-card p {
    color: #9ca3af;
}

.feature-icon {
    width: 2.5rem;
    height: 2.5rem;
    background-color: #eff6ff;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark .feature-icon {
    background-color: rgba(59, 130, 246, 0.2);
}

.feature-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    color: #2563eb;
}

.dark .feature-icon svg {
    color: #60a5fa;
}

/* ============================================
   QUICK START SECTION
   ============================================ */

.quick-start {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-radius: 0.75rem;
    padding: 2rem;
    margin: 2rem 0;
}

.quick-start h2 {
    color: white;
    border-bottom: none;
    margin-top: 0;
    padding-bottom: 0;
}

.quick-start .step-number {
    background-color: white;
    color: #2563eb;
}

.quick-start .step-content h3 {
    color: white;
    margin-top: 0;
}

.quick-start .step-content p {
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4b5563;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
    .docs-content h1 {
        font-size: 1.75rem;
    }

    .docs-content h2 {
        font-size: 1.25rem;
    }

    .prev-next-nav {
        flex-direction: column;
        gap: 1rem;
    }

    .prev-next-link {
        max-width: 100%;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .docs-sidebar,
    .mobile-menu-btn,
    .dark-mode-toggle,
    .prev-next-nav {
        display: none !important;
    }

    .docs-content {
        margin: 0;
        max-width: 100%;
    }

    .code-block .copy-btn {
        display: none;
    }
}
