/**
 * Rapid Texter TUI - Components
 * Reusable UI components matching the TUI aesthetic
 */

/* ========================================================================
 * ICON SYSTEM
 * ======================================================================== */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    vertical-align: middle;
    line-height: 1;
}

.icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.icon-sm {
    width: var(--icon-size-sm);
    height: var(--icon-size-sm);
}

.icon-md {
    width: var(--icon-size-md);
    height: var(--icon-size-md);
}

.icon-lg {
    width: var(--icon-size-lg);
    height: var(--icon-size-lg);
}

.icon-xl {
    width: var(--icon-size-xl);
    height: var(--icon-size-xl);
}

.icon-xxl {
    width: var(--icon-size-xxl);
    height: var(--icon-size-xxl);
}

/* ========================================================================
 * NAVBAR
 * ======================================================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--status-bar-height);
    background-color: rgba(12, 12, 12, 0.95);
    border-bottom: 1px solid var(--border-primary);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    font-family: var(--font-family);
    transition: all 0.3s ease;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.navbar-brand {
    font-weight: bold;
    font-size: var(--font-size-l);
    color: var(--text-primary);
    letter-spacing: 0.5px;
    display: flex;
    gap: 5px;
}

.brand-rapid {
    color: var(--accent-blue);
}

.brand-texter {
    color: var(--text-primary);
}

.navbar-menu {
    display: flex;
    list-style: none;
    gap: var(--spacing-xl);
}

.navbar-menu a {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.navbar-menu a .icon {
    color: var(--accent-blue);
    opacity: 0.7;
    width: 14px;
    height: 14px;
}

.navbar-menu a:hover {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
    text-decoration: none;
}

.navbar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-secondary);
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
    align-items: center;
    justify-content: center;
}

/* ========================================================================
 * BUTTONS (Strict TUI Blocky Style)
 * ======================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-m) var(--spacing-xl);
    font-family: var(--font-family);
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid var(--border-secondary);
    background: transparent;
    cursor: pointer;
    gap: 12px;
    position: relative;
    border-radius: 0;
    /* Kotak */
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    letter-spacing: 0.5px;
    line-height: 1;
    text-decoration: none;
}

/* FIX: Giant Icons Strict Rule */
.btn .icon,
.btn svg {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
    max-width: 18px;
    display: block;
}

.btn:hover {
    text-decoration: none;
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--border-secondary);
}

.btn:active {
    transform: translate(0, 0);
    box-shadow: none;
}

