/* =========================
   askDL Widget
   ========================= */

#askDlWidget {
    width: 100%;
    box-sizing: border-box;
    font-family: 'Lato', sans-serif;
    align-self: start;
}

/* Card (matches .dashboard-card) */

#askDlWidget .askdl-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid #DFE0EB;
    min-height: 100%;
    max-height: 100%;
}

/* Header (matches .drag-handle) */

#askDlWidget .askdl-header {
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 12px 16px;

    background: linear-gradient(to bottom, #ffffff, #f9fafb);
    border-bottom: 1px solid #edf2f7;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

#askDlWidget .askdl-title {
    display: flex;
    align-items: center;
}

#askDlWidget .askdl-logo {
    width: 32px;
    height: 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-right: 12px;

    border-radius: 50%;

    background: linear-gradient(135deg,
            #2563eb,
            #1e40af);

    color: #ffffff;

    font-size: 12px;
    font-weight: 700;

    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

#askDlWidget .askdl-title h2 {
    margin: 0;

    color: #001B71;

    font-size: 24px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: -0.025em;
}

#askDlWidget .askdl-drag {
    display: flex;
    align-items: center;
    justify-content: center;
}

#askDlWidget .askdl-drag img {
    width: 18px;
    height: 18px;

    display: block;

    opacity: 0.65;
}

/* Body */

#askDlWidget .askdl-body {
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding: 0 16px 16px;
    background: #ffffff;
    overflow: hidden;
}

/* AI cards */
.ai-tabs-body {
    margin-top: 0.75rem;
}

.tab-body-btn {
    font-weight: 600;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    line-height: 1.2rem;
    padding: 0.75rem 1rem;
    border: 2px solid #f3f4f6;
    background-color: #ffffff;
    border-radius: 9999px; /* full rounded */
    margin-bottom: 0.75rem;
    margin-inline-end: 0.75rem;
    text-align: left;
}

/* Chat */

#askDlWidget .askdl-chat-history {
    flex: 1;
    overscroll-behavior: contain;
    min-height: 0;
    overflow-y: auto;
    margin-bottom: 16px;
    padding: 16px 8px 0 0;
    border-top: 1px solid #f3f4f6;
    box-sizing: border-box;
}

/* matches Tailwind space-y-4 on #chatHistory */
#askDlWidget .askdl-chat-history>*+* {
    margin-top: 16px;
}

/* Chat messages */

#askDlWidget .askdl-message {
    display: flex;
    animation: askdlFadeIn 0.3s ease;
}

#askDlWidget .askdl-message-user {
    justify-content: flex-end;
}

#askDlWidget .askdl-message-ai {
    justify-content: flex-start;
}

#askDlWidget .askdl-bubble {
    max-width: 85%;
    padding: 12px 20px;
    border-radius: 16px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}

#askDlWidget .askdl-bubble-user {
    background: #001B71;
    color: #ffffff;
    border-bottom-right-radius: 0;
}

#askDlWidget .askdl-bubble-ai {
    background: #f9fafb;
    color: #374151;
    border: 1px solid #f3f4f6;
    border-bottom-left-radius: 0;
    font-size: 14px;
}

#askDlWidget .askdl-bubble-text {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.625;
}

@keyframes askdlFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

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

/* Loading indicator */

#askDlWidget .askdl-loading {
    padding: 12px 16px;
}

#askDlWidget .askdl-dots {
    display: flex;
    gap: 4px;
}

#askDlWidget .askdl-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: askdlBounce 1s infinite ease-in-out;
}

@keyframes askdlBounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-4px);
    }
}

.hidden {
    display: none;
}

#chatHistory p {
    margin-bottom: 10px;
}

#chatHistory li {
    margin-bottom: 10px;
}

#chatHistory table {
    margin: 10px 0;
}

#chatHistory thead tr,
#chatHistory th {
    background: #001B71 !important;
    color: #fff !important;
}

#chatHistory strong,
#chatHistory b {
    color: #001B71;
}

#chatHistory input {
    margin-top: 5px;
    border-radius: 8px;
    padding: 10px;
    font-family: 'Lato', sans-serif;
    color: #252733;
    width: 100%;
    border: 1px solid #C5C7CD;
    background-color: #FCFDFE;
    display: block;
}


/* matches Tailwind .mb-4 added by askDL.js on expand */
#askDlWidget .askdl-header.mb-4 {
    margin-bottom: 16px;
}

/* Form */

#askDlWidget .askdl-form {
    width: 100%;

    flex-shrink: 0;

    margin-top: auto;
    padding-top: 16px;

    box-sizing: border-box;
}

/* Input */

#askDlWidget .askdl-input-wrapper {
    position: relative;

    width: 100%;
}

#askDlWidget .askdl-input-wrapper input {
    width: 100%;
    height: 56px;

    box-sizing: border-box;

    padding: 0 56px 0 24px;

    border: 2px solid #f3f4f6;
    border-radius: 999px;

    outline: none;

    background: #f8fafc;

    color: #374151;

    font-size: 16px;
    font-weight: 700;

    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.03);

    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}

#askDlWidget .askdl-input-wrapper input::placeholder {
    color: #9ca3af;
}

