﻿html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    min-height: 100%;
    height: 100%;
}

.mud-rtl-provider, .mud-main-content, #app {
    height: 100%;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI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LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

/* Add these styles to your App.css or similar stylesheet */
.selected {
    background-color: rgba(0, 0, 0, 0.04);
}

.mud-list-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Add this script to your _Host.cshtml or index.html */


/*///CONVERSATION STYLES*/
.whatsapp-container {
    flex-grow: 1;
    min-height: 0;
    padding: 20px 5vw 0px;
    background: linear-gradient(90deg, #dbdbdb, #f3fcf5);
    z-index: 10;
    width: 100%;
}

.whatsapp-chat {
    /* background-color: #e5ddd5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='50' height='50' viewBox='0 0 200 200'%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill:%23ffffff;opacity:0.05;%7D%3C/style%3E%3C/defs%3E%3Cpath class='a' d='M0 0h200v200H0z'/%3E%3C/svg%3E");*/
    padding: 20px;
    border-radius: 8px;
    /*box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);*/
}

.message-outer-wrapper {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 12px;
    max-width: 600px;
    align-self: flex-start;
}

    .message-outer-wrapper.inbound {
        align-self: flex-end;
    }


.ltr-layout .message-outer-wrapper {
    align-self: flex-end;
}

.ltr-layout .inbound {
    align-self: flex-start;
}

.message-bubble {
    position: relative;
    width: 100%;
    padding: 0; /* Remove padding as MessagePreview handles internal spacing */
    border-radius: 7.5px 0 7.5px 7.5px;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
    position: relative;
    max-width: 600px;
    background-color: #DCF8C6;
}

    .message-bubble::before {
        right: -8px;
        content: "";
        position: absolute;
        top: 0;
        width: 0;
        height: 0;
        border-top: 8px solid #DCF8C6;
        border-right: 8px solid transparent;
    }

    .message-bubble .agent-in-bubble {
        height: 20px !important;
        max-width: 90%;
    }

        .message-bubble .agent-in-bubble .mud-chip-content {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            height: auto;
            display: block;
        }

.message-outer-wrapper.inbound .message-bubble {
    background-color: white;
    border-radius: 0 7.5px 7.5px 7.5px;
}

    .message-outer-wrapper.inbound .message-bubble::before {
        border-left: 8px solid transparent;
        border-top: 8px solid white;
        left: -8px;
        right: auto
    }


.message-content {
    overflow: auto;
    padding: 12px 16px;
    white-space: pre-wrap;
}

.message-time {
    text-align: left;
    color: #667781;
    font-size: 11px;
    margin: 0 16px 2px 8px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.message-status {
    font-weight: bold;
    letter-spacing: -4px;
    font-size: 12px;
}

    .message-status .sent::after {
        content: "✓";
    }

    .message-status .delivered::after {
        content: "✓✓";
    }

    .message-status .failed::after {
        content: "!";
        background-color: #ff4444;
        display: block;
        text-align: center;
        padding-right: 2px;
        width: 13px;
        height: 15px;
        border-radius: 50%;
        color: white;
        margin-bottom: 2px;
    }

    .message-status .read::after {
        content: "✓✓";
        color: #72c1e7;
    }

.message-outer-wrapper.inbound .message-time {
    gap: 0;
}



.business-header {
    color: #075E54;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 15px;
}

.component-label {
    color: #667781;
    font-weight: normal;
    margin-left: 4px;
}

.component-content {
    margin-bottom: 8px;
    line-height: 1.4;
}

.header-text {
    font-weight: 600;
    color: #111;
    margin-bottom: 12px;
}

.header-media {
    background-color: #f0f0f0;
    border-radius: 4px;
    padding: 30px;
    text-align: center;
    margin-bottom: 12px;
    color: #667781;
}

.body-text {
    color: #111;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.footer-text {
    color: #667781;
    font-weight: normal;
    margin-top: 16px;
    font-size: 14px;
}



.buttons-container {
    margin-top: 16px;
    border-top: 1px solid #e8e8e8;
    padding-top: 16px;
}

.whatsapp-button {
    display: block;
    width: 100%;
    padding: 8px;
    text-align: center;
    color: #027eb5;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    border: none;
    background: none;
    margin: 4px 0;
}

.parameters-section {
    margin: 8px 0;
    color: #667781;
}

.parameter {
    margin: 4px 0;
}

.parameter-name {
    font-weight: bold;
}




/* WhatsApp conversation styles */
.conversation-container {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    padding: 20px 35px;
    background-color: #a8a8a8fa;
    background-image: radial-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px), radial-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px);
    background-position: 0 0, 10px 10px;
    background-size: 20px 20px;
    background-repeat: repeat;
    margin-bottom: 5px;
    border-radius: 5px;
}

.input-container {
    bottom: 0;
    background-color: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-lines-default);
}


/* Template message styles */
.template-header {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.header-media {
    background-color: #f0f0f0;
    border-radius: 4px;
    padding: 30px;
    text-align: center;
    margin-bottom: 12px;
    color: #667781;
}

.template-body {
    white-space: pre-wrap;
    margin-bottom: 8px;
}

.template-footer {
    color: #667781;
    font-size: 14px;
    margin-top: 16px;
}

.template-button {
    margin-top: 16px;
    border-top: 1px solid var(--mud-palette-lines-default);
    padding-top: 16px;
}

.whatsapp-button {
    color: #027eb5 !important;
    text-transform: none !important;
}


/*///INPUT STYLES*/

/* WhatsApp Input Container */
.whatsapp-input-container {
    background-color: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-lines-default);
}

