/* Root Variables - Once.com Inspired */
:root {
    --primary-blue: #0066FF;
    --dark-blue: #0066FF;
    --text-white: #FFFFFF;
    --text-light: rgba(255, 255, 255, 0.85);
    --text-dim: rgba(255, 255, 255, 0.6);
    --card-bg: #0066FF;
    --card-border: #0066FF;
    --orange-accent: #FF8C42;
    --gradient-start: #0066FF;
    --gradient-end: #0066FF;
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(180deg, var(--primary-blue) 0%, var(--dark-blue) 100%);
    color: var(--text-white);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
}

/* Brand Circle Logo */
.brand-circle {
    width: 80px;
    height: 80px;
    margin: 60px auto 80px;
    animation: fadeIn 0.8s ease-out;
}

.brand-circle svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 20px rgba(255, 255, 255, 0.15));
}

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

/* Category Navigation - Pill Bar Style */
.category-nav {
    display: flex;
    justify-content: space-around;
    margin-bottom: 60px;
    flex-wrap: nowrap;
    padding: 0 20px;
    gap: 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    border-radius: 50px;
    color: var(--text-white);
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    backdrop-filter: blur(10px);
    flex: 1;
    margin: 0 0.25rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Subtle ripple effect on click */
.nav-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.nav-btn:active::before {
    width: 300px;
    height: 300px;
}

.nav-btn .emoji {
    font-size: 20px;
    transition: transform 0.3s ease;
}

.nav-btn:hover .emoji {
    transform: scale(1.1);
}

.nav-btn:hover {
    background: rgba(255, 140, 66, 0.2);
    color: var(--orange-accent);
    border-color: rgba(255, 140, 66, 0.3);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: var(--orange-accent);
    color: #fff;
    border-color: var(--orange-accent);
    box-shadow: 0 4px 20px rgba(255, 140, 66, 0.4);
    transform: translateY(-1px);
}

.nav-btn.active .emoji {
    transform: scale(1.15);
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 80px;
    animation: fadeInUp 1s ease-out 0.2s both;
}

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

.hero-title {
    font-size: clamp(36px, 8vw, 72px);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 16px;
}

.hero-title .highlight {
    background: linear-gradient(135deg, #FFB347 0%, #FF8C42 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-tagline {
    font-size: clamp(16px, 3vw, 24px);
    color: var(--text-light);
    font-weight: 400;
}

/* Products Container */
.products-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.product-section {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.product-section.active {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

/* Product Cards */
.product-card {
    background: rgba(25, 35, 75, 0.5);
    border: 2px solid var(--card-border);
    border-radius: 24px;
    padding: 32px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.6s ease-out both;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.15s; }
.product-card:nth-child(3) { animation-delay: 0.2s; }
.product-card:nth-child(4) { animation-delay: 0.25s; }
.product-card:nth-child(5) { animation-delay: 0.3s; }
.product-card:nth-child(6) { animation-delay: 0.35s; }

.product-card:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    min-height: 60px;
}

.domain-name {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.product-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: -0.01em;
    line-height: 1.3;
}

/* Badges */
.badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge.premium {
    background: var(--orange-accent);
    color: white;
}

.badge.hot {
    background: #FF4757;
    color: white;
}

.badge.bestseller {
    background: #FFD700;
    color: #001A4D;
}

.badge.new {
    background: #00D9FF;
    color: #001A4D;
}

.badge.popular {
    background: #7C3AED;
    color: white;
}

/* Features List */
.features-list {
    list-style: none;
    margin-bottom: 28px;
    flex-grow: 1;
}

.features-list li {
    font-size: 15px;
    color: var(--text-light);
    margin-bottom: 12px;
    line-height: 1.5;
}

/* Card Footer */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.price-box {
    display: flex;
    flex-direction: column;
}

.price {
    font-size: 32px;
    font-weight: 800;
    color: var(--orange-accent);
    line-height: 1;
    margin-bottom: 4px;
}

.price-label {
    font-size: 12px;
    color: var(--text-dim);
    font-weight: 500;
}

/* Buy Button */
.btn-buy {
    background: var(--orange-accent);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.btn-buy:hover {
    background: #FF7A2E;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 140, 66, 0.4);
}

.btn-buy:active {
    transform: translateY(0);
}

/* Footer */
.footer {
    text-align: center;
    padding: 80px 20px 40px;
    margin-top: 100px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-brand {
    max-width: 700px;
    margin: 0 auto;
}

.footer-brand p {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.8;
    margin-bottom: 8px;
}

.footer-brand strong {
    color: var(--text-white);
    font-weight: 600;
}

.footer-brand a {
    color: var(--text-white);
    text-decoration: underline;
    transition: opacity 0.3s ease;
}

.footer-brand a:hover {
    opacity: 0.7;
}

.footer-contact {
    margin-top: 1rem;
}

.footer-contact a {
    color: var(--orange-accent);
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.footer-contact a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 16px;
    }

    .brand-circle {
        width: 60px;
        height: 60px;
        margin: 40px auto 60px;
    }

    .category-nav {
        gap: 0;
        margin-bottom: 40px;
        flex-wrap: wrap;
        max-width: 100%;
    }

    .nav-btn {
        padding: 12px 20px;
        font-size: 14px;
        margin: 0.25rem;
        min-width: calc(50% - 0.5rem);
    }

    .nav-btn:nth-child(3) {
        flex: 1 1 100%;
        margin-top: 0.5rem;
    }

    .nav-btn .text {
        display: none;
    }

    .nav-btn .emoji {
        font-size: 24px;
    }

    .hero {
        margin-bottom: 60px;
    }

    .product-section.active {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .product-card {
        padding: 24px;
    }

    .card-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .domain-name {
        font-size: 24px;
    }

    .product-title {
        font-size: 20px;
    }

    .card-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .btn-buy {
        width: 100%;
        padding: 16px;
    }

    .footer {
        padding: 60px 20px 30px;
        margin-top: 80px;
    }
}

@media (max-width: 480px) {
    .price {
        font-size: 28px;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection Color */
::selection {
    background: var(--orange-accent);
    color: white;
}

::-moz-selection {
    background: var(--orange-accent);
    color: white;
}

/* M-PESA Modal Styles - UPDATED FOR SCROLLING */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto; /* Enable vertical scrolling */
    overflow-x: hidden;
    background-color: rgba(0, 102, 255, 0.95);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
    padding: 20px 0; /* Add padding for scroll space */
}

.modal-content {
    background: #004DBF;
    margin: 2rem auto; /* Changed from percentage to rem for better scroll behavior */
    padding: 2rem;
    border: 2px solid var(--card-border);
    border-radius: 24px;
    width: 90%;
    max-width: 550px;
    position: relative;
    animation: slideUpModal 0.4s ease;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-height: none; /* Allow content to determine height */
    margin-bottom: 2rem; /* Space at bottom when scrolling */
}

@keyframes slideUpModal {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    color: #FFFFFF;
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    background: rgba(0, 0, 0, 0.3);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-modal:hover {
    color: var(--orange-accent);
    transform: rotate(90deg);
    background: rgba(0, 0, 0, 0.5);
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-right: 3rem; /* Space for close button */
    background: linear-gradient(135deg, #FFFFFF 0%, #FFB347 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-body {
    margin-top: 1rem;
}

.product-summary {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.product-summary h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.price-summary {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0.5rem 0;
}

.product-summary small {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #fff;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 0.875rem;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--orange-accent);
    box-shadow: 0 0 20px rgba(255, 140, 66, 0.2);
    background: rgba(0, 0, 0, 0.5);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

.modal-btn {
    width: 100%;
    padding: 1.1rem;
    font-size: 1rem;
    margin-top: 1rem;
    position: relative;
    background: #30B54A;
    border: none;
    border-radius: 50px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-btn:hover:not(:disabled) {
    background: #28a03e;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(48, 181, 74, 0.4);
}

.modal-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.loader {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.payment-status {
    margin-top: 1.5rem;
}

.success-message,
.error-message,
.info-message {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease;
    line-height: 1.6;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.success-message {
    background: rgba(0, 255, 136, 0.15);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: #00ff88;
}

.error-message {
    background: rgba(255, 107, 53, 0.15);
    border: 1px solid rgba(255, 107, 53, 0.3);
    color: #ff6b35;
}

.info-message {
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: #00d4ff;
}

/* Modal Responsive */
@media (max-width: 768px) {
    .modal {
        padding: 10px 0;
    }

    .modal-content {
        margin: 1rem auto;
        padding: 1.5rem;
        width: 95%;
        margin-bottom: 1rem;
    }

    .modal-title {
        font-size: 1.4rem;
        padding-right: 2.5rem;
    }

    .close-modal {
        top: 1rem;
        right: 1rem;
        width: 36px;
        height: 36px;
        font-size: 1.5rem;
    }

    .price-summary {
        font-size: 1.6rem;
    }

    .product-summary {
        padding: 1.25rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-group input {
        padding: 0.75rem;
        font-size: 0.95rem;
    }

    .modal-btn {
        padding: 1rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 1.25rem;
    }

    .modal-title {
        font-size: 1.25rem;
    }

    .price-summary {
        font-size: 1.4rem;
    }
}

/* Ensure modal scrolls smoothly on iOS */
.modal {
    -webkit-overflow-scrolling: touch;
}