/* 
================================================
TABLE OF CONTENTS
================================================
1.  VARIABLES & ROOT CONFIG
2.  BASE & TYPOGRAPHY
3.  REUSABLE COMPONENTS (Buttons, Cards)
4.  NAVIGATION BAR
5.  HERO SECTION & WAVE DIVIDER
6.  UPLOAD SECTION
7.  FEATURES SECTION
8.  HOW IT WORKS SECTION
9.  FOOTER
10. PROCESSING OVERLAY
11. UTILITIES & ANIMATIONS
================================================
*/

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@700,800&family=Open+Sans:wght@400;600&display=swap');

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --text-color: #212529;
    --text-muted: #6c757d;
    --card-background: #ffffff;
    --card-border-color: #dee2e6;
    --accent-color: #fd7e14;
    --success-color: #198754;
    --danger-color: #dc3545;
    --heading-font-family: 'Montserrat', sans-serif;
    --body-font-family: 'Open Sans', sans-serif;
    --border-radius: 12px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.08);
    --box-shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.dark-mode {
    --primary-color: #3b8aff;
    --secondary-color: #8899a6;
    --background-color: #121212;
    --text-color: #e0e0e0;
    --text-muted: #8899a6;
    --card-background: #1e1e1e;
    --card-border-color: #333;
    --box-shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.3);
}


body {
    font-family: var(--body-font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.7;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--heading-font-family);
    color: var(--text-color);
    font-weight: 700;
}

.dark-mode h1,
.dark-mode h2,
.dark-mode h3,
.dark-mode h4,
.dark-mode h5,
.dark-mode h6 {
    color: var(--text-color);
}

.section-title {
    text-align: center;
    margin-bottom: 4rem;
    font-size: clamp(2rem, 5vw, 2.5rem);
    font-weight: 800;
}


.card {
    background-color: var(--card-background);
    border: 1px solid var(--card-border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.06), 0 3px 6px rgba(0, 0, 0, 0.1);
}


.navbar {
    background-color: transparent;
    padding-top: 1rem;
    padding-bottom: 1rem;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1030;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease, backdrop-filter 0.3s ease;
}

.navbar.scrolled {
    background-color: rgba(255, 255, 255, 0.85);
    /* Semi-transparent white */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    /* For Safari */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.dark-mode .navbar.scrolled {
    background-color: rgba(30, 30, 30, 0.85);
    /* Semi-transparent dark */
}

.navbar-brand {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
    transition: color 0.2s ease;
}

.navbar-brand:hover {
    color: var(--primary-color);
}

.navbar-brand i {
    color: var(--primary-color);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.5rem 1rem !important;
    border-radius: var(--border-radius);
    transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.1);
    /* Primary color with low opacity */
}

.dark-mode .nav-link {
    color: var(--text-muted);
}

.dark-mode .nav-link:hover,
.dark-mode .nav-link.active {
    color: var(--primary-color);
    background-color: rgba(59, 138, 255, 0.15);
}

.nav-link i {
    font-size: 1.1rem;
    line-height: 1;
}

.navbar-toggler {
    border: none;
}

.navbar-toggler:focus {
    box-shadow: none;
}

/* User Dropdown */
.dropdown-menu {
    border-radius: var(--border-radius);
    border: 1px solid var(--card-border-color);
    box-shadow: var(--box-shadow-lg);
    padding: 0.5rem;
    margin-top: 0.75rem !important;
    background-color: var(--card-background);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: block;
    visibility: hidden;
}

.dropdown-menu.show {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border-radius: calc(var(--border-radius) - 4px);
    font-weight: 500;
}

.dropdown-item i {
    width: 16px;
    text-align: center;
}

/* Theme Toggle */
#theme-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: visible;
}

.theme-toggle-ripple {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(13, 110, 253, 0.2);
    transform: scale(0);
    animation: ripple 0.6s linear;
    width: 40px;
    height: 40px;
    top: 50%;
    left: 50%;
    margin-top: -20px;
    margin-left: -20px;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}


.hero-section {
    padding: 6rem 0 10rem 0;
    /* Increased bottom padding for wave */
    position: relative;
    background-color: var(--card-background);
    overflow: hidden;
    transition: background-color 0.3s ease;
}

.dark-mode .hero-section {
    background-color: #1a1a1a;
}

