/* =========================
   RESET & BASE
========================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    background: beige;
    color: #2c3e50;
    line-height: 1.5;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

/* =========================
   HEADER / NAVBAR
========================= */

.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;

    display: flex;
    flex-direction: column;
    align-items: center;

    width: 100%;
    padding: clamp(16px, 3vw, 24px) clamp(14px, 4vw, 30px);

    background: #2c3e50;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.store-title {
    margin: 0 0 clamp(14px, 2vw, 18px);

    text-align: center;
    font-size: clamp(2.5rem, 4vw, 3rem);
    font-weight: 800;
    line-height: 1.0;
}

.navbar nav {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: clamp(8px, 2vw, 18px);

    width: 100%;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: clamp(110px, 16vw, 150px);
    min-height: 44px;
    padding: 11px clamp(14px, 2.5vw, 26px);

    border-radius: 10px;

    background: #3498db;
    color: #fff;

    font-size: clamp(0.9rem, 1.7vw, 1.1rem);
    font-weight: 700;
    text-align: center;
    text-decoration: none;

    transition:
        background 0.3s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.nav-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.nav-btn.active {
    background: #1abc9c;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* =========================
   ACCESSIBILITY / FOCUS
========================= */

.nav-btn:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(52, 152, 219, 0.45);
    outline-offset: 2px;
}

/* =========================
   MAIN CONTENT
========================= */

main {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    padding: clamp(24px, 5vw, 48px) 0 clamp(40px, 6vw, 64px);
}

main>h1 {
    margin: 0 0 clamp(22px, 4vw, 34px);

    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    line-height: 1.15;

    overflow-wrap: anywhere;
}

/* =========================
   PRODUCT GRID
========================= */

.product-list {
    display: grid;
    grid-template-columns: repeat(auto-fit,
            minmax(min(100%, 250px), 1fr));
    gap: clamp(18px, 3vw, 30px);

    width: 100%;
    padding: 0;
}

.product {
    min-width: 0;
    padding: clamp(18px, 3vw, 26px);

    border-top: 6px solid #1abc9c;
    border-radius: 18px;

    background: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);

    text-align: center;
    overflow: hidden;
}

.product img {
    width: 100%;
    max-height: 260px;
    margin: 0 auto 18px;

    border-radius: 10px;
    object-fit: contain;
}

.product h2 {
    margin: 12px 0;

    font-size: clamp(1.35rem, 3vw, 1.8rem);
    line-height: 1.25;

    overflow-wrap: anywhere;
}

.product p {
    margin: 10px 0;
    line-height: 1.6;
}

/* =========================
   FORM ELEMENTS
========================= */

input,
select,
textarea {
    width: 100%;
    max-width: 100%;

    border: 1px solid #ccc;
    border-radius: 10px;

    background: #fff;
    color: #2c3e50;
}

input[type="number"],
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    display: block;

    margin: 8px 0 16px;
    padding: 13px 15px;

    font-size: 1rem;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

select {
    width: auto;
    min-width: 150px;

    margin: 5px 8px 5px 0;
    padding: 11px 13px;

    font-size: 1rem;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
    outline: none;
}

/* =========================
   GENERAL BUTTONS
========================= */

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 44px;
    max-width: 100%;
    padding: 11px 20px;

    border: 0;
    border-radius: 10px;

    background: #3498db;
    color: #fff;

    font-size: 1rem;
    font-weight: 700;
    text-align: center;

    cursor: pointer;

    transition:
        background 0.3s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

button:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.15);
}

button:active {
    transform: translateY(0);
}

/* =========================
   CHECKOUT / CART
========================= */

#cartSummary,
#orderForm {
    width: 100%;

    margin: clamp(18px, 3vw, 28px) 0;
    padding: clamp(18px, 4vw, 32px);

    border-left: 6px solid #3498db;
    border-radius: 18px;

    background: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}

/* =========================
   CART ITEMS
========================= */

