* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    color: #111827;
    background: radial-gradient(circle at 10% 10%, #eef2ff 0%, #f8fafc 35%, #f8fafc 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.container {
    width: min(1140px, 94%);
    margin: 0 auto;
}

.site-header {
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(8px);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 72px;
}

.logo {
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    text-decoration: none;
}

nav a {
    margin-right: 10px;
    text-decoration: none;
    color: #334155;
    font-weight: 600;
}

.nav-left a,
.nav-right a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.support-link {
    background: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
    color: #047857 !important;
}

.nav-left a:hover,
.nav-right a:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.25);
    transform: translateY(-1px);
}

.nav-left a.active,
.nav-right a.active {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.35);
    color: #3730a3;
}

.nav-right a {
    background: #ffffff;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #ffffff;
}

.user-name {
    font-weight: 700;
    color: #0f172a;
    padding: 0 6px;
}

.hero {
    text-align: center;
    padding: 56px 0 24px;
}

.hero h1 {
    margin: 0 0 10px;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.hero p {
    margin: 0;
    color: #475569;
}

.trust-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.trust-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    font-weight: 600;
    color: #1e293b;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 22px;
    margin-bottom: 34px;
}

.product-card,
.product-detail,
.auth-form,
.cart-list,
.ad-box,
.review-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.product-card {
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.12);
}

.product-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 14px;
    border: 1px solid #e2e8f0;
}

.product-image-lg {
    height: 240px;
    max-width: 520px;
}

.prices {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 14px;
}

.old-price {
    text-decoration: line-through;
    color: #64748b;
}

.new-price {
    font-size: 1.2rem;
}

.badge {
    background: linear-gradient(135deg, #dc2626, #f97316);
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
}

.rating-line {
    display: flex;
    gap: 8px;
    align-items: center;
    color: #475569;
    margin: 8px 0;
    font-size: 0.95rem;
}

.stars {
    color: #f59e0b;
    letter-spacing: 1px;
    font-size: 1.05rem;
}

.reviews-block {
    margin-top: 20px;
}

.reviews-block .review-card {
    margin-top: 12px;
}

.review-author {
    color: #64748b;
    font-size: 0.9rem;
}

.btn {
    display: inline-block;
    background: linear-gradient(135deg, #111827, #1f2937);
    color: #fff;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn-outline {
    background: transparent;
    color: #111827;
    border: 1px solid #111827;
}

.auth-form {
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-shell {
    padding: 28px 0 40px;
}

.auth-card {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
    padding: 22px;
    backdrop-filter: blur(8px);
    max-width: 520px;
    margin: 0 auto;
}

.auth-form input,
select {
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
}

.honeypot {
    display: none;
}

.captcha-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
}

.captcha-q {
    margin: 0 0 8px;
    color: #334155;
    font-weight: 600;
    font-size: 0.95rem;
}

.captcha-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.captcha-math {
    font-weight: 800;
    color: #0f172a;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    padding: 8px 0;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inline-form {
    margin: 0;
}

.qty-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.qty-form input[type="number"] {
    width: 66px;
    padding: 4px 6px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}

.btn-small {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.remove-btn {
    border: 1px solid #ef4444;
    background: #fff;
    color: #ef4444;
    border-radius: 8px;
    padding: 4px 10px;
    cursor: pointer;
}

.site-footer {
    margin-top: 40px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    padding: 20px 0;
}

.footer-top {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.footer-link-btn {
    display: inline-block;
    text-decoration: none;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    padding: 8px 12px;
    border-radius: 10px;
    background: #f8fafc;
    font-weight: 600;
}

.legal-page {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    margin-top: 18px;
}

.legal-page h1,
.legal-page h2 {
    margin-top: 0;
}

.checkout-monopay .monopay-wrap {
    margin: 1.25rem 0;
    min-height: 48px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.feature-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    background: #f8fafc;
}

.order-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
}

.order-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-top: 1px dashed #e2e8f0;
}

textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px;
    font-family: inherit;
}

.error {
    color: #dc2626;
}

.page-title {
    font-size: 1.7rem;
    margin: 10px 0 16px;
}

.text-danger {
    color: #dc2626;
}

.cart-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 18px;
    align-items: start;
    margin-bottom: 24px;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-row {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 14px;
    display: flex;
    gap: 14px;
    align-items: center;
}

.cart-thumb {
    width: 70px;
    height: 56px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.cart-row-main {
    flex: 1;
    min-width: 0;
}

.cart-row-title {
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
}

.cart-row-unit {
    color: #475569;
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.cart-row-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.cart-row-total {
    font-weight: 900;
    color: #0f172a;
}

.cart-summary {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px;
    position: sticky;
    top: 92px;
}

.cart-summary h2 {
    margin: 0 0 12px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed #e2e8f0;
}

.summary-total {
    border-bottom: none;
}

.summary-line.summary-total {
    border-bottom: none;
    font-weight: 900;
    font-size: 1.05rem;
}

.cart-checkout {
    width: 100%;
    text-align: center;
    margin-top: 12px;
}

.cart-checkout.btn {
    display: flex;
    justify-content: center;
}

.btn-monopay {
    background: #111;
    color: #fff;
    border: 1px solid #111;
    border-radius: 12px;
    font-weight: 600;
}

.btn-monopay:hover {
    background: #222;
    color: #fff;
    border-color: #222;
}

.cart-discount-note {
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.10);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #065f46;
    font-size: 0.92rem;
}

.cart-extras {
    margin: 10px 0 22px;
}

.recommended-grid,
.bundle-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.recommended-card,
.bundle-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px;
}

.recommended-card img {
    width: 100%;
    height: 88px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    margin-bottom: 10px;
}

.recommended-title {
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
    min-height: 42px;
}

.recommended-price {
    font-weight: 900;
    margin-bottom: 10px;
}

.bundle-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.bundle-top h3 {
    margin: 0;
    font-size: 1rem;
}

.bundle-badge {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 800;
    color: #7c2d12;
    background: rgba(249, 115, 22, 0.12);
    border: 1px solid rgba(249, 115, 22, 0.32);
    border-radius: 999px;
    padding: 3px 8px;
}

.account-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 24px;
}

