/**
 * MazDukan Legal & Documentation Center Styles
 * Public pages: Privacy Policy, Terms, How to Use, Contact
 */

:root {
    --md-primary: #2563eb;
    --md-primary-dark: #1d4ed8;
    --md-primary-light: #3b82f6;
    --md-secondary: #7c3aed;
    --md-success: #10b981;
    --md-warning: #f59e0b;
    --md-danger: #ef4444;
    --md-bg: #f8fafc;
    --md-surface: #ffffff;
    --md-surface-variant: #f1f5f9;
    --md-text: #1e293b;
    --md-text-light: #64748b;
    --md-text-muted: #94a3b8;
    --md-border: #e2e8f0;
    --md-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
    --md-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --md-radius: 12px;
    --md-radius-sm: 8px;
    --md-max-width: 1200px;
    --md-header-height: 64px;
    --md-sidebar-width: 280px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--md-bg);
    color: var(--md-text);
    line-height: 1.7;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

/* Header */
.legal-header {
    background: var(--md-surface);
    border-bottom: 1px solid var(--md-border);
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: var(--md-shadow);
}

.legal-header-inner {
    max-width: var(--md-max-width);
    margin: 0 auto;
    padding: 0 24px;
    height: var(--md-header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.legal-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--md-text);
    font-weight: 700;
    font-size: 1.15rem;
    font-family: 'Poppins', sans-serif;
    flex-shrink: 0;
}

.legal-brand img { border-radius: 8px; }

.legal-nav-desktop .legal-nav-list {
    display: flex;
    list-style: none;
    gap: 6px;
    margin: 0;
    padding: 0;
}

.legal-nav-link {
    display: block;
    padding: 8px 14px;
    border-radius: var(--md-radius-sm);
    color: var(--md-text-light);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.legal-nav-link:hover,
.legal-nav-link:focus {
    background: var(--md-surface-variant);
    color: var(--md-primary);
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.legal-nav-link:focus-visible {
    outline: 2px solid var(--md-primary);
    outline-offset: 2px;
}

.legal-nav-link.active {
    color: var(--md-primary);
    background: rgba(37, 99, 235, 0.08);
    font-weight: 600;
}

.legal-btn-login {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border-radius: var(--md-radius-sm);
    background: linear-gradient(135deg, var(--md-primary), var(--md-primary-dark));
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.legal-btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
    color: #fff;
}

/* Mobile Toggle */
.legal-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    width: 40px;
    height: 40px;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--md-radius-sm);
}

.legal-nav-toggle:hover { background: var(--md-surface-variant); }

.legal-nav-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--md-text);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

.legal-nav-toggle[aria-expanded="true"] .legal-nav-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.legal-nav-toggle[aria-expanded="true"] .legal-nav-bar:nth-child(2) { opacity: 0; }
.legal-nav-toggle[aria-expanded="true"] .legal-nav-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.legal-nav-mobile { display: none; }

/* Main Content */
.legal-main {
    max-width: var(--md-max-width);
    margin: 0 auto;
    padding: 40px 24px;
    min-height: calc(100vh - var(--md-header-height) - 200px);
}

.legal-hero {
    text-align: center;
    margin-bottom: 40px;
}

.legal-hero h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--md-primary);
    margin-bottom: 8px;
    line-height: 1.2;
}

.legal-hero .legal-last-updated {
    color: var(--md-text-light);
    font-size: 0.875rem;
}

.legal-hero p.lead {
    color: var(--md-text-light);
    max-width: 700px;
    margin: 12px auto 0;
}

/* Breadcrumbs */
.legal-breadcrumb {
    margin-bottom: 24px;
    font-size: 0.85rem;
    color: var(--md-text-light);
}

.legal-breadcrumb a {
    color: var(--md-primary);
    text-decoration: none;
    font-weight: 500;
}

.legal-breadcrumb a:hover { text-decoration: underline; }

/* Layout: content + sidebar */
.legal-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.legal-content {
    flex: 1;
    min-width: 0;
}

.legal-sidebar {
    width: var(--md-sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--md-header-height) + 24px);
    max-height: calc(100vh - var(--md-header-height) - 48px);
    overflow-y: auto;
}

/* Table of Contents */
.legal-toc {
    background: var(--md-surface);
    border: 1px solid var(--md-border);
    border-radius: var(--md-radius);
    padding: 20px;
    box-shadow: var(--md-shadow);
}

.legal-toc-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--md-text);
}

.legal-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.legal-toc-list li { margin-bottom: 4px; }

.legal-toc-list a {
    display: block;
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--md-text-light);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.legal-toc-list a:hover,
.legal-toc-list a:focus {
    background: var(--md-surface-variant);
    color: var(--md-primary);
    border-left-color: var(--md-primary);
}

.legal-toc-list a.active {
    background: rgba(37,99,235,0.06);
    color: var(--md-primary);
    border-left-color: var(--md-primary);
    font-weight: 600;
}

/* Sections */
.legal-section {
    margin-bottom: 48px;
    scroll-margin-top: calc(var(--md-header-height) + 24px);
}

.legal-section h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--md-text);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--md-border);
}

.legal-section h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--md-text);
    margin: 24px 0 12px;
}

.legal-section p {
    margin-bottom: 14px;
    color: var(--md-text);
}

.legal-section ul,
.legal-section ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.legal-section li {
    margin-bottom: 10px;
    color: var(--md-text);
}

