/* ===========================================
   FORENSIC TERMINAL - JTAG Finder Homepage
   =========================================== */

/* CSS Custom Properties */
:root {
    --bg-deep: #0f1419;
    --bg-surface: #1a2332;
    --bg-card: #1e2a3a;
    --border-subtle: #2d3f52;
    --accent-cyan: #00d4ff;
    --accent-teal: #40babd;
    --accent-success: #00ff88;
    --accent-warning: #ffb000;
    --text-primary: #e4e8ec;
    --text-muted: #8b9caf;
    --text-dim: #5a6b7f;

    --font-mono: 'JetBrains Mono', monospace;
    --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Space Grotesk', sans-serif;

    --glow-cyan: 0 0 20px rgba(0, 212, 255, 0.3);
    --glow-cyan-strong: 0 0 40px rgba(0, 212, 255, 0.5);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ===========================================
   BASE STYLES
   =========================================== */
html {
    scroll-behavior: smooth;
    /* Offset for fixed header when scrolling to anchors */
    scroll-padding-top: 100px;
}

body {
    background: var(--bg-deep) !important;
    color: var(--text-primary) !important;
    font-family: var(--font-body) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Focus states for accessibility */
a:focus,
button:focus,
.btn:focus {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}

/* Skip focus outline for mouse users */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
.btn:focus:not(:focus-visible) {
    outline: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-mono) !important;
    color: var(--text-primary) !important;
}

p {
    color: var(--text-muted);
    line-height: 1.7;
}

a {
    color: var(--accent-cyan);
    transition: all 0.3s ease;
}

a:hover {
    color: var(--text-primary);
    text-decoration: none;
}

/* ===========================================
   HEADER
   =========================================== */
.header {
    /* Fallback for browsers that don't support backdrop-filter */
    background: rgba(15, 20, 25, 0.98) !important;
    border-bottom: 1px solid var(--border-subtle);
    position: fixed !important;
    width: 100%;
    top: 0;
    z-index: 1000;
}

/* Apply backdrop-filter only if supported */
@supports (backdrop-filter: blur(10px)) {
    .header {
        background: rgba(15, 20, 25, 0.9) !important;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

.header .logo .text {
    color: var(--text-primary) !important;
    font-family: var(--font-mono) !important;
    font-weight: 600;
}

.header .logo .highlight {
    color: var(--accent-cyan) !important;
}

.header .nav-link {
    color: var(--text-muted) !important;
    font-family: var(--font-body);
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: all 0.3s ease;
    position: relative;
}

.header .nav-link:hover,
.header .nav-link.active {
    color: var(--accent-cyan) !important;
}

.header .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-cyan);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.header .nav-link:hover::after {
    width: 80%;
}

/* Desktop nav - ensure it's visible */
@media (min-width: 768px) {
    .header .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
    }

    .header .navbar-nav {
        display: flex !important;
        flex-direction: row;
        align-items: center;
    }

    .header .nav-item {
        margin-left: 0.5rem;
    }

    .header .navbar-toggler {
        display: none !important;
    }
}

/* Mobile menu toggle */
.header .navbar-toggler {
    border: 1px solid var(--border-subtle);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
}

.header .navbar-toggler .icon-bar {
    background: var(--text-muted);
    display: block;
    width: 22px;
    height: 2px;
    margin: 2px 0;
}

/* Mobile menu dropdown background */
@media (max-width: 767px) {
    .header .navbar-collapse {
        background: var(--bg-surface);
        border-radius: 0 0 12px 12px;
        border: 1px solid var(--border-subtle);
        border-top: none;
        margin-top: 0.5rem;
        padding: 1rem;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
    }

    .header .navbar-collapse:not(.show) {
        display: none;
    }

    .header .navbar-collapse.show {
        display: block !important;
    }

    .header .navbar-nav {
        flex-direction: column;
    }

    .header .nav-link {
        padding: 0.75rem 1rem !important;
        border-radius: 6px;
    }

    .header .nav-link:hover {
        background: var(--bg-card);
    }

    .header .nav-link::after {
        display: none;
    }
}

/* ===========================================
   HERO SECTION
   =========================================== */
.hero-section {
    padding-top: 80px; /* Account for fixed header */
    min-height: 100vh !important;
    min-height: 100dvh !important; /* Dynamic viewport height for mobile */
    position: relative;
    display: flex;
    align-items: center;
    width: 100% !important;
    background: var(--bg-deep) !important; /* Override gray background from styles.css */
}

.hero-carousel {
    height: auto !important;
    min-height: calc(100vh - 80px) !important;
    min-height: calc(100dvh - 80px) !important;
    width: 100% !important;
}

.hero-carousel .carousel-inner {
    height: 100% !important;
    min-height: calc(100vh - 80px) !important;
    min-height: calc(100dvh - 80px) !important;
    width: 100% !important;
}

.hero-carousel .carousel-inner .carousel-item,
.hero-carousel .carousel-item {
    height: auto !important;
    min-height: calc(100vh - 80px) !important;
    min-height: calc(100dvh - 80px) !important;
    width: 100% !important;
    max-width: none !important;
}

/* Ensure carousel-item.item-1 background covers full width */
/* Override styles.css which has background-size: contain for item-1 */
.hero-carousel .carousel-item.item-1,
.hero-carousel .carousel-inner .item-1 {
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
}

/* Ensure hero doesn't overflow on very short viewports */
@media (max-height: 500px) {
    .hero-section {
        min-height: auto;
        padding: 100px 0 40px;
    }

    .hero-carousel,
    .hero-carousel .carousel-inner,
    .hero-carousel .carousel-item {
        min-height: auto;
    }
}

.hero-carousel .carousel-item {
    background-size: cover !important;
    background-position: center center !important;
    position: relative;
}

/* Dark overlay for better text readability */
.hero-carousel .carousel-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(15, 20, 25, 0.9) 0%,
        rgba(15, 20, 25, 0.7) 50%,
        rgba(15, 20, 25, 0.5) 100%
    );
    z-index: 1;
}

