/* src/renderer/assets/css/docs.css */

/* Font Imports */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* --- Root Variables (Matched to design-system.css) --- */
:root {
    /* Colors */
    --color-primary: #06b6d4;
    /* Cyan-500 */
    --color-primary-hover: #0891b2;
    /* Cyan-600 */
    --color-secondary: #8b5cf6;
    /* Violet-500 */
    --color-secondary-hover: #7c3aed;
    /* Violet-600 */
    --color-accent: #14b8a6;
    /* Teal-500 */
    --color-success: #10b981;
    /* Emerald-500 */
    --color-warning: #f59e0b;
    /* Amber-500 */
    --color-error: #ef4444;
    /* Red-500 */

    --color-background: #f8fafc;
    /* Slate-50 */
    --color-surface: #ffffff;
    /* White */
    --color-surface-hover: #f1f5f9;
    /* Slate-100 */

    --color-text: #0f172a;
    /* Slate-900 */
    --color-text-secondary: #64748b;
    /* Slate-500 */
    --color-text-muted: #94a3b8;
    /* Slate-400 */
    --color-border: #e2e8f0;
    /* Slate-200 */

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --gradient-secondary: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --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);

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Poppins', system-ui, -apple-system, sans-serif;

    /* Spacing & Radius */
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;

    --sidebar-width: 280px;

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Global Reset & Base --- */
html {
    scroll-behavior: smooth;
    box-sizing: border-box;
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

body {
    background-color: var(--color-background);
    color: var(--color-text);
    overflow-x: hidden;
    font-family: var(--font-sans);
    margin: 0;
    line-height: 1.6;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
}

/* --- Layout --- */
.docs-wrapper {
    display: flex;
    min-height: 100vh;
}

.docs-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    position: fixed;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    padding: var(--spacing-lg);
    transition: transform 0.3s ease;
}

/* Sidebar Styling */
.docs-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding-bottom: var(--spacing-xl);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--spacing-lg);
    text-decoration: none;
    color: var(--color-text);
}

.docs-logo {
    width: 32px;
    height: 32px;
}

.docs-title {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-heading);
}

.docs-nav-group {
    margin-bottom: var(--spacing-lg);
}

.docs-nav-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
}

.docs-nav-link {
    display: block;
    padding: 6px 0;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
    border-left: 2px solid transparent;
    padding-left: 10px;
    margin-left: -12px;
}

.docs-nav-link:hover {
    color: var(--color-primary);
}

.docs-nav-link.active {
    color: var(--color-primary);
    font-weight: 600;
    border-left-color: var(--color-primary);
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.05) 0%, transparent 100%);
}

.docs-sub-menu {
    padding-left: 15px;
    margin-top: 2px;
}

/* Main Content */
.docs-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: var(--spacing-2xl);
    max-width: 100%;
}

.docs-container {
    max-width: 800px;
    margin: 0 auto;
}

.docs-header {
    margin-bottom: var(--spacing-2xl);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--spacing-lg);
}

/* Content Typography */
.docs-h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    line-height: 1.2;
    color: var(--color-text);
}

.docs-intro {
    font-size: 1.25rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 3rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.5rem;
    color: var(--color-text);
}

.content h3 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.content p,
.content li {
    margin-bottom: 0.5rem;
    color: var(--color-text-secondary);
}

.content code {
    background: var(--color-surface);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    color: var(--color-primary);
    border: 1px solid var(--color-border);
}

/* --- App Components (Exact Ports) --- */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.625rem 1.25rem;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: default;
    transition: all var(--transition-fast);
    line-height: 1.25;
    text-decoration: none !important;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: white;
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    border-radius: var(--radius-md);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
}

.badge-primary {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--color-primary);
}

/* Dashboard Cards (Exact Port from pages.css) */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin: 25px 0;
}

.stat-card {
    background: var(--color-surface);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    /* Icons in docs might need color */
}

/* Stat Icon Colors for Mockup */
.stat-icon.primary {
    background: var(--gradient-primary);
}

.stat-icon.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-icon.secondary {
    background: var(--gradient-secondary);
}

.stat-info h3 {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin: 0 0 var(--spacing-sm) 0;
    font-weight: 500;
    font-family: var(--font-sans);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    font-family: var(--font-heading);
}

/* Filters Card (From invoices.html) */
.filters-card {
    background: white;
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin: 25px 0;
    display: flex;
    gap: var(--spacing-md);
    align-items: flex-end;
    flex-wrap: wrap;
    border: 1px solid var(--color-border);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 150px;
}

.filter-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

/* Tables (Modern Table Port) */
.modern-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.modern-table th {
    background-color: var(--color-surface-hover);
    padding: var(--spacing-md);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
    font-family: var(--font-heading);
}