.account-panel {
    padding: 18px;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.24);
    color: #3730a3;
    margin-left: 10px;
    font-size: 0.9rem;
    font-weight: 700;
}

.muted {
    color: #64748b;
    font-size: 0.95rem;
    margin-top: 4px;
}

.account-reviews {
    margin-top: 16px;
}

.review-item {
    padding: 12px 0;
    border-top: 1px dashed #e2e8f0;
}

.review-item:first-child {
    border-top: none;
}

.review-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.review-product {
    font-weight: 800;
    color: #0f172a;
}

.review-comment {
    margin-top: 8px;
    color: #0f172a;
    line-height: 1.45;
}

.review-meta {
    margin-top: 8px;
    color: #64748b;
    font-size: 0.9rem;
}

.review-stars .stars {
    font-size: 1.05rem;
}

@media (max-width: 720px) {
    .nav {
        flex-wrap: wrap;
        padding: 10px 0;
    }

    .nav-right {
        width: 100%;
        justify-content: center;
        margin-left: 0;
    }

    .trust-strip {
        grid-template-columns: 1fr;
    }

    .cart-layout {
        grid-template-columns: 1fr;
    }

    .cart-summary {
        position: static;
        top: auto;
    }

    .recommended-grid,
    .bundle-grid {
        grid-template-columns: 1fr;
    }

    .account-layout {
        grid-template-columns: 1fr;
    }
}

/* Support widget */
.support-widget {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 999;
}

.support-widget-toggle {
    background: linear-gradient(135deg, #111827, #1f2937);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 12px 14px;
    font-weight: 800;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.18);
    cursor: pointer;
}

.support-widget-panel {
    width: min(420px, 92vw);
    height: min(560px, 70vh);
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 16px;
    box-shadow: 0 18px 60px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    backdrop-filter: blur(10px);
    position: absolute;
    right: 0;
    bottom: 54px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.support-widget-header {
    padding: 12px 14px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.support-widget-close {
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    color: #111827;
}

.support-widget-messages {
    padding: 12px 14px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    height: 0; /* Important for flexbox scroll containers */
    touch-action: pan-y;
    min-height: 0;
    background: radial-gradient(circle at 10% 10%, rgba(99,102,241,0.12) 0%, rgba(255,255,255,0) 50%);
}

.support-msg {
    margin: 8px 0;
    max-width: 85%;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
}

.support-msg-user {
    margin-left: auto;
    background: rgba(99,102,241,0.10);
    border-color: rgba(99,102,241,0.25);
}

.support-msg-ai {
    margin-right: auto;
    background: #ffffff;
}

.support-msg-text {
    white-space: pre-wrap;
    word-break: break-word;
    color: #0f172a;
}

.support-widget-faq {
    border-top: 1px solid #e5e7eb;
    padding: 10px 12px;
    background: #f8fafc;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.support-faq-btn {
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    color: #111827;
}

.support-faq-operator {
    grid-column: span 2;
    border-color: rgba(239,68,68,0.35);
    background: rgba(239,68,68,0.08);
    color: #b91c1c;
}

.support-widget-form {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.support-widget-form input {
    flex: 1;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    padding: 10px 12px;
    outline: none;
    font-family: inherit;
}

.support-widget-form button {
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #111827, #1f2937);
    color: #fff;
    cursor: pointer;
    font-weight: 800;
}

.reviews-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.reviews-page-link {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    text-decoration: none;
    color: #1f2937;
    background: #fff;
    font-weight: 700;
}

.reviews-page-link.active {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.12);
    color: #3730a3;
}
