* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #222;
    transition: background-color 0.4s ease, color 0.4s ease;
}

.navbar {
    height: 70px;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 7%;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    animation: navbarDown 0.7s ease;
    transition: background-color 0.4s ease;
}

@keyframes navbarDown {

    from {
        opacity: 0;
        transform: translateY(-70px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.logo {
    font-size: 28px;
    font-weight: bold;
    color: #6c63ff;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.08);
}


.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    position: relative;
    transition: color 0.3s ease;
}

.nav-links a::after {
    content: "";
    position: absolute;
    width: 0;
    height: 2px;
    background-color: #6c63ff;
    bottom: -7px;
    left: 0;

    transition: width 0.3s ease;
}

.nav-links a:hover {
    color: #6c63ff;
}

.nav-links a:hover::after {
    width: 100%;
}


.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

#username {
    font-weight: bold;
    animation: fadeIn 1s ease;
}

#darkModeBtn {
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

#darkModeBtn:hover {
    transform: rotate(25deg) scale(1.2);
}

.logout-btn {
    border: none;
    background: #6c63ff;
    color: white;
    padding: 9px 18px;
    border-radius: 6px;
    cursor: pointer;
    transition:
        transform 0.3s ease,
        background-color 0.3s ease;
}

.logout-btn:hover {
    background-color: #554ee0;
    transform: translateY(-2px);
}

.hero {
    min-height: 450px;
    display: flex;
    align-items: center;
    padding: 60px 8%;
    background: linear-gradient(
        135deg,
        #6c63ff,
        #8f88ff
    );

    color: white;
    overflow: hidden;
}


.hero-content {
    max-width: 600px;
    animation: heroLeft 1s ease;
}

