body {
    visibility: hidden;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    background-color: #f3f4f6;
    margin: 0;
    padding: 30px;
    color: #333;
    height: 100%;
    overflow: hidden;
}

.chat-box {
    position: relative;
    max-width: 650px;
    margin: auto;
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    height: 80vh;
    overflow: hidden;
    /* keep greeting inside box */
}

.ready-text {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 40px;
    text-align: center;
    color: #4b6043;
    font-style: italic;
    line-height: 1.6;
    animation: fadeIn 1.2s ease-in;
    transition: opacity 0.8s ease, transform 0.8s ease;
    opacity: 1;
    z-index: 2;
    pointer-events: none;
}

.ready-text.hidden {
    opacity: 0;
    transform: translateY(-30px);
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    margin-right: 8px;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 24px;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

input:checked+.slider {
    background-color: #4b6043;
}

input:checked+.slider:before {
    transform: translateX(24px);
}

body.dark-mode {
    background-color: #1e1e1e;
    color: #f4f4f4;
}

body.dark-mode .chat-box {
    background-color: #2b2b2b;
    box-shadow: 0px 4px 8px rgba(255, 255, 255, 0.1);
}

body.dark-mode input[type="text"] {
    background-color: #444;
    color: #fff;
    border: 1px solid #666;
}

body.dark-mode button {
    background-color: #6da06f;
}

body.dark-mode .ready-text {
    color: #c2e1c2;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    scroll-behavior: smooth;
}

.user,
.bot {
    max-width: 80%;
    margin: 10px 0;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 1.05em;
    white-space: pre-wrap;
    word-break: break-word;
    animation: fadeIn 0.3s ease;
    position: relative;
}

.user {
    background-color: #d1e9ff;
    align-self: flex-end;
    text-align: right;
    border-bottom-right-radius: 4px;
}

.bot {
    background-color: #e8f5e9;
    align-self: flex-start;
    text-align: left;
    border-bottom-left-radius: 4px;
}

.timestamp {
    font-size: 0.75em;
    color: #777;
    margin-top: 4px;
    text-align: right;
}

.input-area {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

input[type=text] {
    flex: 1;
    padding: 12px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 8px;
}

button {
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 18px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

button:hover {
    background-color: #45a049;
}

.typing {
    color: #777;
    font-style: italic;
    margin: 6px 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 🌙 DARK MODE TEXT */
body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}

body.dark-mode .chat-box {
    background-color: #1e1e1e;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.05);
}

/* 🌙 Fix dark mode chat readability */
body.dark-mode .user {
    background-color: #2f4f2f;
    /* rich herbal green tone */
    color: #f5f5f5;
}

body.dark-mode .bot {
    background-color: #1f1f1f;
    /* dark charcoal bubble */
    color: #f0f0f0;
}

body.dark-mode .timestamp {
    color: #b0b0b0;
}

body.dark-mode .chat-box {
    background-color: #181818;
    border: 1px solid #333;
}

body.dark-mode input[type="text"] {
    background-color: #2a2a2a;
    color: #eaeaea;
    border: 1px solid #444;
}

body.dark-mode button {
    background-color: #4b6043;
    color: #fff;
}

body.dark-mode button:hover {
    background-color: #5f7c55;
}

/* 📱 Responsive design adjustments */
@media (max-width: 768px) {
    body {
        font-size: 15px;
        padding: 0 10px;
    }

    .chat-box {
        height: 80vh;
        /* allow more space for mobile keyboards */
    }

    .container {
        width: 100%;
        max-width: 95%;
        margin: 0 auto;
        padding: 10px;
    }

    #chat-box {
        height: 55vh;
        padding: 8px;
        font-size: 0.95rem;
        overflow-y: auto;
    }

    #user-input {
        width: 100%;
        padding: 10px;
        font-size: 1rem;
    }

    button {
        width: 100%;
        margin-top: 8px;
        padding: 12px;
        font-size: 1rem;
    }

    .ready-text {
        font-size: 1.1rem;
        padding: 0 5px;
        text-align: center;
        line-height: 1.4;
    }

    .header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 8px;
    }

    .toggle-container {
        margin-top: 8px;
    }

    .product-card {
        max-width: 95%;
    }

    .product-card img {
        width: 220px;
        height: 220px;
    }

    .product-card .card-content {
        padding: 10px;
        min-height: 240px;
    }
}

.bot a {
    color: #4b6043;
    text-decoration: underline;
    font-weight: 500;
}

.bot a:hover {
    color: #5f7c55;
}

.product-card {
    margin-top: 14px;
    background: #f7f7f7;
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    text-align: center;
    /* Center all inner text */
    max-width: 360px;
    /* Prevent it from being too tall or wide */
    margin-left: auto;
    margin-right: auto;
    /* Centers the card itself */
}

body.dark-mode .product-card {
    background: #262626;
    box-shadow: 0 2px 6px rgba(255, 255, 255, 0.05);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.product-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-card .card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 10px;
    gap: 10px;
    min-height: 280px;
    text-align: center;
}

/* 🖼️ Desktop image (300px) */
.product-card img {
    width: 300px;
    height: 300px;
    object-fit: contain;
    border-radius: 14px;
    background: #fff;
    padding: 8px;
    transition: transform 0.25s ease;
}

.product-card:hover img {
    transform: scale(1.03);
}

.product-card .card-text {
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center; /* centers the text block perfectly */
  justify-content: center;
}

.product-card .card-text strong {
    color: #4b6043;
    font-size: 1.2em;
}

body.dark-mode .product-card .card-text strong {
    color: #d0f0c0;
}

.product-card .card-text span {
    color: #666;
    font-size: 0.95em;
}

body.dark-mode .product-card .card-text span {
    color: #aaa;
}


.input-area button {
    background-color: #4b6043;
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.input-area button:hover {
    background-color: #5f7c55;
}

.input-area button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.thinking {
    font-style: italic;
    color: #666;
    opacity: 0.9;
    padding: 6px 10px;
}

.thinking .dots {
    display: inline-block;
}

.dot1,
.dot2,
.dot3 {
    animation: blink 1.4s infinite both;
}

.dot2 {
    animation-delay: 0.2s;
}

.dot3 {
    animation-delay: 0.4s;
}

@keyframes blink {
    0% {
        opacity: 0.2;
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0.2;
    }
}