.legal-section li strong {
    color: var(--md-text);
    font-weight: 600;
}

/* Callout / Info Box */
.legal-callout {
    background: rgba(37,99,235,0.04);
    border: 1px solid rgba(37,99,235,0.15);
    border-radius: var(--md-radius);
    padding: 20px;
    margin: 20px 0;
}

.legal-callout-title {
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--md-primary-dark);
}

.legal-callout p:last-child { margin-bottom: 0; }

/* Workflow */
.legal-workflow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 16px 0;
    padding: 16px;
    background: var(--md-surface-variant);
    border-radius: var(--md-radius-sm);
    font-size: 0.9rem;
}

.legal-workflow-step {
    background: var(--md-surface);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    color: var(--md-primary);
    border: 1px solid var(--md-border);
    white-space: nowrap;
}

.legal-workflow-arrow {
    color: var(--md-text-muted);
    font-weight: 700;
}

/* FAQ */
.legal-faq-item {
    border-bottom: 1px solid var(--md-border);
    padding: 20px 0;
}

.legal-faq-question {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 8px;
    color: var(--md-text);
}

.legal-faq-answer { color: var(--md-text-light); }

/* Contact Form */
.legal-contact-form .form-label { font-weight: 600; color: var(--md-text); }
.legal-contact-form .form-control {
    border-radius: var(--md-radius-sm);
    border-color: var(--md-border);
    padding: 12px 14px;
    font-size: 0.95rem;
}
.legal-contact-form .form-control:focus {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.legal-contact-form textarea.form-control { min-height: 140px; resize: vertical; }

.legal-btn-submit {
    background: linear-gradient(135deg, var(--md-primary), var(--md-primary-dark));
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: var(--md-radius-sm);
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.legal-btn-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37,99,235,0.3); }

/* Status badges */
.legal-status { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; }
.legal-status-trial { background: #fef3c7; color: #92400e; }
.legal-status-active { background: #dcfce7; color: #166534; }
.legal-status-expired { background: #fee2e2; color: #991b1b; }
.legal-status-suspended { background: #f1f5f9; color: #475569; }

/* Footer */
.legal-footer {
    background: var(--md-surface);
    border-top: 1px solid var(--md-border);
    padding: 40px 24px 24px;
    margin-top: 40px;
}

.legal-footer-inner {
    max-width: var(--md-max-width);
    margin: 0 auto;
}

.legal-footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--md-border);
}

.legal-footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--md-text);
}

.legal-footer-nav a {
    color: var(--md-text-light);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.legal-footer-nav a:hover { color: var(--md-primary); text-decoration: underline; }

.legal-footer-sep { color: var(--md-text-muted); margin: 0 6px; }

.legal-footer-bottom {
    text-align: center;
    color: var(--md-text-light);
    font-size: 0.85rem;
}

.legal-footer-bottom p { margin-bottom: 4px; }

.legal-footer-support a { color: var(--md-primary); text-decoration: none; font-weight: 500; }
.legal-footer-support a:hover { text-decoration: underline; }

/* Alert / Messages */
.legal-alert {
    padding: 16px 20px;
    border-radius: var(--md-radius-sm);
    margin-bottom: 24px;
    font-weight: 500;
}
.legal-alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.legal-alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Search box */
.legal-search-box {
    position: relative;
    margin-bottom: 24px;
}
.legal-search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--md-border);
    border-radius: var(--md-radius);
    font-size: 1rem;
    background: var(--md-surface);
}
.legal-search-box input:focus {
    outline: 2px solid var(--md-primary);
    outline-offset: 2px;
    border-color: var(--md-primary);
}
.legal-search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--md-text-muted);
}

/* Responsive */
@media (max-width: 991.98px) {
    .legal-layout { flex-direction: column; }
    .legal-sidebar {
        width: 100%;
        position: static;
        max-height: none;
        margin-bottom: 24px;
    }
    .legal-hero h1 { font-size: 1.75rem; }
}

@media (max-width: 767.98px) {
    .legal-header-inner { padding: 0 16px; }
    .legal-nav-desktop { display: none; }
    .legal-btn-login { display: none; }
    .legal-nav-toggle { display: flex; }
    .legal-nav-mobile {
        display: block;
        background: var(--md-surface);
        border-top: 1px solid var(--md-border);
        padding: 16px 24px;
    }
    .legal-nav-mobile[hidden] { display: none; }
    .legal-nav-mobile-list { list-style: none; margin: 0; padding: 0; }
    .legal-nav-mobile-list li { margin-bottom: 4px; }
    .legal-nav-mobile-link {
        display: block;
        padding: 10px 12px;
        border-radius: var(--md-radius-sm);
        color: var(--md-text);
        text-decoration: none;
        font-weight: 500;
    }
    .legal-nav-mobile-link.active {
        background: rgba(37,99,235,0.08);
        color: var(--md-primary);
    }
    .legal-main { padding: 24px 16px; }
    .legal-footer-top { flex-direction: column; text-align: center; }
    .legal-hero h1 { font-size: 1.5rem; }
}

/* Print */
@media print {
    .legal-header, .legal-sidebar, .legal-footer, .legal-nav-toggle { display: none !important; }
    .legal-main { padding: 0; max-width: 100%; }
    .legal-section { margin-bottom: 24px; page-break-inside: avoid; }
    a { text-decoration: none; color: var(--md-text); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .legal-btn-login, .legal-btn-submit { transition: none; }
}
