/* Legal Page Styles */
:root {
    --tab-bg: #f8f9fa;
    --tab-hover: #f0f1f3;
    --tab-active: rgba(138, 43, 226, 0.1);
    --border-color: #e5e7eb;
    --text-primary: #2c3e50;
    --text-secondary: #5a6c7d;
    --purple-accent: #9b59b6;
    --purple-light: #a78bfa;
    --purple-dark: #8e44ad;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8f9fa;
    color: #2c3e50;
    line-height: 1.6;
    min-height: 100vh;
}

.legal-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation - Matching Marketplace Style */
.legal-nav {
    position: fixed;
    top: 0;
    width: 100%;
    height: 70px;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    text-decoration: none;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    overflow: visible;
}

/* Search Bar */
.search-bar {
    flex: 1;
    max-width: 600px;
    margin: 0 40px;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 25px;
    font-size: 15px;
    transition: all 0.3s;
    background: #f8f9fa;
}

.search-bar input:focus {
    outline: none;
    border-color: #9b59b6;
    background: white;
}

/* Navigation Right */
.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
}

.nav-link {
    text-decoration: none;
    color: #5a6c7d;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-link:hover {
    color: #9b59b6;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 16px;
    border-radius: 25px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.user-menu:hover {
    background: #e9ecef;
}

.avatar-container {
    width: 32px;
    height: 32px;
    position: relative;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#user-display-name {
    font-weight: 500;
    color: #2c3e50;
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 200px;
    display: none;
    z-index: 1001;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 12px 20px;
    color: #2c3e50;
    text-decoration: none;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f2f5;
}

.dropdown-item:first-child {
    border-radius: 12px 12px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 12px 12px;
    border-bottom: none;
}

.dropdown-item:hover {
    background: #f8f9fa;
}

/* Main Content */
.legal-content {
    flex: 1;
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    margin-top: 90px; /* Account for fixed nav */
    width: 100%;
    padding: 2rem;
    gap: 2rem;
}

/* Vertical Tabs */
.legal-tabs {
    width: 280px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 1rem;
    height: fit-content;
    position: sticky;
    top: 100px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.tab-button {
    width: 100%;
    background: #f8f9fa;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #5a6c7d;
    font-size: 0.95rem;
    text-align: left;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
}

.tab-button:hover {
    background: #f0f1f3;
    transform: translateX(5px);
    border-color: #9b59b6;
}

.tab-button.active {
    background: rgba(155, 89, 182, 0.1);
    border-color: #9b59b6;
    color: #8e44ad;
    box-shadow: 0 0 0 2px rgba(155, 89, 182, 0.1);
    font-weight: 600;
}

.tab-icon {
    font-size: 1.2rem;
    width: 30px;
    text-align: center;
}

.tab-text {
    flex: 1;
    font-weight: 500;
}

/* Document Display */
.legal-document {
    flex: 1;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 2rem;
    min-height: 600px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.document-content {
    color: #2c3e50;
    line-height: 1.8;
    max-width: 800px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.document-content h1 {
    color: #2c3e50;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e1e8ed;
}

.document-content h2 {
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.document-content h3 {
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.document-content p {
    margin-bottom: 1rem;
    color: #5a6c7d;
}

.document-content ul,
.document-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
    color: #5a6c7d;
}

.document-content li {
    margin-bottom: 0.5rem;
}

.document-content strong {
    color: #2c3e50;
    font-weight: 600;
}

.document-content a {
    color: #9b59b6;
    text-decoration: none;
    transition: color 0.3s ease;
}

.document-content a:hover {
    color: #8e44ad;
    text-decoration: underline;
}

.document-content blockquote {
    background: rgba(155, 89, 182, 0.05);
    border-left: 4px solid #9b59b6;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 5px;
    color: #5a6c7d;
}

.document-content code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #8e44ad;
    border: 1px solid #e1e8ed;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
    color: #9b59b6;
    font-size: 1.1rem;
    font-weight: 500;
}

.loading::after {
    content: '.';
    animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Scrollbar Styling */
.document-content::-webkit-scrollbar {
    width: 8px;
}

.document-content::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 4px;
}

.document-content::-webkit-scrollbar-thumb {
    background: #d4b5f0;
    border-radius: 4px;
}

.document-content::-webkit-scrollbar-thumb:hover {
    background: #9b59b6;
}

/* Responsive Design */
@media (max-width: 968px) {
    .legal-content {
        flex-direction: column;
    }
    
    .legal-tabs {
        width: 100%;
        position: static;
        display: flex;
        overflow-x: auto;
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .tab-button {
        min-width: 150px;
        margin-bottom: 0;
    }
    
    .legal-document {
        padding: 1.5rem;
    }
}

@media (max-width: 640px) {
    .header-content {
        padding: 1rem;
    }
    
    .legal-content {
        padding: 0 1rem;
        margin: 1rem auto;
    }
    
    .document-content h1 {
        font-size: 1.5rem;
    }
    
    .document-content h2 {
        font-size: 1.25rem;
    }
}