/* Message Input Wrapper */
.message-input-wrapper {
    background-color: white;
    border-radius: 8px;
    padding: 4px 8px;
    margin: 0 4px;
}

/* Input Field Customization */
.whatsapp-textfield {
    margin: 0 !important;
}

    .whatsapp-textfield .mud-input-control {
        margin: 0;
    }

    .whatsapp-textfield .mud-input {
        padding: 6px 8px;
        min-height: unset;
    }

    .whatsapp-textfield .mud-input-slot {
        padding: 0;
        font-size: 0.9375rem;
    }

    /* Remove TextField underline */
    .whatsapp-textfield .mud-input-underline::before,
    .whatsapp-textfield .mud-input-underline::after {
        display: none !important;
    }

/* Icon Button Customization */
.whatsapp-icon-button {
    padding: 6px !important;
}

.template-button {
    color: var(--mud-palette-primary) !important;
}

/* Custom Dialog Styles */
.mud-dialog.template-dialog {
    border-radius: 12px;
    overflow: hidden;
}

.mud-dialog-title.template-dialog-title {
    padding: 16px 24px;
    background-color: var(--mud-palette-primary);
    color: white;
}

/* Mobile Responsive Styles for WhatsApp UI */
.whatsapp-container {
    height: calc(100vh - var(--mud-appbar-height));
    overflow: hidden;
}

.whatsapp-mobile-container {
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.mobile-conversation-list,
.mobile-conversation-view {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
}

.mobile-back-button {
    display: none;
}

.date-separator {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 8px 0;
}

/* Whatsapp UI */

.json-tooltip {
    position: absolute;
    background-color: #2d2d2d;
    color: #fff;
    padding: 10px;
    border-radius: 4px;
    z-index: 1000;
    max-width: 500px;
    max-height: 300px;
    overflow: auto;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-family: monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

    .json-tooltip pre {
        margin: 0;
    }

.audio-message {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 300px;
}

    .audio-message audio {
        width: 100%;
        height: 40px;
    }

.audio-caption {
    font-size: 0.9em;
    color: #666;
    margin-top: 4px;
}

.image-message {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 300px;
    cursor: pointer;
}

.image-thumbnail {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.image-caption {
    font-size: 0.9em;
    color: #666;
    margin-top: 4px;
}

.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.image-modal-content {
    max-width: 90%;
    max-height: 90%;
}

    .image-modal-content img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

.video-message {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 300px;
    cursor: pointer;
    position: relative;
}

.video-thumbnail {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.video-caption {
    font-size: 0.9em;
    color: #666;
    margin-top: 4px;
}

.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.video-modal-content {
    max-width: 90%;
    max-height: 90%;
    width: 800px;
}

    .video-modal-content video {
        width: 100%;
        max-height: 80vh;
        object-fit: contain;
    }

.document-message {
    padding: 10px;
    background-color: var(--message-bg);
    border-radius: 10px;
    max-width: 300px;
}

.document-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-color);
}

    .document-link:hover {
        text-decoration: underline;
    }

.document-name {
    word-break: break-word;
}

.fas.fa-file {
    font-size: 24px;
    color: var(--primary-color);
}

/* Debug UI */

.debug-info-nav {
    display: flex;
    padding-left: 12px;
    padding-top: 5px;
    justify-content: flex-end;
}

    .debug-info-nav .cost-value {
        margin-top: 4px;
        margin-bottom: 4px;
        font-weight: bold;
        margin-left:10px;
    }

.debug-info-bubble {
    direction: ltr;
    position: absolute;
    top: 36px;
    right: 6px;
    background-color: #1e1e1e;
    color: #f5f5f5;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 8px 10px;
    z-index: 1100;
    max-width: 520px;
    min-width: 260px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.debug-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: nowrap;
}

    .debug-row .label {
        font-weight: 600;
        white-space: nowrap;
    }

    .debug-row .value {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 320px;
    }



.debug-info-bubble pre.json {
    margin: 0;
    max-height: 260px;
    overflow: auto;
    border-radius: 6px;
    padding: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    white-space: pre;
}

/* Mobile Layout Styles */
@media (max-width: 768px) {
    .desktop-grid {
        display: none !important;
    }

    .mobile-layout {
        display: block !important;
    }

    .mobile-back-button {
        display: inline-flex !important;
        margin-right: 8px;
    }

    /* Hide scrollbars on mobile and ensure full height */
    .mobile-conversation-list,
    .mobile-conversation-view {
        -webkit-overflow-scrolling: touch;
    }

        /* Ensure components take full height on mobile */
        .mobile-conversation-list > div,
        .mobile-conversation-view > div {
            height: 100%;
        }
}

@media (min-width: 769px) {
    .desktop-grid {
        display: flex !important;
    }

    .mobile-layout {
        display: none !important;
    }
}

/* General responsive improvements */
@media (max-width: 480px) {
    .whatsapp-container,
    .whatsapp-mobile-container {
        margin: 0;
        padding: 0;
        border-radius: 0;
    }

    .message-outer-wrapper {
        max-width: 90%;
    }

    .conversation-container {
        padding: 0px 20px;
    }
}