.hero-section .row>.col-lg-6:first-child {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    /* Push content to the bottom */
    padding-bottom: 12vh;
    /* Lift it up from the absolute bottom */
}

.hero-section .container {
    position: relative;
    z-index: 2;
}

.hero-image {
    position: absolute;
    right: -5%;
    top: 50%;
    transform: translateY(-50%);
    width: 50%;
    height: auto;
    opacity: 0.92;
    /* Increased from 0.5 for better visibility */
    pointer-events: none;
}

@media (max-width: 992px) {
    .hero-image {
        opacity: 0.2;
        width: 70%;
        right: -15%;
    }
}

.dark-mode .hero-image {
    opacity: 0.92;
    /* Increased significantly for line visibility */
    mix-blend-mode: lighten;
    /* Kept original blend mode to preserve lines */
}

.hero-section h1.hero-text {
    font-size: clamp(2.5rem, 5vw, 3.8rem);
    font-weight: 800;
    color: var(--text-color);
}

.hero-section .lead.hero-text {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 500px;
}

.btn-hero {
    padding: 0.8rem 2.5rem;
    font-weight: bold;
    border-radius: 50px;
}

/* Wave Divider */
.wave-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
    transform: rotate(180deg);
    z-index: 1;
}

.wave-divider svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    margin-top: -200px;
}

.wave-divider .shape-fill {
    fill: var(--background-color);
    transition: fill 0.3s ease;
}

#upload-section {
    padding: 4rem 0;
    position: relative;
}

#upload-section .card {
    box-shadow: var(--box-shadow-lg);
}

.dark-mode #upload-section .card {
    box-shadow: var(--box-shadow-lg);
}

.dark-mode #upload-section .card-header {
    background-color: #2a2a2a;
    border-bottom: 1px solid var(--card-border-color);
}

.dark-mode .form-control,
.dark-mode .form-select {
    background-color: #2c2c2e;
    color: var(--text-color);
    border-color: #4a4a4a;
}

.dark-mode .form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

.dark-mode .form-control:focus,
.dark-mode .form-select:focus {
    background-color: #2c2c2e;
    color: var(--text-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(59, 138, 255, 0.25);
}

.dark-mode .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238899a6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.dark-mode .upload-area {
    border-color: #4a4a4a !important;
}

.dark-mode .upload-area:hover {
    background-color: #2a2a2a;
    border-color: var(--primary-color) !important;
}

#features .card {
    border: none;
    text-align: center;
    background-color: transparent;
    box-shadow: none;
}

#features .feature-icon i {
    font-size: 2.5rem;
    display: inline-block;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

#features .card h3 {
    color: var(--text-color);
}

.how-it-works-section {
    padding: 6rem 0;
    background-color: var(--card-background);
    border-top: 1px solid var(--card-border-color);
    border-bottom: 1px solid var(--card-border-color);
    transition: all 0.3s ease;
}

.dark-mode .how-it-works-section {
    background-color: #1a1a1a;
}

.how-it-works-section .p-4:hover {
    background-color: var(--background-color);
}

.dark-mode .how-it-works-section .p-4:hover {
    background-color: #2a2a2a;
}

.footer {
    background-color: var(--card-background);
    padding: 4rem 0 2rem 0;
    transition: all 0.3s ease;
}

.dark-mode .footer {
    background-color: #1a1a1a;
}

/* Fix for muted text color in dark mode footer */
.dark-mode .footer .text-muted {
    color: var(--text-muted) !important;
}

.footer-link {
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--primary-color);
}

.footer-copyright {
    border-top: 1px solid var(--card-border-color);
    color: var(--text-muted);
}

#processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}

#processing-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.processing-container {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    width: 90%;
    max-width: 550px;
    text-align: center;
    box-shadow: var(--box-shadow-lg);
}

.processing-indicator .spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.processing-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.processing-subtitle,
#processing-timer {
    color: var(--text-muted);
    font-size: 1rem;
}

#processing-timer {
    font-family: monospace;
    font-size: 1.25rem;
    margin: 0.5rem 0 1.5rem 0;
}

.progress {
    height: 10px;
    border-radius: 5px;
    background-color: var(--card-border-color);
}