.btn-primary {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.btn-primary:hover {
    background-color: var(--accent-green);
    color: #000;
    box-shadow: 4px 4px 0 rgba(22, 198, 12, 0.5);
}

.btn-blue {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.btn-blue:hover {
    background-color: var(--accent-blue);
    color: #000;
    box-shadow: 4px 4px 0 rgba(59, 142, 234, 0.5);
}

.btn-lg {
    font-size: var(--font-size-l);
    padding: var(--spacing-l) var(--spacing-xxl);
}

.btn-block {
    width: 100%;
}

/* ========================================================================
 * HERO SECTION (Presisi Layout)
 * ======================================================================== */
.hero {
    /* Menggunakan min-height 100vh agar full screen */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    /* Padding Calculation: Navbar Height + Spacing. Ini kunci agar center visual */
    padding: calc(var(--status-bar-height) + var(--spacing-huge)) var(--spacing-l) var(--spacing-huge);
    position: relative;
    overflow: hidden;
}

.hero-content {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.ascii-art {
    /* STRICT MONOSPACE STACK */
    font-family: 'Cascadia Code', 'Menlo', 'Monaco', 'Courier New', monospace;
    
    /* Responsive Font Size for Mobile First */
    font-size: clamp(6px, 1.8vw, 14px);
    line-height: 1.0; /* Strict line-height to prevent vertical gaps */
    
    margin-bottom: var(--spacing-l);
    white-space: pre;
    color: var(--accent-blue);
    font-weight: bold;
    display: inline-block;
    text-align: center;
    max-width: 100%;
    
    /* PREVENT RENDERING GLITCHES */
    overflow-x: hidden;
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0;
    -webkit-font-smoothing: none; /* Sharper pixelation for ASCII */
    letter-spacing: 0;
}

@media (min-width: 768px) {
    .ascii-art {
        font-size: 14px;
        line-height: 14px;
    }
}

.logo-subtitle {
    letter-spacing: 4px;
    color: var(--text-muted);
    margin-top: -10px;
    margin-bottom: var(--spacing-xl);
    font-weight: 600;
}

.hero-tagline {
    font-size: var(--font-size-xl);
    max-width: 700px;
    margin: 0 auto var(--spacing-xl);
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    gap: var(--spacing-m);
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: var(--spacing-xl);
}

/* Scroll CTA */
.scroll-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    animation: bounce 2s infinite;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.scroll-cta .icon {
    width: 16px;
    height: 16px;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(5px);
    }
}

/* ========================================================================
 * TECH BADGES
 * ======================================================================== */
.tech-badges {
    display: flex;
    gap: var(--spacing-m);
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: var(--spacing-xl);
}

.tech-badge {
    border: 1px solid var(--border-secondary);
    padding: 6px 12px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    background: var(--bg-primary);
    border-radius: 0;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tech-badge:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.tech-badge .icon {
    color: var(--accent-blue);
    width: 14px;
    height: 14px;
}

/* ========================================================================
 * FEATURES & CARDS
 * ======================================================================== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--spacing-l);
}

.feature-card {
    border: 1px solid var(--border-secondary);
    padding: var(--spacing-xl);
    background: var(--bg-primary);
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--spacing-m);
    border-radius: 0;
}

.feature-card::before {
    content: '+';
    position: absolute;
    top: -9px;
    left: -6px;
    background: var(--bg-primary);
    padding: 0 2px;
    color: var(--border-secondary);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 6px 6px 0 var(--bg-tertiary);
}

/* Border Variants */
.tui-border-blue {
    border-color: var(--accent-blue);
}

.tui-border-blue:hover {
    box-shadow: 6px 6px 0 rgba(59, 142, 234, 0.2);
}

.tui-border-blue::before {
    color: var(--accent-blue);
}

.tui-border-green {
    border-color: var(--accent-green);
}

.tui-border-green:hover {
    box-shadow: 6px 6px 0 rgba(22, 198, 12, 0.2);
}

.tui-border-green::before {
    color: var(--accent-green);
}

.tui-border-yellow {
    border-color: var(--accent-yellow);
}

.tui-border-yellow:hover {
    box-shadow: 6px 6px 0 rgba(249, 241, 165, 0.2);
}

.tui-border-yellow::before {
    color: var(--accent-yellow);
}

.tui-border-default {
    border-color: var(--border-secondary);
}

.feature-badge {
    color: var(--text-muted);
    font-weight: bold;
    font-size: var(--font-size-xs);
    position: absolute;
    top: 10px;
    right: 12px;
}

.feature-text {
    font-size: var(--font-size-l);
    font-weight: 600;
}

/* ========================================================================
 * CAROUSEL
 * ======================================================================== */
.carousel {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.carousel-track-container {
    background: transparent;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-secondary);
    box-shadow: 10px 10px 0 var(--bg-tertiary);
}

.carousel-track {
    display: flex;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.carousel-slide {
    min-width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.carousel-slide img {
    width: 100%;
    display: block;
    cursor: pointer;
}

.carousel-progress {
    width: 100%;
    height: 3px;
    background-color: var(--border-primary);
    overflow: hidden;
}

.carousel-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-green);
    transition: width linear;
}

.carousel-slide-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(12, 12, 12, 0.7);
    padding: var(--spacing-l);
    border-top: none;
    backdrop-filter: blur(3px);
}

.carousel-slide-caption h4 {
    color: var(--accent-blue);
    margin-bottom: 5px;
    font-size: var(--font-size-l);
}

.carousel-slide-caption p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0;
}

.carousel-nav-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 22px;
    border-radius: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-nav-btn:hover {
    background: var(--accent-blue);
    color: #000;
}

.carousel-nav-btn .icon {
    width: 20px;
    height: 20px;
}

.carousel-nav {
    position: absolute;
    top: 45%;
    transform: translateY(-50%);
    z-index: 20;
}

.carousel-nav-prev {
    left: -60px;
}

.carousel-nav-next {
    right: -60px;
}

/* Thumbnails */
.carousel-thumbnails {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.carousel-thumbnail {
    width: 70px;
    height: 45px;
    border: 2px solid transparent;
    opacity: 0.5;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
}

.carousel-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-thumbnail:hover {
    opacity: 0.8;
}

.carousel-thumbnail.active {
    opacity: 1;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 2px rgba(22, 198, 12, 0.2);
}

/* ========================================================================
 * DOWNLOAD & STATS
 * ======================================================================== */
.stats-row {
    display: flex;
    justify-content: space-around;
    padding: var(--spacing-l) 0;
    flex-wrap: wrap;
    gap: var(--spacing-l);
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 3rem;
    color: var(--accent-blue);
    font-weight: bold;
    line-height: 1;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-value .icon {
    width: 1em;
    height: 1em;
}

.stat-label {
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-l);
    margin-top: var(--spacing-huge);
}

.download-card {
    border: 1px solid;
    padding: var(--spacing-xl);
    text-align: center;
    border-radius: 0;
    transition: all 0.2s ease;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.download-card:hover {
    transform: translate(-4px, -4px);
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.5);
}

.download-icon {
    margin-bottom: var(--spacing-m);
    display: inline-flex;
}

/* ========================================================================
 * HOW TO USE
 * ======================================================================== */
.step-item {
    display: flex;
    gap: var(--spacing-xl);
    padding: var(--spacing-l);
    border: 1px solid var(--border-secondary);
    margin-bottom: var(--spacing-m);
    border-radius: 0;
    background: var(--bg-primary);
    transition: all 0.2s ease;
    align-items: flex-start;
}

.step-item:hover {
    border-color: var(--accent-yellow);
    box-shadow: 6px 6px 0 rgba(249, 241, 165, 0.1);
}

.step-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-muted);
    opacity: 0.3;
    line-height: 1;
    min-width: 60px;
}