.hero-carousel .item-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    align-items: center;
}

.hero-carousel .carousel-item-main {
    width: 100%;
}

.hero-carousel .item-content-inner {
    padding: 2rem 0;
}

/* Hero heading */
.hero-carousel .heading {
    font-family: var(--font-mono) !important;
    font-size: 3.5rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin-bottom: 1rem;
    text-shadow: 0 0 40px rgba(0, 212, 255, 0.3);
}

.hero-carousel .heading::before {
    content: '>';
    color: var(--accent-cyan);
    margin-right: 0.5rem;
    font-weight: 400;
}

/* Hero intro text */
.hero-carousel .intro {
    font-family: var(--font-body) !important;
    font-size: 1.25rem !important;
    color: var(--text-muted) !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin-bottom: 2rem;
    max-width: 500px;
}

/* Hero buttons container */
.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 1rem;
}

/* Hero CTA buttons */
.hero-buttons .btn-cta {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    height: 52px;
    padding: 0 2rem !important;
    font-family: var(--font-body) !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-sizing: border-box;
    text-decoration: none;
}

/* Primary CTA button (Download Software) */
.hero-buttons .btn-primary.btn-cta {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal)) !important;
    border: 2px solid transparent !important;
    color: var(--bg-deep) !important;
}

/* Ensure spans inside download button don't break layout */
.hero-buttons .btn-cta .btn-text,
.hero-buttons .btn-cta .btn-loading {
    display: inline-flex;
    align-items: center;
}

/* Shine animation on hover */
.hero-buttons .btn-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.hero-buttons .btn-cta:hover {
    transform: translateY(-3px);
    box-shadow: var(--glow-cyan-strong);
    text-decoration: none;
}

.hero-buttons .btn-cta:hover::before {
    left: 100%;
}

/* Secondary/Outline button in hero */
.hero-buttons .btn-outline-light.btn-cta {
    background: transparent !important;
    border: 2px solid var(--accent-cyan) !important;
    color: var(--accent-cyan) !important;
}

.hero-buttons .btn-outline-light.btn-cta:hover {
    background: var(--accent-cyan) !important;
    color: var(--bg-deep) !important;
    box-shadow: var(--glow-cyan);
}

/* Responsive hero */
@media (max-width: 768px) {
    .hero-carousel .heading {
        font-size: 2rem !important;
    }

    .hero-carousel .intro {
        font-size: 1rem !important;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }

    .hero-buttons .btn-cta {
        width: 100%;
        height: 48px;
    }
}

/* ===========================================
   ABOUT SECTION
   =========================================== */
.about-section {
    background: var(--bg-surface) !important;
    padding: 6rem 0 !important;
    position: relative;
}

/* Circuit pattern background */
.about-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px),
        linear-gradient(var(--border-subtle) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.2;
    pointer-events: none;
}

.about-section .container {
    position: relative;
    z-index: 1;
}