.processing-steps {
    display: flex;
    justify-content: space-between;
    text-align: center;
    margin-top: 2rem;
    position: relative;
}

.processing-step {
    flex: 1;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.processing-step i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.processing-step span {
    font-size: 0.8rem;
}

.processing-step .step-status {
    height: 20px;
    margin-top: 0.5rem;
    font-size: 1.2rem;
}

.processing-step.active {
    color: var(--primary-color);
}

.processing-step.complete {
    color: var(--success-color);
}


.app-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0s 0.5s;
    opacity: 1;
    visibility: visible;
}

.app-loader.loader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-logo i {
    font-size: 4rem;
    color: var(--primary-color);
    animation: pulse 1.5s infinite ease-in-out;
}

.loader-spinner {
    margin: 1.5rem 0;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(13, 110, 253, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-text {
    font-size: 1.1rem;
    color: var(--text-muted);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* 13. DARK MODE TABLE STYLES
------------------------------------------------ */
.dark-mode .table {
    border-color: #4a4a4a;
}

.dark-mode .table th,
.dark-mode .table td {
    color: var(--text-color);
    border-color: #4a4a4a;
}

.dark-mode .table-hover>tbody>tr:hover>* {
    color: var(--text-color);
    background-color: rgba(255, 255, 255, 0.075);
}

/* 14. DARK MODE CARD STYLES
------------------------------------------------ */
.dark-mode .template-card .text-muted {
    color: var(--text-muted) !important;
}

/* 15. DARK MODE DASHBOARD STYLES
------------------------------------------------ */
.dark-mode .text-muted {
    color: var(--text-muted) !important;
}

.dark-mode .stats-card .text-muted,
.dark-mode .list-group-item .text-muted {
    color: var(--text-muted) !important;
}

.dark-mode .card-header.bg-white {
    background-color: var(--card-background) !important;
}

.dark-mode .list-group-item {
    background-color: var(--card-background);
    color: var(--text-color);
    border-color: #4a4a4a;
}

/* 16. DARK MODE DROPDOWN STYLES
------------------------------------------------ */
.dark-mode .dropdown-item {
    color: var(--text-muted);
}

.dark-mode .dropdown-item:hover,
.dark-mode .dropdown-item:focus {
    color: var(--text-color);
    background-color: rgba(255, 255, 255, 0.075);
}

.dark-mode .dropdown-divider {
    border-top-color: #4a4a4a;
}

/* Scroll to top button */
.scroll-top-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background-color: #3a57c4;
    /* A slightly darker shade for hover */
}

/* 17. CUSTOM SCROLLBAR STYLES
-------------------------------------------------- */

/* General scrollbar styles for dark mode */
.dark-mode ::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.dark-mode ::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 10px;
}

.dark-mode ::-webkit-scrollbar-thumb {
    background-color: #4a4a4a;
    border-radius: 10px;
    border: 3px solid #2a2a2a;
}

.dark-mode ::-webkit-scrollbar-thumb:hover {
    background-color: #5a5a5a;
}

/* Target high z-index elements specifically (like modal dropdowns) */
.dark-mode *[style*="z-index: 2100"] ::-webkit-scrollbar,
.dark-mode select[style*="z-index"] ::-webkit-scrollbar {
    width: 12px !important;
    height: 12px !important;
}

.dark-mode *[style*="z-index: 2100"] ::-webkit-scrollbar-track,
.dark-mode select[style*="z-index"] ::-webkit-scrollbar-track {
    background: #2a2a2a !important;
    border-radius: 10px !important;
}

.dark-mode *[style*="z-index: 2100"] ::-webkit-scrollbar-thumb,
.dark-mode select[style*="z-index"] ::-webkit-scrollbar-thumb {
    background-color: #4a4a4a !important;
    border-radius: 10px !important;
    border: 3px solid #2a2a2a !important;
}

.dark-mode *[style*="z-index: 2100"] ::-webkit-scrollbar-thumb:hover,
.dark-mode select[style*="z-index"] ::-webkit-scrollbar-thumb:hover {
    background-color: #5a5a5a !important;
}

/* For Firefox - target high z-index elements */
.dark-mode *[style*="z-index: 2100"],
.dark-mode select[style*="z-index"] {
    scrollbar-width: thin !important;
    scrollbar-color: #4a4a4a #2a2a2a !important;
}