/* RESET */

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

:root {
    --primary: #1e3a8a;
    --primary-dark: #172554;
    --secondary: #facc15;
    --background: #f5f7fb;
    --white: #ffffff;
    --text: #1f2937;
    --success: #22c55e;
    --danger: #ef4444;
    --gray: #e5e7eb;
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--background);
    color: var(--text);
    overflow-x: hidden;
}

/* HEADER */

header {
    background: linear-gradient(90deg, #1e3a8a, #2563eb);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header img {
    width: 90px;
    object-fit: contain;
    border-radius: 8px;
}

/* SEARCH */

.search_area {
    flex: 1;
    display: flex;
    align-items: center;
    max-width: 700px;
}

header input {
    width: 100%;
    height: 50px;
    border: none;
    outline: none;
    border-radius: 999px 0 0 999px;
    padding: 0 20px;
    font-size: 15px;
    background: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .1);
}

#search_button {
    width: 130px;
    height: 50px;
    border: none;
    border-radius: 0 999px 999px 0;
    background: var(--secondary);
    cursor: pointer;
    transition: .3s;
    font-weight: bold;
}

#search_button:hover {
    transform: translateY(-2px);
    filter: brightness(.95);
}

#search_button span {
    color: #111;
    letter-spacing: 1px;
    font-weight: 700;
}

/* LOGIN */

.login_area {
    background: rgba(255, 255, 255, .15);
    backdrop-filter: blur(8px);
    padding: 10px 16px;
    border-radius: 16px;
    transition: .3s;
}

.login_area:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, .25);
}

.login_area a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.login_area img {
    width: 28px;
}

.login_area h3 {
    color: white;
    font-size: 14px;
    font-weight: 500;
}

/* CART */

.cart-icon {
    position: relative;
    cursor: pointer;
    background: white;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
}

.cart-icon:hover {
    transform: scale(1.08);
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* NAV */

nav {
    background: var(--secondary);
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 80px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
}

nav a {
    position: relative;
    text-decoration: none;
    color: #111;
    font-weight: 700;
    transition: .3s;
}

nav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 0%;
    height: 3px;
    background: #111;
    transition: .3s;
}

nav a:hover::after,
nav .active::after {
    width: 100%;
}

/* MAIN */

main {
    min-height: 100vh;
}

/* SECTION */

.products-section {
    padding: 60px 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.container {
    max-width: 1400px;
    margin: auto;
    
}

/* HEADER PRODUCTS */

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 50px;
    flex-wrap: wrap;
}

.products-header h2 {
    font-size: 42px;
    font-weight: 700;
}

/* FILTERS */

.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.search-input,
.filter-select {
    height: 50px;
    border: none;
    border-radius: 14px;
    padding: 0 18px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
    font-size: 15px;
    outline: none;
}

.search-input {
    width: 300px;
}

/* GRID */

.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-flow: row;
    gap: 20px;
    justify-content: center;

    
}

/* CARD */

.product-card {
    background: white;
    border-radius: 24px;
    overflow: hidden;
    transition: .35s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .08);
    position: relative;
    width: 354px;
    margin: auto;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 14px 35px rgba(0, 0, 0, .16);
}

/* IMAGE */

.product-image {
    position: relative;
    height: 280px;
    background: #f8fafc;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 20px;
    transition: .4s;
}

.product-card:hover .product-image img {
    transform: scale(1.08);
}

/* STOCK */

.stock-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.in-stock {
    background: #dcfce7;
    color: #166534;
}

.out-of-stock {
    background: #fee2e2;
    color: #991b1b;
}

/* INFO */

.product-info {
    padding: 24px;
}

.product-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #111827;
}

.product-description {
    font-size: 14px;
    line-height: 1.6;
    color: #6b7280;
    margin-bottom: 18px;
}

/* DETAILS */

.product-details {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.product-details span {
    background: #f3f4f6;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    color: #4b5563;
}

/* PRICE */

.product-price {
    font-size: 32px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 20px;
}

/* BUTTON */

.btn-buy {
    width: 100%;
    border: none;
    padding: 15px;
    border-radius: 14px;
    background: var(--primary);
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: .3s;
}

.btn-buy:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-buy:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

/* LOADING */

.loading,
.no-products {
    text-align: center;
    padding: 80px;
    font-size: 22px;
    color: #6b7280;
}

/* ERROR */

.error-message {
    text-align: center;
    padding: 60px;
}

.error-message button {
    margin-top: 20px;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    cursor: pointer;
}

/* USER LOGGED */

.user-logged {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, .15);
    padding: 10px 16px;
    border-radius: 16px;
    backdrop-filter: blur(8px);
}

.user-logged img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-info strong {
    color: white;
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.logout-link,
.admin-link {
    font-size: 12px;
    text-decoration: none;
}

.logout-link {
    color: #fecaca;
}

.admin-link {
    color: #fde68a;
}

/* NOTIFICATION */

#cart-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 16px 24px;
    border-radius: 14px;
    z-index: 9999;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .15);
    animation: slideIn .3s ease;
    font-weight: 700;
}

@keyframes slideIn {

    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* FOOTER */

footer {
    background: #111827;
    padding: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 50px;
}

footer h4 {
    color: white;
    font-weight: 400;
}

/* RESPONSIVO */


@media(width < 1180px){

    .products-grid{
        grid-template-columns: repeat(2, 1fr);
    }

}

@media(max-width:768px) {

    header {
        flex-direction: column;
        padding: 20px;
    }

    .search_area {
        width: 100%;
    }

    nav {
        gap: 20px;
        flex-wrap: wrap;
        height: auto;
        padding: 15px;
    }

    .products-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filters {
        width: 100%;
        flex-direction: column;
    }

    .search-input,
    .filter-select {
        width: 100%;
    }

    .products-header h2 {
        font-size: 32px;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-image {
        height: 220px;
    }
}