@keyframes heroLeft {

    from {
        opacity: 0;
        transform: translateX(-100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.hero h1 {
    font-size: 55px;
    margin-bottom: 20px;
    animation: titleFade 1.2s ease;
}

@keyframes titleFade {

    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero p {
    font-size: 18px;
    line-height: 1.7;
    margin-bottom: 30px;
    animation: paragraphFade 1.5s ease;
}

@keyframes paragraphFade {

    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.hero-btn {
    display: inline-block;
    text-decoration: none;
    background: white;
    color: #6c63ff;
    padding: 13px 28px;
    border-radius: 7px;
    font-weight: bold;
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.hero-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow:0 10px 25px rgba(0, 0, 0, 0.2);
}

.products-section {
    padding: 70px 7%;
}

.products-section h2 {
    text-align: center;
    font-size: 36px;
    margin-bottom: 30px;
    animation: sectionTitle 0.8s ease;
}

@keyframes sectionTitle {

    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-container {
    max-width: 600px;
    margin: 0 auto 40px;
    animation: searchAnimation 0.8s ease;
}

@keyframes searchAnimation {

    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

#searchInput {
    width: 100%;
    padding: 15px 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
    font-size: 16px;
    transition:
        border-color 0.3s ease,
        box-shadow 0.3s ease,
        transform 0.3s ease;
}

#searchInput:focus {
    border-color: #6c63ff;
    box-shadow:0 0 0 4px rgba(108, 99, 255, 0.12);

    transform: scale(1.02);
}

#loading {
    text-align: center;
    font-size: 20px;
    margin: 30px;
    animation: loadingPulse 1s infinite alternate;
}

@keyframes loadingPulse {

    from {
        opacity: 0.4;
    }

    to {
        opacity: 1;
    }
}

.products-container {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(230px, 1fr));

    gap: 25px;
}

.product-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow:0 4px 15px rgba(0, 0, 0, 0.08);

    transition:
        transform 0.4s ease,
        box-shadow 0.4s ease;

    animation: cardAppear 0.7s ease both;
}

@keyframes cardAppear {

    from {
        opacity: 0;

        transform:
            translateY(50px)
            scale(0.95);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}

.product-card:nth-child(1) {
    animation-delay: 0.1s;
}

.product-card:nth-child(2) {
    animation-delay: 0.2s;
}

.product-card:nth-child(3) {
    animation-delay: 0.3s;
}

.product-card:nth-child(4) {
    animation-delay: 0.4s;
}

.product-card:nth-child(5) {
    animation-delay: 0.5s;
}

.product-card:nth-child(6) {
    animation-delay: 0.6s;
}

.product-card:nth-child(7) {
    animation-delay: 0.7s;
}

.product-card:nth-child(8) {
    animation-delay: 0.8s;
}

.product-card:hover {
    transform:
        translateY(-10px)
        scale(1.02);

    box-shadow:0 15px 35px rgba(0, 0, 0, 0.15);
}

.product-card img {
    width: 100%;
    height: 230px;
    object-fit: contain;
    padding: 20px;
    transition:transform 0.5s ease;
}

.product-card:hover img {
    transform: scale(1.1) rotate(1deg);
}

.product-info {
    padding: 20px;
}

.product-info h3 {
    font-size: 18px;
    margin-bottom: 10px;
    height: 45px;
    overflow: hidden;
    transition: color 0.3s ease;
}

.product-card:hover h3 {
    color: #6c63ff;
}

.product-description {
    color: #777;
    font-size: 14px;
    line-height: 1.5;
    height: 63px;
    overflow: hidden;
    margin-bottom: 15px;
}

.product-price {
    color: #6c63ff;
    font-size: 20px;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.product-card:hover .product-price {
    transform: translateX(5px);
}

.rating {
    margin-top: 10px;
    color: #f5a623;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background:
        linear-gradient(
            135deg,
            #6c63ff,
            #8f88ff
        );

    padding: 20px;
}

.auth-container {
    width: 420px;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow:0 15px 40px rgba(0, 0, 0, 0.2);
    animation: authAppear 0.8s ease;

}

@keyframes authAppear {

    from {
        opacity: 0;

        transform:
            translateY(40px)
            scale(0.9);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 10px;
    animation: fadeIn 0.8s ease;
}

.auth-subtitle {
    text-align: center;
    color: #777;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    animation: formItem 0.6s ease both;
}

.form-group:nth-child(1) {
    animation-delay: 0.1s;
}

.form-group:nth-child(2) {
    animation-delay: 0.2s;
}

.form-group:nth-child(3) {
    animation-delay: 0.3s;
}

.form-group:nth-child(4) {
    animation-delay: 0.4s;
}

@keyframes formItem {

    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 13px;
    border: 1px solid #ddd;
    border-radius: 6px;
    outline: none;
    font-size: 15px;
    transition:
        border-color 0.3s ease,
        box-shadow 0.3s ease,
        transform 0.3s ease;
}

.form-group input:focus {
    border-color: #6c63ff;
    box-shadow:0 0 0 4px rgba(108, 99, 255, 0.1);
    transform: translateY(-2px);
}

.form-group small {
    display: block;
    color: red;
    margin-top: 5px;
    animation: errorShake 0.3s ease;
}

@keyframes errorShake {

    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}

.login-error {
    color: red;
    text-align: center;
    margin-bottom: 15px;
    animation: errorShake 0.3s ease;
}


.auth-btn {
    width: 100%;
    border: none;
    background: #6c63ff;
    color: white;
    padding: 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition:background-color 0.3s ease,transform 0.2s ease, box-shadow 0.3s ease;
}

.auth-btn:hover {

    background: #554ee0;
    transform: translateY(-3px);
    box-shadow:0 8px 20px rgba(108, 99, 255, 0.3);
}

.auth-btn:active {
    transform: scale(0.97);
}

.switch-auth {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.switch-auth a {
    color: #6c63ff;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.switch-auth a:hover {
    color: #554ee0;
    text-decoration: underline;
}

body.dark {
    background: #121212;
    color: white;
}

body.dark .navbar {
    background: #1e1e1e;
    box-shadow:0 2px 15px rgba(0, 0, 0, 0.4);
}

body.dark .nav-links a {
    color: #eee;
}

body.dark .nav-links a:hover {
    color: #8f88ff;
}

body.dark .product-card {

    background: #1e1e1e;
    box-shadow:
        0 5px 20px rgba(0, 0, 0, 0.4);
}

body.dark .product-description {
    color: #bbb;
}

body.dark #searchInput {
    background: #1e1e1e;
    color: white;
    border-color: #444;
}

body.dark #searchInput::placeholder {
    color: #999;
}

body.dark .auth-container {
    background: #1e1e1e;
    color: white;
}

body.dark .form-group input {
    background: #292929;
    color: white;
    border-color: #444;
}

@keyframes fadeIn {

    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 768px) {

    .navbar {
        padding: 0 20px;
    }

    .nav-links {
        display: none;
    }

    .nav-right {
        gap: 8px;
    }

    #username {
        font-size: 13px;
    }

    .hero {
        min-height: 400px;
        padding: 50px 25px;
        text-align: center;
    }

    .hero-content {
        margin: auto;
    }

    .hero h1 {
        font-size: 40px;
    }

    .hero p {
        font-size: 16px;
    }

    .products-section {
        padding: 50px 20px;
    }

    .products-section h2 {
        font-size: 30px;

    }

    .auth-container {

        width: 100%;
        max-width: 420px;
        padding: 30px 25px;

    }

}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {

        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}