.terminal-list {
    list-style: none;
    margin-top: 15px;
    padding-left: 0;
}

.terminal-list li {
    margin-bottom: 8px;
    color: var(--text-secondary);
    display: flex;
    gap: 10px;
}

.terminal-list li::before {
    content: '>';
    color: var(--accent-green);
    font-weight: bold;
}

/* ========================================================================
 * FOOTER
 * ======================================================================== */
.footer {
    border-top: 1px dashed var(--border-secondary);
    padding: var(--spacing-xl) 0;
    text-align: center;
    background: var(--bg-secondary);
}

.footer-logo {
    font-weight: bold;
    margin-bottom: var(--spacing-m);
    color: var(--text-primary);
    letter-spacing: 2px;
}

.footer-links {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-l);
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

/* Code Block */
.code-block {
    font-family: var(--font-family);
    background: var(--bg-tertiary);
    padding: var(--spacing-l);
    border: 1px solid var(--border-secondary);
    margin-top: var(--spacing-m);
    overflow-x: auto;
    font-size: var(--font-size-sm);
    text-align: left;
}

.code-block .comment {
    color: var(--text-muted);
}

.code-block .command {
    color: var(--accent-green);
    display: block;
    margin-top: 5px;
}

.code-block .command::before {
    content: '$ ';
    color: var(--text-secondary);
}

/* ========================================================================
 * LIGHTBOX
 * ======================================================================== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lightbox img {
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.lightbox.active img {
    transform: scale(1);
}

/* ========================================================================
 * RESPONSIVE ADJUSTMENTS
 * ======================================================================== */
@media (max-width: 768px) {
    .navbar-menu {
        display: none;
        position: absolute;
        top: var(--status-bar-height);
        left: 0;
        right: 0;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-secondary);
        flex-direction: column;
        padding: 20px;
        gap: 15px;
    }

    .navbar-menu.active {
        display: flex;
    }

    /* Hide Thumbnails on Mobile */
    .carousel-thumbnails {
        display: none;
    }

    /* Vertical Footer */
    .footer-links {
        flex-direction: column;
        gap: var(--spacing-s);
    }

    .navbar-toggle {
        display: flex;
    }

    /* Show Nav Buttons on Mobile (Adjusted) */
    .carousel-nav {
        display: block;
        top: 50%;
    }

    .carousel-nav-prev {
        left: -16px;
    }

    .carousel-nav-next {
        right: -16px;
    }

    .carousel-nav-btn {
        width: 32px;
        height: 32px;
        background: rgba(12, 12, 12, 0.8);
        border-color: var(--accent-blue);
    }

    .step-number {
        font-size: 1.5rem;
        margin-bottom: var(--spacing-s);
    }

    .step-item {
        flex-direction: column;
        gap: 10px;
    }

    /* Fix Tablet Layout Overflow */
    .step-content {
        min-width: 0;
        /* Flexbox shrink fix */
        width: 100%;
        /* Consume available space */
    }

    .code-block {
        max-width: 100%;
        box-sizing: border-box;
    }

    .hero {
        justify-content: center;
        padding-top: 80px;
        /* More space for mobile */
    }

    .ascii-art {
        font-size: 2.2vw;
        /* Liquid font size for persistence */
        line-height: 1.1;
        width: 100%;
        overflow-x: visible;
        /* Ensure it doesn't clip if possible, but fontsize should handle it */
    }

    .download-grid {
        grid-template-columns: 1fr;
    }
}

/* Small Mobile Optimization (320px - 480px) */
@media (max-width: 480px) {
    .navbar-menu {
        padding: 15px;
    }

    .hero {
        padding-top: 60px;
        padding-bottom: 20px;
    }

    /* Compact Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 13px;
        gap: 8px;
    }

    .btn .icon,
    .btn svg {
        width: 14px !important;
        height: 14px !important;
        min-width: 14px;
        max-width: 14px;
    }

    /* Tighter Cards */
    .feature-card,
    .download-card,
    .step-item {
        padding: 16px;
        gap: 12px;
    }

    .section-subtitle {
        font-size: 14px;
    }

    .logo-subtitle {
        font-size: 12px;
        letter-spacing: 2px;
    }

    /* Fix Lists (Stack vertically) */
    .terminal-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        border-bottom: 1px dashed var(--border-secondary);
        padding-bottom: 8px;
    }

    .terminal-list li::before {
        content: '[>]';
        /* Change arrow to block styling if needed, or keep > */
        margin-bottom: -4px;
    }

    /* Fix Stats Size */
    .stat-value {
        font-size: 2rem;
    }

    /* Icon size scales automatically with em */

    .stat-label {
        font-size: 11px;
    }

    /* Fix Code Block */
    .code-block {
        padding: 12px;
        font-size: 11px;
        max-width: 100vw;
        /* Hard limit */
        width: 100%;
        box-sizing: border-box;
        overflow-x: auto;
        /* Ensure scroll */
    }
}