.about-section .item-inner {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    padding: 2rem;
    box-shadow: var(--shadow-card);
}

.about-section .figure-holder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.about-section .figure-image {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.about-section .item-title {
    font-family: var(--font-mono) !important;
    color: var(--accent-cyan) !important;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.about-section h6.item-title {
    font-size: 1rem !important;
    color: var(--accent-teal) !important;
    margin-top: 1.5rem;
}

.about-section .item-desc {
    color: var(--text-muted);
    line-height: 1.7;
}

.about-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.about-section ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.about-section ul li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}

/* Mobile: Show text content first, then image */
@media (max-width: 767px) {
    .about-section .item-inner {
        padding: 1.5rem;
    }

    .about-section .item-inner .row {
        flex-direction: column-reverse;
    }

    .about-section .figure-holder {
        margin-top: 2rem;
    }

    .about-section .item-title {
        font-size: 1.25rem;
    }
}

/* ===========================================
   SPECIFICATIONS / TESTIMONIALS SECTION
   =========================================== */
.testimonials-section {
    background: var(--bg-deep) !important;
    padding: 6rem 0 !important;
    position: relative;
    overflow: hidden;
}

/* Ambient glow effect */
.testimonials-section::before {
    content: '';
    position: absolute;
    top: 50%;
    right: -200px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.1) 0%, transparent 70%);
    transform: translateY(-50%);
    pointer-events: none;
}

.testimonials-section .container {
    position: relative;
    z-index: 1;
}

.testimonials-section .whyjtagfinder-main {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.testimonials-section .section-title {
    font-family: var(--font-mono) !important;
    font-size: 2rem !important;
    color: var(--text-primary) !important;
    margin-bottom: 1rem;
}

.testimonials-section .section-title::before {
    content: '// ';
    color: var(--accent-cyan);
}

.testimonials-section .intro {
    color: var(--text-muted) !important;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.testimonials-section .item-title {
    font-family: var(--font-mono) !important;
    color: var(--accent-teal) !important;
    font-size: 1rem !important;
}

.testimonials-section .item-desc {
    color: var(--text-muted);
    padding-left: 1rem;
    border-left: 2px solid var(--border-subtle);
    margin-bottom: 1rem;
}

/* Product image with glow */
.testimonials-section .figure-holder {
    position: relative;
    padding: 2rem;
}

.testimonials-section .figure-image {
    max-width: 100%;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5));
    transition: transform 0.5s ease;
}

.testimonials-section .figure-holder:hover .figure-image {
    transform: scale(1.05);
}

/* Cyan glow beneath product */
.testimonials-section .figure-holder::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 100px;
    background: radial-gradient(ellipse at center, rgba(0, 212, 255, 0.2) 0%, transparent 70%);
    filter: blur(30px);
    pointer-events: none;
}

/* Mobile: Text first, image second in specs section */
@media (max-width: 767px) {
    .testimonials-section .whyjtagfinder-main {
        flex-direction: column;
    }

    .testimonials-section .whyjtagfinder-main .col-lg-6:first-child {
        order: 1;
    }

    .testimonials-section .whyjtagfinder-main .figure-holder {
        order: 2;
    }

    .testimonials-section .section-title {
        font-size: 1.5rem !important;
    }

    .testimonials-section .figure-holder {
        padding: 1rem;
    }
}

/* ===========================================
   CONTACT / CTA SECTION
   =========================================== */
.contact-section {
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card) 100%) !important;
    padding: 6rem 0 !important;
    position: relative;
    overflow: hidden;
}

/* Decorative elements */
.contact-section::before {
    content: '';
    position: absolute;
    top: -100px;
    left: -100px;
    width: 300px;
    height: 300px;
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    opacity: 0.3;
}

.contact-section::after {
    content: '';
    position: absolute;
    bottom: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    border: 1px solid var(--accent-cyan);
    border-radius: 50%;
    opacity: 0.2;
}

.contact-section .container {
    position: relative;
    z-index: 1;
}

.contact-section .section-title {
    font-family: var(--font-mono) !important;
    font-size: 2.5rem !important;
    color: var(--text-primary) !important;
    margin-bottom: 1.5rem;
}

.contact-section .contact-content {
    max-width: 700px;
    margin: 0 auto 2rem;
}

.contact-section .contact-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.8;
}