.modern-table td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 0.9rem;
}

.modern-table tr:last-child td {
    border-bottom: none;
}

/* Mockup Container */
.ui-mockup {
    background-color: var(--color-background);
    border: 1px solid var(--color-border);
    padding: 20px;
    border-radius: var(--radius-lg);
    margin: 25px 0;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.ui-appbar {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    margin: -20px -20px 20px -20px;
}

.ui-appbar-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text);
    font-family: var(--font-heading);
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label,
.input-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-sm);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--color-text);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

/* Base Alerts */
.doc-alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border-left: 4px solid;
    background: var(--color-surface);
    font-size: 1rem;
}

.doc-alert.info {
    border-color: var(--color-primary);
    background: rgba(6, 182, 212, 0.05);
}

.doc-alert.warning {
    border-color: var(--color-warning);
    background: rgba(245, 158, 11, 0.05);
}

.doc-alert.danger {
    border-color: var(--color-error);
    background: rgba(239, 68, 68, 0.05);
}

/* Mobile */
@media (max-width: 768px) {
    .docs-sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-xl);
    }

    .docs-sidebar.open {
        transform: translateX(0);
    }

    /* Hide app name in sidebar on mobile - it's already in the mobile header */
    .docs-sidebar .docs-brand {
        display: none;
    }

    .docs-main {
        margin-left: 0;
        padding: var(--spacing-lg);
        padding-top: 20px;
    }

    .mobile-header {
        display: flex;
        position: sticky;
        top: 0;
        left: 0;
        width: 100%;
        background-color: var(--color-surface);
        box-shadow: var(--shadow-sm);
        z-index: 1001;
        padding: 10px 15px;
        align-items: center;
        border-bottom: 1px solid var(--color-border);
    }

    .hamburger-menu {
        margin-right: 15px;
        cursor: pointer;
        padding: 8px;
        border-radius: var(--radius-md);
        transition: background-color 0.2s;
    }

    .hamburger-menu:hover {
        background-color: var(--color-surface-hover);
    }

    .bar {
        width: 20px;
        height: 2px;
        background: var(--color-text);
        margin: 4px 0;
        transition: all 0.3s;
    }

    .mobile-header-title {
        display: none;
    }

    .mobile-header-appname {
        font-weight: 700;
        color: var(--color-text);
        font-family: var(--font-heading);
        font-size: 1rem;
    }

    /* Sidebar overlay when open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Tables horizontal scroll */
    .ui-mockup {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modern-table {
        min-width: 500px;
    }

    /* Form responsiveness */
    .form-grid {
        grid-template-columns: 1fr;
    }

    .mockup-form-row {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .mockup-form-col,
    .mockup-form-col-small {
        width: 100%;
    }

    /* Typography adjustments */
    .docs-h1 {
        font-size: 1.75rem;
    }

    .docs-intro {
        font-size: 1rem;
    }

    .content h2 {
        font-size: 1.35rem;
        margin-top: 2rem;
    }

    .content h3 {
        font-size: 1.15rem;
    }

    /* Card grid mobile */
    .card-grid {
        grid-template-columns: 1fr;
    }

    /* Filters card mobile - override inline styles */
    .filters-card {
        flex-direction: column !important;
        gap: var(--spacing-md) !important;
    }

    .filter-group {
        min-width: 100% !important;
        flex: 1 1 100% !important;
    }

    /* UI Mockup container - make horizontally scrollable */
    .ui-mockup {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* Table wrapper scroll - make parent container scrollable */
    .ui-mockup>div {
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
    }

    .modern-table {
        min-width: 600px;
        font-size: 0.85rem;
        width: 100%;
    }

    .modern-table th,
    .modern-table td {
        white-space: nowrap;
        padding: 8px 12px;
    }

    /* Mockup form responsiveness - override inline styles */
    .mockup-form-row {
        flex-direction: column !important;
        gap: var(--spacing-md) !important;
    }

    .mockup-form-col,
    .mockup-form-col-small {
        width: 100% !important;
        flex: 1 1 100% !important;
    }

    /* Touch-friendly targets */
    .docs-nav-link {
        padding: 10px 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .btn {
        min-height: 44px;
    }

    /* UI Appbar mobile */
    .ui-appbar {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .ui-appbar-title {
        font-size: 1rem;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .docs-main {
        padding: var(--spacing-md);
    }

    .docs-h1 {
        font-size: 1.5rem;
    }

    .mobile-header-appname {
        font-size: 0.875rem;
    }

    .stat-card {
        padding: var(--spacing-md);
        gap: var(--spacing-md);
    }

    .stat-value {
        font-size: 1.25rem;
    }
}