/* LegalExpert - Base Styles */

:root {
    --primary-color: #0066CC;
    --secondary-color: #28A745;
    --dark-color: #2C3E50;
    
    /* Light theme (default) */
    --bg-color: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-color: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --card-bg: #ffffff;
    --card-border: #e9ecef;
    --input-bg: #ffffff;
    --input-border: #ced4da;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* Dark theme */
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-color: #e9ecef;
    --text-muted: #adb5bd;
    --border-color: #495057;
    --card-bg: #2d2d2d;
    --card-border: #404040;
    --input-bg: #2d2d2d;
    --input-border: #495057;
    --shadow: rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, #004999 100%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.navbar.scrolled {
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.98) 0%, rgba(0, 73, 153, 0.98) 100%);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 0.5rem 0;
}

@media (max-width: 768px) {
    .navbar.scrolled {
        padding: 0.25rem 0;
    }
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
    color: white !important;
}

.nav-link {
    color: rgba(255,255,255,0.9) !important;
    font-weight: 500;
    transition: all 0.3s;
    margin: 0 0.5rem;
    position: relative;
}

.nav-link:hover {
    color: white !important;
    transform: translateY(-2px);
}

/* Dropdown Toggle Improvements */
.dropdown-toggle::after {
    transition: transform 0.3s ease;
}

.dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

/* Dropdown Menu Positioning */
.dropdown-menu {
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.dropdown-menu-end {
    right: 0;
    left: auto;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transition: all 0.3s;
}

.btn-primary:hover {
    background-color: #0052a3;
    border-color: #0052a3;
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,102,204,0.3);
}

.btn-primary:active {
    transform: scale(0.98);
    background-color: #004080;
}

.btn-success {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    transition: all 0.3s;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #218838;
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40,167,69,0.3);
}

.btn-success:active {
    transform: scale(0.98);
    background-color: #1e7e34;
}

/* Cards */
.card {
    border: 1px solid var(--card-border);
    background-color: var(--card-bg);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #004999 100%);
    color: white;
    padding: 4rem 0;
    margin-bottom: 2rem;
}

/* Footer */
footer {
    background: linear-gradient(135deg, #2C3E50 0%, #1a252f 100%);
    color: white;
    margin-top: auto;
    padding: 3rem 0 1rem;
}

footer a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: color 0.3s;
}

footer a:hover {
    color: white;
}

/* Main content area */
main {
    flex: 1;
}

/* Dropdown Menu Styles */
.dropdown-menu {
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-radius: 10px;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 1.25rem;
    transition: all 0.3s;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    padding-left: 1.5rem;
}

.dropdown-header {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem 1.25rem;
    margin-bottom: 0.25rem;
}

/* Modern Mega Menu Styles - Optimized */
.mega-menu {
    min-width: 850px;
    max-width: 1100px;
    width: auto;
    padding: 0 !important;
    border: none;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.12), 0 5px 15px rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    margin-top: 12px !important;
    overflow: hidden;
    background: #fff;
    animation: megaMenuFadeIn 0.3s ease-out;
    z-index: 1050;
}

@keyframes megaMenuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mega-menu-item {
    padding: 0;
}

.mega-menu-container {
    padding: 0;
}

.mega-menu-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 0;
    background: #fff;
    gap: 0;
}

.mega-menu-col {
    padding: 0;
    border-right: 1px solid #f0f0f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: #fff;
}

.mega-menu-col:nth-child(3n) {
    border-right: none;
}

.mega-menu-col::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.03) 0%, rgba(0, 102, 204, 0.01) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.mega-menu-col:hover::before {
    opacity: 1;
}

.mega-menu-col:hover {
    background-color: #fafbfc;
    transform: translateY(-2px);
    box-shadow: inset 0 0 0 1px rgba(0, 102, 204, 0.1);
}

.mega-menu-section {
    padding: 1.75rem 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.mega-menu-title {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #0066CC;
    margin: 0 0 1.25rem 0;
    padding-bottom: 0.875rem;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    transition: color 0.3s ease;
}

.mega-menu-col:hover .mega-menu-title {
    color: #0052a3;
    border-bottom-color: rgba(0, 102, 204, 0.2);
}

.mega-menu-title i {
    font-size: 1.25rem;
    color: #0066CC;
    transition: all 0.3s ease;
}

.mega-menu-col:hover .mega-menu-title i {
    color: #0052a3;
    transform: scale(1.1);
}

.mega-menu-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 0.75rem;
    color: #495057;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 0.375rem;
    position: relative;
    background: transparent;
}