/* matches focus:ring-4 focus:ring-blue-100 focus:border-blue-500 focus:bg-white */
#askDlWidget .askdl-input-wrapper input:focus {
    border-color: #3b82f6;

    background: #ffffff;

    box-shadow:
        0 0 0 4px #dbeafe,
        inset 0 2px 5px rgba(0, 0, 0, 0.02);
}

/* Send button */

/* Send button (matches bg-primary / hover:bg-blue-700 / group-focus-within:bg-blue-600) */

#askDlWidget .askdl-input-wrapper button {
    position: absolute;

    right: 8px;
    top: 8px;
    bottom: 8px;

    width: 40px;
    height: 40px;

    padding: 10px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    border-radius: 50%;

    background: #001B71;

    cursor: pointer;

    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);

    transition:
        background 0.2s ease,
        transform 0.1s ease;
}

#askDlWidget .askdl-input-wrapper button:hover {
    background: #1d4ed8;
}

#askDlWidget .askdl-input-wrapper:focus-within button {
    background: #2563eb;
}

#askDlWidget .askdl-input-wrapper button:active {
    transform: scale(0.95);
}

#askDlWidget .askdl-input-wrapper button img {
    width: 100%;
    height: 100%;

    object-fit: contain;
}

/* Disclaimer */

#askDlWidget .askdl-disclaimer {
    display: block;
    margin: 4px 16px 0;
    text-align: right;
    color: #6b7280;
    font-size: 12px;
    line-height: 18px;
    text-transform: none;
}

/* Scrollbar */

#askDlWidget .askdl-chat-history::-webkit-scrollbar {
    width: 6px;
}

#askDlWidget .askdl-chat-history::-webkit-scrollbar-track {
    background: transparent;
}

#askDlWidget .askdl-chat-history::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

#askDlWidget .askdl-chat-history::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* --- COLORS & GRADIENTS --- */
.text-primary {
    color: #001B71;
}

.bg-primary {
    background-color: #001B71;
}

.btn-primary {
    background: linear-gradient(to bottom, #5ABD4E, #4CAF42);
    box-shadow: 0 4px 6px -1px rgba(90, 189, 78, 0.4);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: linear-gradient(to bottom, #4CAF42, #439a3a);
    transform: translateY(-1px);
    box-shadow: 0 6px 10px -1px rgba(90, 189, 78, 0.5);
}
/* =========================
   AskDL Output Styling
   ========================= */
.carousel-container {
  display: flex;
  overflow-x: auto;
  gap: 15px;
  padding-bottom: 15px;
  font-family: sans-serif;
}

/* Card Container */
.carousel-card {
  flex: 0 0 auto;
  width: 460px;
  display: flex;
  align-items: flex-start;
  background: #f8f9fa;
  border-radius: 20px;
  padding: 15px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
  border: 1px solid #f0f0f0;
}

/* Card Image */
.carousel-card-img {
  width: 140px;
  height: 95px;
  object-fit: cover;
  border-radius: 12px;
  margin-right: 15px;
  flex-shrink: 0;
}

/* Card Content Area */
.carousel-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Title & Link Styles */
.carousel-card-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.carousel-card-link {
  color: #1a1a1a;
  text-decoration: none;
  font-weight: bold;
}

/* Meta & CTA Styles */
.carousel-card-date {
  margin: 0;
  color: #6b7280;
  font-size: 14px;
}

.carousel-card-cta {
  margin: 0;
  color: #0ea5e9;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.table-container {
    overflow-x: auto;
}

.custom-table {
  border-collapse: collapse;
  width: 100%;
  font-family: sans-serif;
}

.custom-th {
  border: 1px solid #ddd;
  padding: 12px 8px;
  background-color: #f8f9fa;
  color: #333;
  text-align: left;
  font-weight: 600;
}

.custom-td {
  border: 1px solid #ddd;
  padding: 10px 8px;
  color: #555;
  background-color: #fff;
}

/* Video iframe styling */
#chatHistory div.video-container {
    width: 215px;
    height: 121px; /* Set fixed height instead of max-height for stability */
    border-radius: 12px;
    margin-right: 15px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

/* Upscale to force Vimeo to render desktop controls, then scale down */
#chatHistory div.video-container iframe {
    /* Multiply the iframe size by 1.33 so that the video controls are fully visible */
    width: 133.33%;
    height: 133.33%;
    position: absolute;
    top: 0;
    left: 0;
    /* After that scale it down to fit the iframe parent container */
    transform: scale(0.75);
    transform-origin: 0 0;
    border: none;
}

/* Styling for Pagination Controls for Carousel Cards */

.carousel-loader {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 8rem;
    background-color: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 1rem;
}

.carousel-loader.hidden,
.carousel-error.hidden {
    display: none;
}

.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #d1d5db;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.carousel-error {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 12rem;
    padding: 1rem;
    text-align: center;
    border: 1px solid #fecaca;
    background-color: #fef2f2;
    border-radius: 1rem;
}

.carousel-error-message {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 500;
    color: #dc2626;
}

.carousel-retry-btn {
    padding: 0.375rem 0.75rem;
    border: 0;
    border-radius: 0.5rem;
    background-color: #dc2626;
    color: #fff;
    font-size: 0.75rem;
    line-height: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.carousel-retry-btn:hover {
    background-color: #b91c1c;
}

.carousel-sentinel {
    flex-shrink: 0;
    min-width: 1px;
    min-height: 100px;
    background: transparent;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}