/* ===== RESET & BASE (MOBILE FIRST ARCHITECTURE) ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-bg: #eef2ff;
    --secondary: #f472b6;
    --accent: #8b5cf6;
    --success: #22c55e;
    --warning: #f97316;
    --error: #ef4444;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --bg-white: #ffffff;
    --bg-light: #f8fafc;
    --bg-section: #f1f5f9;
    --border: #e2e8f0;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.05);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --transition: 0.3s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-white);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition);
}

ul {
    list-style: none;
}

img, svg {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* ===== UTILITIES ===== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section {
    padding: 50px 0;
}

.section__header {
    text-align: center;
    margin-bottom: 36px;
}

.section__tag {
    display: inline-block;
    padding: 5px 14px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.section__title {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 12px;
}

.section__desc {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.required {
    color: var(--error);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition);
    white-space: nowrap;
    border: 2px solid transparent;
}

.btn--primary {
    background: var(--primary);
    color: #fff;
}

.btn--primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.btn--outline {
    border-color: var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn--outline:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
}

.btn--lg {
    padding: 14px 28px;
    font-size: 0.9375rem;
}

.btn--sm {
    padding: 8px 14px;
    font-size: 0.8125rem;
}

.btn--full {
    width: 100%;
}

/* ===== HEADER ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.header__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.header__logo-icon {
    width: 32px;
    height: 32px;
}

.header__menu {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header__link {
    display: block;
    padding: 8px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}

.header__link:hover,
.header__link.active {
    color: var(--primary);
    background: var(--primary-bg);
}

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

.header__cart-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: var(--primary-bg);
    color: var(--primary);
}

.header__cart-btn svg {
    width: 18px;
    height: 18px;
}

.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--error);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-white);
}

.header__cta {
    display: none;
}

.header__hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 4px;
    z-index: 1001;
}

.header__hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition);
}

.header__hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.header__hamburger.active span:nth-child(2) {
    opacity: 0;
}

.header__hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Nav Drawer */
.header__nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 260px;
    height: 100vh;
    background: var(--bg-white);
    box-shadow: -4px 0 25px rgba(0,0,0,0.1);
    padding: 80px 20px 20px;
    transition: right var(--transition);
    z-index: 1000;
}

.header__nav.active {
    right: 0;
}

.header__menu {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.header__menu li {
    width: 100%;
}

.header__menu .header__link {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.9375rem;
}

/* ===== HERO ===== */
.hero {
    padding-top: 90px;
    padding-bottom: 40px;
    background: linear-gradient(135deg, var(--bg-white) 0%, var(--primary-bg) 100%);
}

.hero__container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    text-align: center;
}

.hero__badge {
    display: inline-block;
    padding: 6px 14px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.hero__title {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
}

.hero__desc {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

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

.hero__image {
    display: flex;
    justify-content: center;
    order: -1;
}

.hero__illustration {
    width: 100%;
    max-width: 340px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* ===== PRODUCTS ===== */
.products {
    background: var(--bg-light);
}

.products__filter {
    display: flex;
    justify-content: flex-start;
    overflow-x: auto;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

.products__filter::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: var(--bg-white);
    border: 1px solid var(--border);
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.products__search {
    max-width: 100%;
    margin-bottom: 24px;
    position: relative;
}

.products__search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.products__search-input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-white);
    font-size: 0.875rem;
    outline: none;
}

.products__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.product-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.product-card.hidden {
    display: none;
}

.product-card__image {
    position: relative;
    height: 220px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.product-card__badge--hot { background: var(--secondary); }

.product-card__content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-card__name {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.product-card__desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    flex: 1;
}

.product-card__footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-card__price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-card__price {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
}

.product-card__actions {
    display: flex;
    gap: 8px;
}

.product-card__actions .btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.78rem;
}

/* ===== WHY US ===== */
.why-us__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.why-us__card {
    text-align: center;
    padding: 24px 16px;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.why-us__icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
}

.why-us__title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.why-us__desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ===== CONTACT ===== */
.contact__grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.contact__info-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    border: 1px solid var(--border);
}

.contact__info-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.contact__info-item h4 {
    font-size: 0.875rem;
    font-weight: 600;
}

.contact__info-item p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.contact__form {
    background: var(--bg-light);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.form__group {
    margin-bottom: 16px;
}

.form__label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.form__input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    font-size: 0.875rem;
    outline: none;
}

.form__textarea {
    resize: vertical;
    min-height: 100px;
}

.form__error {
    font-size: 0.75rem;
    color: var(--error);
    margin-top: 4px;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--text-primary);
    color: #cbd5e1;
    padding: 40px 0 0;
}

.footer__grid {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.footer__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
}

.footer__logo-icon {
    width: 32px;
    height: 32px;
}

.footer__text {
    font-size: 0.875rem;
    color: #94a3b8;
}

.footer__heading {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
}

.footer__links ul li,
.footer__contact ul li {
    margin-bottom: 8px;
    font-size: 0.875rem;
    color: #94a3b8;
}

.footer__social-links {
    display: flex;
    gap: 10px;
}

.footer__social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.08);
    color: #94a3b8;
}

.footer__social-link svg {
    width: 18px;
    height: 18px;
}

.footer__bottom {
    padding: 16px 0;
    text-align: center;
    font-size: 0.8125rem;
    color: #64748b;
}

/* ===== BACK TO TOP ===== */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
    z-index: 900;
}