.contact-section .btn-cta {
    background: linear-gradient(135deg, var(--accent-success), #00cc6a) !important;
    border: none !important;
    color: var(--bg-deep) !important;
    font-family: var(--font-body) !important;
    font-weight: 600 !important;
    padding: 1rem 2.5rem !important;
    font-size: 1rem !important;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.contact-section .btn-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.4);
}

@media (max-width: 768px) {
    .contact-section .section-title {
        font-size: 1.75rem !important;
    }
}

/* ===========================================
   FOOTER
   =========================================== */
.footer {
    background: var(--bg-deep) !important;
    border-top: 1px solid var(--border-subtle);
    padding: 2rem 0 !important;
}

.footer .footer-links {
    margin-bottom: 1rem;
}

.footer .footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.footer .footer-links a:hover {
    color: var(--accent-cyan);
}

.footer .copyright {
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

/* ===========================================
   BUTTONS GLOBAL
   =========================================== */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal)) !important;
    border: none !important;
    color: var(--bg-deep) !important;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background: linear-gradient(135deg, var(--accent-teal), var(--accent-cyan)) !important;
    transform: translateY(-2px);
    box-shadow: var(--glow-cyan);
}

/* ===========================================
   SCROLLBAR STYLING
   =========================================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan);
}

/* ===========================================
   ANIMATIONS
   =========================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Elements start invisible, animate when .animate class is added via JS */
.about-section .item-inner,
.testimonials-section .whyjtagfinder-main,
.contact-section .container > * {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.about-section .item-inner.animate,
.testimonials-section .whyjtagfinder-main.animate,
.contact-section .container.animate > * {
    opacity: 1;
    transform: translateY(0);
}

/* Fallback: If JS fails, ensure content is visible */
.no-js .about-section .item-inner,
.no-js .testimonials-section .whyjtagfinder-main,
.no-js .contact-section .container > * {
    opacity: 1;
    transform: none;
}

/* ===========================================
   REDUCED MOTION PREFERENCE
   =========================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Still show content when reduced motion is preferred */
    .about-section .item-inner,
    .testimonials-section .whyjtagfinder-main,
    .contact-section .container > * {
        opacity: 1;
        transform: none;
    }

    .hero-carousel .btn-cta:hover,
    .testimonials-section .figure-holder:hover .figure-image {
        transform: none;
    }
}

/* ===========================================
   UTILITY CLASSES
   =========================================== */
.text-cyan {
    color: var(--accent-cyan) !important;
}

.text-teal {
    color: var(--accent-teal) !important;
}

.bg-surface {
    background: var(--bg-surface) !important;
}

.bg-card {
    background: var(--bg-card) !important;
}

/* ===========================================
   BACK TO TOP BUTTON
   =========================================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--accent-cyan);
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.back-to-top:hover {
    background: var(--accent-cyan);
    color: var(--bg-deep);
    border-color: var(--accent-cyan);
    box-shadow: var(--glow-cyan);
    transform: translateY(-3px);
}

.back-to-top:focus {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}

/* Mobile positioning */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }
}

/* ===========================================
   DOWNLOAD BUTTON LOADING STATE
   =========================================== */
#download-btn {
    min-width: 200px;
    text-align: center;
}

#download-btn .btn-loading {
    display: inline-flex;
    align-items: center;
}

#download-btn .fa-spinner {
    animation: spin 1s linear infinite;
}

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

/* ===========================================
   PRINT STYLES
   =========================================== */
@media print {
    .header,
    .footer,
    .hero-carousel .btn-cta {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    h1, h2, h3, h4, h5, h6 {
        color: black !important;
    }

    p, .item-desc, .intro {
        color: #333 !important;
    }

    .hero-section {
        min-height: auto !important;
        padding: 2rem 0 !important;
    }

    .about-section,
    .testimonials-section,
    .contact-section {
        background: white !important;
        padding: 2rem 0 !important;
    }

    .about-section::before,
    .testimonials-section::before,
    .contact-section::before,
    .contact-section::after {
        display: none;
    }

    .about-section .item-inner,
    .testimonials-section .whyjtagfinder-main {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ===========================================
   HIGH CONTRAST MODE
   =========================================== */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #ffffff;
        --text-muted: #e0e0e0;
        --border-subtle: #555555;
        --accent-cyan: #00ffff;
    }

    .header .nav-link,
    .about-section .item-desc,
    .testimonials-section .item-desc,
    .contact-section .contact-content p {
        color: var(--text-muted) !important;
    }

    a:focus,
    button:focus,
    .btn:focus {
        outline-width: 3px;
    }
}