.mega-menu-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleX(0);
    width: 3px;
    height: 0;
    background: linear-gradient(135deg, #0066CC 0%, #004999 100%);
    border-radius: 0 2px 2px 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.mega-menu-link:hover {
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.1) 0%, rgba(0, 102, 204, 0.05) 100%);
    color: #0066CC;
    transform: translateX(6px);
    padding-left: 1rem;
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.1);
}

.mega-menu-link:hover::before {
    transform: translateY(-50%) scaleX(1);
    height: 60%;
}

.mega-menu-link i {
    font-size: 0.95rem;
    opacity: 0.6;
    margin-right: 0.5rem;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.mega-menu-link:hover i {
    opacity: 1;
    color: #0066CC;
    transform: scale(1.15);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .mega-menu {
        min-width: 750px;
        max-width: 950px;
    }
    
    .mega-menu-section {
        padding: 1.5rem 1.25rem;
    }
}

@media (max-width: 992px) and (min-width: 769px) {
    .mega-menu {
        min-width: auto;
        max-width: calc(100vw - 3rem);
        width: calc(100vw - 3rem);
        margin-left: 1.5rem !important;
        margin-right: 1.5rem !important;
    }
    
    .mega-menu-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mega-menu-col:nth-child(2n) {
        border-right: none;
    }
    
    .mega-menu-col:nth-child(3n) {
        border-right: 1px solid #f0f0f0;
    }
}

@media (max-width: 991px) {
    .mega-menu {
        min-width: auto;
        max-width: calc(100vw - 2rem);
        width: calc(100vw - 2rem);
        margin-left: 1rem !important;
        margin-right: 1rem !important;
        border-radius: 12px;
        left: auto !important;
        right: 1rem !important;
        transform: none !important;
    }
    
    /* Center align on very small screens */
    @media (max-width: 576px) {
        .mega-menu {
            left: 50% !important;
            right: auto !important;
            transform: translateX(-50%) !important;
            margin-left: 0 !important;
            margin-right: 0 !important;
        }
    }
}
    
    .mega-menu-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mega-menu-col {
        border-right: 1px solid #f0f0f0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .mega-menu-col:nth-child(2n) {
        border-right: none;
    }
    
    .mega-menu-col:nth-child(3n) {
        border-right: 1px solid #f0f0f0;
    }
    
    .mega-menu-col:last-child {
        border-bottom: none;
    }
    
    .mega-menu-section {
        padding: 1.25rem 1rem;
    }
    
    .mega-menu-title {
        font-size: 0.8rem;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }
    
    .mega-menu-link {
        padding: 0.625rem 0.625rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 768px) {
    .mega-menu {
        max-width: calc(100vw - 1rem);
        width: calc(100vw - 1rem);
        margin-left: 0.5rem !important;
        margin-right: 0.5rem !important;
        border-radius: 10px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .mega-menu-row {
        grid-template-columns: 1fr;
    }
    
    .mega-menu-col {
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .mega-menu-col:nth-child(2n),
    .mega-menu-col:nth-child(3n) {
        border-right: none;
    }
    
    .mega-menu-col:last-child {
        border-bottom: none;
    }
    
    .mega-menu-section {
        padding: 1rem 0.875rem;
    }
    
    .mega-menu-title {
        font-size: 0.75rem;
        margin-bottom: 0.875rem;
        padding-bottom: 0.625rem;
    }
    
    .mega-menu-link {
        padding: 0.5rem 0.5rem;
        font-size: 0.85rem;
        -webkit-tap-highlight-color: rgba(0, 102, 204, 0.1);
    }
    
    .mega-menu-link:hover,
    .mega-menu-link:active {
        transform: translateX(4px);
        padding-left: 0.75rem;
    }
    
    /* Smooth scrolling for mobile */
    .mega-menu::-webkit-scrollbar {
        width: 6px;
    }
    
    .mega-menu::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }
    
    .mega-menu::-webkit-scrollbar-thumb {
        background: #0066CC;
        border-radius: 10px;
    }
    
    .mega-menu::-webkit-scrollbar-thumb:hover {
        background: #0052a3;
    }
}