.back-to-top svg { width: 20px; height: 20px; }
.back-to-top.visible { opacity: 1; visibility: visible; }

/* ===== TOAST ===== */
.toast {
    position: fixed;
    top: 74px;
    right: 16px;
    left: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--bg-white);
    border-left: 4px solid var(--success);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.toast.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.toast__content { display: flex; align-items: center; gap: 8px; }
.toast__icon { width: 20px; height: 20px; color: var(--success); }
.toast__message { font-size: 0.875rem; font-weight: 500; }
.toast__close { font-size: 1.2rem; color: var(--text-muted); }

/* ===== CART DRAWER ===== */
.cart-overlay, .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.cart-overlay.active, .modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: var(--bg-white);
    z-index: 1501;
    display: flex;
    flex-direction: column;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-drawer.active { right: 0; }

.cart-drawer__header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-drawer__header h3 { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.cart-drawer__close { font-size: 1.5rem; color: var(--text-muted); }

.cart-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-empty { text-align: center; padding: 40px 16px; color: var(--text-muted); }
.cart-empty svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.4; }

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    align-items: center;
}

.cart-item__img {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.cart-item__info { flex: 1; }
.cart-item__name { font-size: 0.875rem; font-weight: 600; margin-bottom: 2px; }
.cart-item__price { font-size: 0.8125rem; font-weight: 700; color: var(--primary); }

.cart-item__qty { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.cart-item__qty-btn { width: 24px; height: 24px; border-radius: 4px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 700; background: #fff; }
.cart-item__qty-num { font-size: 0.8125rem; font-weight: 600; min-width: 18px; text-align: center; }
.cart-item__remove { font-size: 1.2rem; color: var(--text-muted); padding: 4px; }

.cart-drawer__footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-light);
}

.cart-drawer__summary { display: flex; justify-content: space-between; margin-bottom: 12px; font-weight: 600; }
.cart-drawer__total-price { font-size: 1.2rem; color: var(--primary); font-weight: 800; }
.cart-drawer__btns { display: flex; gap: 10px; }

/* ===== MODAL BOX (Auth / Admin Product) ===== */
.modal-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 1501;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close { font-size: 1.5rem; color: var(--text-muted); }

.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ===== ADMIN DASHBOARD STYLES ===== */
.admin-page { background: var(--bg-light); }
.admin-header { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.admin-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 24px; padding-bottom: 4px; }
.admin-tab { padding: 10px 18px; border-radius: var(--radius-full); background: var(--bg-white); border: 1px solid var(--border); font-weight: 600; font-size: 0.875rem; color: var(--text-secondary); white-space: nowrap; }
.admin-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.admin-panel { display: none; }
.admin-panel.active { display: block; }

.table-responsive { overflow-x: auto; background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.admin-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.875rem; }
.admin-table th, .admin-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.admin-table th { background: var(--bg-light); font-weight: 700; }

.system-cards { display: grid; grid-template-columns: 1fr; gap: 16px; }
.system-card { padding: 20px; background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--border); text-align: center; }
.system-card__icon { font-size: 2rem; margin-bottom: 10px; }
.system-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.system-card p { font-size: 0.8125rem; color: var(--text-secondary); margin-bottom: 12px; }
.system-badge { display: inline-block; padding: 4px 12px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.system-badge.success { background: #dcfce7; color: #15803d; }

/* ===== MEDIA QUERIES (DESKTOP & TABLET ENHANCEMENTS) ===== */

#authHeaderWidget > div { flex-wrap: wrap; }
@media (max-width: 1100px) {
    body.signed-in .header__container { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
    body.signed-in .header__logo { flex-shrink: 0; white-space: nowrap; }
    body.signed-in .header__actions { order: 3; flex-basis: 100%; justify-content: flex-end; }
    body.signed-in .header__cta { display: none; }
    body.signed-in .hero { padding-top: 160px; }
}
@media (max-width: 480px) {
    body.signed-in .auth-user-name { display: none; }
    body.signed-in #authHeaderWidget .btn { padding: 7px 9px; }
}

@media (min-width: 768px) {
    body { font-size: 16px; }
    .container { padding: 0 20px; }
    .section { padding: 80px 0; }
    .section__title { font-size: 2.2rem; }
    
    .header__container { height: 72px; }
    .header__logo-icon { width: 36px; height: 36px; }
    .header__logo { font-size: 1.35rem; }
    .header__nav { position: static; width: auto; height: auto; background: transparent; box-shadow: none; padding: 0; }
    .header__menu { flex-direction: row; gap: 8px; }
    .header__hamburger { display: none; }
    .header__cta { display: inline-flex; }
    
    .hero { padding-top: 120px; padding-bottom: 60px; }
    .hero__container { display: grid; grid-template-columns: 1fr 1fr; text-align: left; gap: 40px; align-items: center; }
    .hero__title { font-size: 2.8rem; }
    .hero__actions { flex-direction: row; }
    .hero__image { order: 0; }
    .hero__illustration { max-width: 480px; }

    .products__grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
    .why-us__grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
    
    .contact__grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 50px; }

    .footer__grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; }
    .toast { left: auto; width: auto; max-width: 400px; }

    .admin-header { flex-direction: row; justify-content: space-between; align-items: center; }
    .system-cards { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
    .products__grid { grid-template-columns: repeat(3, 1fr); }
    .why-us__grid { grid-template-columns: repeat(4, 1fr); }
}
