@import url("https://fonts.googleapis.com/css2?family=Sora:wght@100;200;300;400;500;600;700&display=swap");

/* Base Styles */
body {
    margin: 0;
    padding: 0;
    font-family: "Sora", sans-serif;
    box-sizing: border-box;
    background: #191026;
    color: #e6d8ff;
}

/* Dashboard Layout */
.dashboard {
    color: #fff;
    max-width: 1400px;
    margin: auto;
    height: 100%;
    padding: 24px;
}

.glow:after {
    border-radius: 1153px;
    background: #663ebb;
    filter: blur(102px);
    height: 80%;
    width: 80%;
    position: absolute;
    content: "";
    bottom: 11px;
    z-index: -1;
}

.container {
    gap: 24px;
    margin-bottom: 24px;
}

.container > div {
    border-radius: 24px;
    border: 1px solid #4c2589;
    background: linear-gradient(#241d41, #1a142f);
    padding: 20px;
    gap: 30px;
    box-sizing: border-box;
}

.container-new {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.container-new > div {
    border-radius: 24px;
    border: 1px solid #4c2589;
    background: linear-gradient(#241d41, #1a142f);
    padding: 20px;
    flex-direction: inherit;
    gap: 30px;
    box-sizing: border-box;
}

/* Typography */
h1 {
    font-size: 30px;
    font-weight: 600;
    margin: 40px 0 8px;
    color: #e6d8ff;
}

h2 {
    font-size: 24px;
    font-weight: 600;
    color: #e6d8ff;
    margin: 0 0 16px 0;
}

h3 {
    color: #a477f3;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #4c2589;
    font-size: 18px;
    font-weight: 500;
}

/* Form Elements */
.form-floating {
    margin-top: 20px;
}

input[type="text"] {
    width: calc(100% - 110px);
    padding: 12px 16px;
    font-size: 20px;
    border-radius: 12px;
    border: 1px solid #4c2589;
    background: #1a142f;
    color: #fff;
    margin-right: 8px;
    transition:
        border-color 0.3s ease,
        box-shadow 0.3s ease;
    font-family: JetBrainsMono Nerd Font;
}

input[type="text"]:focus {
    outline: none;
    border-color: #a477f3;
    box-shadow: 0 0 0 2px rgba(164, 119, 243, 0.25);
}

button {
    padding: 12px 20px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 12px;
    border: none;
    background: #663ebb;
    color: #fff;
    transition:
        background 0.3s ease,
        transform 0.2s ease;
}

button:hover {
    background: #8c54f4;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

/* Results Block */
.block-large {
    min-height: 170px;
}

/* Animation Keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Product Card Styling - New Layout */
.product-card {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: 24px;
    background: linear-gradient(#241d41, #1a142f);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid #4c2589;
    margin-bottom: 24px;
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: calc(var(--animation-order) * 0.1s);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Product Card - Image Container */
.product-image-container {
    /* display: flex; */
    justify-content: center;
    align-items: flex-start;
    border-radius: 12px;
    overflow: hidden;
}

.img-prod {
    width: 100%;
    height: auto;
    /* border-radius: 12px; */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    object-fit: contain;
}

.img-prod:hover {
    transform: scale(1.03);
}

/* Product Card - Details Container */
.product-details-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Product Status */
.product-status {
    display: inline-block;
    padding: 6px 12px;
    /* border-radius: 50px; */
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    align-self: flex-start;
    width: 100%;
    text-align: center;
    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
}

.status-в-наличии {
    background-color: #2ecc71;
    color: #f5f6fa;
}

.status-есть-на-складе {
    background-color: #f39c12;
    color: #f5f6fa;
}

.status-нет-в-наличии {
    background-color: #e74c3c;
    color: #f5f6fa;
}

/* Product Metrics */
.product-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    background: rgba(76, 37, 137, 0.2);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
}

.metric-label {
    font-size: 18px;
    color: #e6d8ff;
    font-weight: 300;
}

.metric-value {
    font-size: 20px;
    font-weight: 600;
    color: #a477f3;
}

.metric-value.price {
    color: #55efc4;
}

.metric-value.cost {
    color: #ff7675;
}

.metric-value.margin {
    color: #74b9ff;
}

.metric-value.margin-percent {
    color: #a29bfe;
}

.metric-value.stock {
    color: #ffeaa7;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Product Links */
.product-links {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.link-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 12px 18px;
    background: #663ebb;
    color: #f0f0f0;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.link-button:hover {
    background: #8c54f4;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Supplier Info Section */
.products-info-home {
    background: rgba(36, 29, 65, 0.7);
    border-radius: 12px;
    padding: 16px;
    max-height: 500px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #4c2589 #1a142f;
}

.products-info-home::-webkit-scrollbar {
    width: 8px;
}

.products-info-home::-webkit-scrollbar-track {
    background: #1a142f;
    border-radius: 10px;
}

.products-info-home::-webkit-scrollbar-thumb {
    background: #4c2589;
    border-radius: 10px;
}

.products-info-home hr {
    border-color: #342255;
    margin: 16px 0;
    opacity: 0.5;
}

/* Supplier Info Items */
.sales-info {
    margin-bottom: 12px;
}

.supplier-info {
    background: rgba(44, 44, 84, 0.5);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.supplier-info:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.supplier-info h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.supplier-info h4 a {
    color: #ffbe76;
    text-decoration: none;
    transition: color 0.2s;
}

.supplier-info h4 a:hover {
    color: #f0932b;
    text-decoration: underline;
}

.supplier-info p {
    margin: 8px 0;
    color: #dcdde1;
    font-size: 14px;
    word-break: break-word;
}

.supplier-price {
    display: block;
    font-weight: 600;
    color: #00a8ff !important;
    font-size: 18px !important;
    margin-top: 8px;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    font-weight: 400;
    text-align: left;
    font-size: 14px;
    margin: 0;
    padding: 0 0 8px;
    border-bottom: 1px solid #342255;
    color: #dad3ee;
}

table tr td {
    font-size: 14px;
    font-weight: 200;
    padding: 10px 0px;
    color: #d8cbff;
    border-bottom: 1px solid #342255;
}

table tr:last-child td {
    border-bottom: 0;
}

/* No Data Image */
.products-info-home img {
    max-width: 80%;
    display: block;
    margin: 10px auto;
    border-radius: 8px;
}

/* Checkbox Styles */
.checkbox-label {
    display: block;
    transition: background-color 0.3s ease;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

input[type="checkbox"]:checked + .checkbox-label {
    background-color: #2ecc71;
    color: white;
}

.supplier-info {
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.loader {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80px;
    gap: 8px;
}

.loader span {
    display: block;
    width: 12px;
    height: 12px;
    background-color: #3498db;
    border-radius: 50%;
    animation: bounce 0.6s infinite alternate;
}

.loader span:nth-child(2) {
    animation-delay: 0.2s;
}

.loader span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    to {
        opacity: 0.3;
        transform: translateY(-10px);
    }
}

/* Responsive Styles */
@media screen and (max-width: 1200px) {
    .product-card {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "image details"
            "suppliers suppliers";
    }

    .product-image-container {
        grid-area: image;
    }

    .product-details-container {
        grid-area: details;
    }

    .products-info-home {
        grid-area: suppliers;
    }
}

@media screen and (max-width: 768px) {
    .product-card {
        grid-template-columns: 1fr;
        grid-template-areas:
            "image"
            "details"
            "suppliers";
    }

    .container {
        flex-direction: column;
    }

    .container-gpt {
        flex-direction: column;
    }

    .product-metrics {
        grid-template-columns: 1fr;
    }

    .image img {
        max-width: 100%;
    }

    .block-large .group div {
        padding: 5%;
        box-shadow: 0 0;
        max-height: 100%;
        overflow: visible;
    }

    .links-container {
        display: grid;
        justify-content: center;
    }

    .container-new > div {
        display: grid;
    }

    .link-button {
        width: 100%;
        justify-content: center;
    }
}

@media screen and (max-width: 576px) {
    input[type="text"] {
        width: 100%;
        margin-bottom: 12px;
        margin-right: 0;
    }

    button {
        width: 100%;
    }
}

/* Additional Helper Classes */
.hr {
    border: none;
    border-top: 3px solid rgba(0, 0, 0, 0.15);
}

.scrollable-div {
    height: 200px;
    overflow: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollable-div::-webkit-scrollbar {
    display: none;
}

/* Fix for nested containers */
.container-gpt-dict {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.container-gpt {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
    background-color: #2c2c54;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

@media screen and (max-width: 768px) {
    .container-gpt {
        flex-direction: column;
    }
}