#cartItems {
    list-style: none;
    padding: 0;
    margin: 0;
}

#cartItems li {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    width: 100%;
    margin: 14px 0;
    padding: clamp(14px, 3vw, 20px);

    border-radius: 12px;

    background: #f9f9f9;
    overflow: hidden;
}

#cartItems li input {
    width: min(100%, 260px);
    margin: 12px 0 14px;
}

#cartItems li button {
    width: auto;
    min-width: 160px;
    margin: 8px 0 0;
}

#cartItems li button+button {
    margin-top: 8px;
}

/* =========================
   CART TOTAL
========================= */

#cartTotal {
    margin-top: 20px;

    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 700;
}

/* =========================
   ORDER FORM
========================= */

#orderForm h2 {
    margin: 0 0 24px;

    font-size: clamp(1.5rem, 4vw, 2rem);
    line-height: 1.25;
}

#orderForm label {
    display: block;

    margin-top: 12px;

    font-size: clamp(1rem, 2vw, 1.125rem);
    font-weight: 500;
}

/* =========================
   SHOPPING SECTION
========================= */

.shopping-section {
    margin-top: clamp(28px, 5vw, 48px);
    text-align: center;
}

.shopping-heading {
    margin: 0 0 24px;

    color: #2c3e50;

    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 800;
    line-height: 1.2;
}

/* HOME PAGE BUTTONS
   Laptops, Phones and Accessories
   are stacked vertically.
*/

.cta-buttons {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    gap: 16px;
    margin-top: 20px;
}

.cta-buttons .nav-btn {
    width: 220px;
    min-width: 220px;
    padding: 13px 22px;

    border-radius: 12px;

    font-size: 1.05rem;
}

/* =========================
   UNIQUE HOME BUTTON COLORS
========================= */

.btn-laptops {
    background: #1abc9c;
}

.btn-phones {
    background: #e67e22;
}

.btn-accessories {
    background: #9b59b6;
}

.btn-laptops:hover {
    background: #16a085;
}

.btn-phones:hover {
    background: #d35400;
}

.btn-accessories:hover {
    background: #8e44ad;
}

/* =========================
   FOOTER
========================= */

footer {
    margin-top: 30px;
    padding: 20px clamp(14px, 4vw, 30px);

    background: #2c3e50;
    color: #fff;

    text-align: center;
}

/* =========================
   TABLET AND SMALL SCREENS
========================= */

@media (max-width: 700px) {

    .navbar nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));

        max-width: 440px;
    }

    .nav-btn {
        width: 100%;
        min-width: 0;
    }

    main {
        width: min(1200px, calc(100% - 24px));
    }

    .product-list {
        grid-template-columns: 1fr;
    }

    .product {
        padding: 24px 18px;
    }

    .product h2 {
        font-size: 1.6rem;
    }

    .product p {
        font-size: 1.05rem;
    }

    .product img {
        max-height: 220px;
    }

    select {
        width: 100%;
        margin-right: 0;
    }

    #cartItems li button {
        width: 100%;
    }

    /* Keep home buttons vertical on phones */
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }

    .cta-buttons .nav-btn {
        width: min(220px, 90%);
        min-width: 0;
    }
}

/* =========================
   VERY SMALL PHONES
========================= */

@media (max-width: 400px) {

    .navbar nav {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .store-title {
        font-size: 1.4rem;
    }

    main {
        width: min(1200px, calc(100% - 20px));
    }

    #cartSummary,
    #orderForm {
        border-left-width: 4px;
        padding: 16px 14px;
    }

    .cta-buttons {
        flex-direction: column;
        align-items: center;
        gap: 14px;
    }

    .cta-buttons .nav-btn {
        width: min(220px, 90%);
    }
}

/* =========================
   LARGE SCREENS
========================= */

@media (min-width: 1200px) {

    .product-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* =========================
   REDUCED MOTION SUPPORT
========================= */

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}