/* Reset and Base Styles */
* {
    box-sizing: border-box; /* Important for responsive padding/borders */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container {
    width: 90%; /* Changed from 80% to 90% for better mobile use */
    max-width: 1200px;
    margin: auto;
    overflow: hidden;
}

/* Header */
header {
    background: #e8491d;
    color: #fff;
    padding-top: 15px;
    padding-bottom: 15px;
    position: relative; /* For absolute positioned mobile menu */
    z-index: 9999; /* Ensure header stays on top */
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    overflow: visible; /* Allow mobile menu to be seen */
}

header a {
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 16px;
}

header ul {
    padding: 0;
    margin: 0;
    list-style: none;
    display: flex;
    align-items: center;
}

/* Menu Toggle Button (Hamburger) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

/* Custom GTranslate Dropdown Styles */
.gt-custom-select {
    position: relative;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    color: #444;
    min-width: 180px;
    z-index: 1000;
}

.gt-selected {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.gt-selected:hover {
    border-color: #aaa;
    background-color: #f8f9fa;
}

.gt-selected img {
    width: 20px;
    height: auto;
    margin-right: 10px;
    border-radius: 2px;
    box-shadow: 0 0 1px rgba(0,0,0,0.3);
}

.gt-arrow {
    margin-left: auto;
    font-size: 10px;
    color: #666;
}

.gt-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-top: 2px;
}

.gt-options.show {
    display: block;
}

.gt-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid #f5f5f5;
}

.gt-option:last-child {
    border-bottom: none;
}

.gt-option:hover {
    background-color: #f0f4f8;
    color: #000;
}

.gt-option img {
    width: 20px;
    height: auto;
    margin-right: 10px;
    border-radius: 2px;
    box-shadow: 0 0 1px rgba(0,0,0,0.3);
}

/* Scrollbar Styling for Options */
.gt-options::-webkit-scrollbar {
    width: 6px;
}
.gt-options::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.gt-options::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
.gt-options::-webkit-scrollbar-thumb:hover {
    background: #999;
}
header li {
    padding: 0 15px;
}

header #branding h1 {
    margin: 0;
}

/* Products Grid */
.products-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* Center items */
    gap: 20px;
    padding: 20px 0;
}

.product {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-align: center;
    padding: 20px;
    width: calc(33.333% - 20px); /* 3 columns by default */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.product:hover {
    transform: translateY(-5px);
}

.product img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Buttons */
.btn {
    display: inline-block;
    color: #fff;
    background: #333;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    margin-top: 10px;
    cursor: pointer;
    border: none;
    transition: background 0.3s;
}

.btn:hover {
    background: #e8491d;
}

/* Forms */
form {
    background: #fff;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #ddd;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 5px;
}

input[type="text"], input[type="email"], input[type="password"] {
    width: 100%;
    padding: 10px;
    margin: 5px 0 15px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
}

input[type="submit"] {
    width: 100%;
    background: #333;
    color: #fff;
    border: 0;
    padding: 10px;
    cursor: pointer;
    border-radius: 5px;
}

input[type="submit"]:hover {
    background: #e8491d;
}

/* Footer */
footer {
    padding: 20px;
    margin-top: 20px;
    color: #ffffff;
    background-color: #333;
    text-align: center;
}

/* Checkout Page */
.checkout-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.product-summary, .payment-methods {
    flex: 1;
    background: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.product-image {
    width: 100px;
    height: auto;
}

/* Stripe Elements */
#card-element {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    margin-bottom: 15px;
}

/* Success Page */
.success-container {
    text-align: center;
    padding: 50px 20px;
}

.success-title {
    color: green;
}

.download-box {
    margin-top: 30px;
    padding: 20px;
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    display: inline-block;
    max-width: 100%; /* Ensure it doesn't overflow on small screens */
    border-radius: 5px;
}

/* Features Section Grid */
.features-container-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
}

/* API Form Grid */
.api-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    width: 100%; /* Full width to fill the container */
    max-width: 100%; /* Ensure it spans the full container width */
    margin: 30px auto 0; /* Center the form */
}

/* Section Title */
.section-title {
    text-align: center;
    margin-bottom: 40px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.section-title h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #333;
}

.section-title p {
    font-size: 1.1rem;
    color: #666;
}

/* Scenarios Grid */
.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

/* Responsive Media Queries */
@media screen and (max-width: 768px) {
    /* Global Container Width for Mobile */
    .container {
        width: 75%;
    }

    /* Header & Navigation */
    header .container {
        /* width handled by global .container above */
        justify-content: space-between;
        align-items: center;
        position: relative;
        overflow: visible; /* Allow mobile menu to be seen */
    }

    .menu-toggle {
        display: block;
        order: 2; /* Ensure it stays on the right */
    }

    .main-nav {
        display: none !important; /* Force hide unless active */
        width: 100vw; /* Full viewport width */
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%); /* Center perfectly relative to container */
        background: #e8491d;
        z-index: 1000;
        padding-bottom: 20px;
        box-shadow: 0 10px 20px rgba(0,0,0,0.15);
        border-top: 1px solid rgba(255,255,255,0.1);
        margin-left: 0;
        margin-right: 0;
    }

    .main-nav.active {
        display: block !important;
    }

    header ul {
        flex-direction: column;
        align-items: center; /* Center items */
        width: 100%;
        padding: 10px 0;
    }

    header li {
        width: 100%;
        text-align: center;
        padding: 15px 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    header li a {
        display: block;
        font-size: 18px; /* Larger text for touch */
        text-align: center; /* Ensure text is centered */
        width: 100%;
    }

    /* Force reset any inline styles for login/register buttons in mobile menu */
    header li a[style] {
        margin: 0 auto !important;
        display: inline-block !important; /* Allow buttons to size to content but stay centered */
    }

    /* Specific fix for the login/register/profile items which might be flex containers */
    header li:has(a[style]), header li:has(.fa-user-circle) {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    /* Override inline flex styles for profile link */
    header li a .fa-user-circle {
        margin-right: 5px;
    }

    /* Adjust language selector in mobile menu */
    header li select {
        width: 80%;
        padding: 10px;
        margin: 0 auto;
        display: block;
        font-size: 16px;
    }

    /* Layout Adjustments */
    .product {
        width: 100%; /* Full width for products on mobile */
    }

    .checkout-container {
        flex-direction: column;
    }

    /* Footer Adjustments */
    footer .container {
        flex-direction: column;
        text-align: center;
    }

    footer .container > div {
        text-align: center !important;
        margin-bottom: 20px;
        width: 100%;
    }
    
    footer .container > div:last-child {
        margin-bottom: 0;
    }

    footer .container > div > div {
        justify-content: center !important;
    }
    
    /* Tables Responsive */
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Features Grid Responsive */
    .features-container-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    /* Ensure images in features are responsive if any */
    .features-container-grid img {
        max-width: 100%;
        height: auto;
        margin: 0 auto;
        display: block;
    }

    .api-form-grid {
        grid-template-columns: 1fr;
    }

    /* Constrain select width on mobile to prevent overflow */
    .api-form-item select {
        width: 100% !important;
        max-width: 100%;
        text-overflow: ellipsis;
        font-size: 14px !important; /* Smaller font for mobile */
        padding: 8px !important; /* Reduce padding */
    }
    
    /* Ensure options also have smaller font (support varies by browser) */
    .api-form-item select option {
        font-size: 14px !important;
    }

    .scenarios-grid {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }

    .scenarios-grid > div {
        width: 100%;
        max-width: 400px; /* Limit width for better centering */
    }
}
