/* public/styles.css */
:root {
    --upway-primary: #413FFC;
    --upway-secondary: #FD8A5B;
    --upway-light-bg: #f8f9fa;
    --upway-text: #1E1E1E;
    --upway-border: #E5E7EB;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Space Grotesk', sans-serif;
    background-color: var(--upway-light-bg);
    color: var(--upway-text);
    height: 100vh;
}

/* Thread ID styles */
.thread-id-value {
    font-family: 'Space Grotesk', monospace;
    font-size: 15px;
    font-weight: 500;
    color: var(--upway-text);
    flex-grow: 1;
    overflow-x: auto;
    white-space: nowrap;
    padding: 4px 0;
}

/* Login Styles */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--upway-light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    animation: fadeIn 0.3s ease-out;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo img {
    height: 48px;
    width: auto;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: var(--upway-text);
    font-size: 0.875rem;
}

.form-group input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--upway-border);
    border-radius: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--upway-primary);
}

.login-btn {
    background-color: var(--upway-primary);
    color: white;
    padding: 0.875rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: 'Space Grotesk', sans-serif;
}

.login-btn:hover {
    background-color: #3532e0;
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.login-error {
    color: #dc2626;
    text-align: center;
    font-size: 0.875rem;
    min-height: 1.25rem;
}

/* Purchase Status Styles */
.purchase-status-btn {
    width: 100%;
    padding: 12px 20px;
    background-color: var(--upway-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.2s;
    margin-bottom: 12px;
}

.purchase-status-btn:hover {
    background-color: #3532e0;
}

.purchase-status-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.purchase-status-result {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    padding: 12px;
    background-color: var(--upway-light-bg);
    border-radius: 6px;
    margin-top: 8px;
    min-height: 20px;
}

.status-checking,
.status-negative,
.status-positive,
.status-waiting,
.status-error {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-radius: 6px;
    background-color: white;
    border: 1px solid var(--upway-border);
}

.status-warning {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-radius: 6px;
    background-color: #FFFAF0;
    border: 1px solid #F6AD55;
}

.status-icon {
    font-size: 16px;
    margin-right: 8px;
}

.status-positive {
    border-color: #10B981;
    background-color: #F0FDF4;
}

.status-negative {
    border-color: #EF4444;
    background-color: #FEF2F2;
}

.status-waiting {
    border-color: #F59E0B;
    background-color: #FFFBEB;
}

.status-error {
    border-color: #EF4444;
    background-color: #FEF2F2;
}

.status-header {
    font-weight: 600;
    color: var(--upway-text);
    display: flex;
    align-items: center;
}

.status-date {
    color: #666;
    padding-left: 28px;
}

/* Main App Styles */
.header {
    background-color: white;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--upway-border);
    display: flex;
    align-items: center;
}

.logo {
    height: 48px;
    width: auto;
}

.user-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-email {
    font-size: 0.875rem;
    color: var(--upway-text);
}

.logout-btn {
    background-color: transparent;
    border: 1px solid var(--upway-border);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background-color: var(--upway-light-bg);
}

.container {
    display: flex;
    height: calc(100vh - 96px);
}

/* Sidebar Styles */
.sidebar {
    width: 25%;
    border-right: 1px solid var(--upway-border);
    background-color: white;
    display: flex;
    flex-direction: column;
}

.refresh-btn {
    margin: 0 16px 16px 16px;  /* Changed from margin: 16px to be more specific */
    padding: 12px 20px;
    background-color: var(--upway-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.2s;
}

.refresh-btn:hover {
    background-color: #3532e0;
}

.refresh-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.thread-list {
    list-style: none;
    padding: 0;
    padding-top: 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

.thread-item {
    padding: 16px;
    border-bottom: 1px solid var(--upway-border);
    cursor: pointer;
    transition: all 0.2s;
    background-color: white;
}

.thread-item:hover {
    background-color: #f5f5ff;
    transform: translateX(4px);
}

.thread-item.active {
    background-color: #f5f5ff !important;
    border-left: 4px solid var(--upway-primary);
    color: var(--upway-text) !important;
}

.thread-item.active .thread-date {
    color: #555 !important;
}

/* Update the customer info display */
.customer-info {
    font-size: 15px;
    font-weight: 500;
    color: var(--upway-text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.customer-info::after {
    content: '›';
    color: #999;
    font-size: 18px;
    opacity: 0.7;
}

.thread-date {
    font-size: 13px;
    color: #666;
}



/* Conversation Panel Styles */
.conversation-panel {
    width: 50%;
    background-color: var(--upway-light-bg);
    padding: 24px;
    overflow-y: auto;
}

/* Details Panel Styles */
.details-panel {
    width: 25%;
    background-color: white;
    border-left: 1px solid var(--upway-border);
    padding: 20px;
    overflow-y: auto;
}

.details-section {
    margin-bottom: 24px;
    padding: 16px;
    background-color: var(--upway-light-bg);
    border-radius: 8px;
}

.details-title {
    font-weight: 600;
    color: var(--upway-primary);
    margin-bottom: 12px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.details-item {
    margin-bottom: 8px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--upway-border);
}

.details-item:last-child {
    border-bottom: none;
}

.details-label {
    color: #666;
    flex: 1;
}

.details-value {
    font-weight: 500;
    margin-left: 16px;
    text-align: right;
    word-break: break-word;
}

/* Message Styles */
.message {
    margin-bottom: 24px;
    max-width: 85%;
    animation: fadeIn 0.3s ease-in;
}

.message.assistant {
    margin-right: auto;
}

.message.user {
    margin-left: auto;
}

.message.automated {
    margin-right: auto;
}

.message-bubble {
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.message.assistant .message-bubble {
    background-color: white;
    border: 1px solid var(--upway-border);
}

.message.user .message-bubble {
    background-color: var(--upway-primary);
    color: white;
}

.message.automated .message-bubble {
    background-color: var(--upway-secondary);
    color: white;
}

.message-role {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.message.assistant .message-role {
    color: var(--upway-secondary);
}

.message.user .message-role {
    color: rgba(255, 255, 255, 0.9);
}

.message.automated .message-role {
    color: rgba(255, 255, 255, 0.9);
}

.timestamp {
    font-size: 12px;
    margin-top: 8px;
    opacity: 0.7;
}

.thread-id {
    font-family: 'Space Grotesk', monospace;
    font-size: 14px;
    color: var(--upway-text);
    margin-bottom: 4px;
    word-break: break-all;
}

.thread-date {
    font-size: 12px;
    color: #666;
}

.message-content {
    white-space: pre-wrap;
    word-break: break-word;
}

/* Utility Styles */
.no-messages {
    text-align: center;
    color: #666;
    margin-top: 40px;
    font-style: italic;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--upway-primary);
    font-weight: 500;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    margin-left: 12px;
    border: 2px solid var(--upway-primary);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

.empty-details {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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


/* Style for the dropdown options December 5 2024 */

.conversation-type-selector {
    padding: 16px 16px 0 16px;  /* Add top padding */
    margin-bottom: 16px;
}

.custom-select {
    width: 100%;
    padding: 12px 20px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--upway-text);
    background-color: white;
    border: 1px solid var(--upway-border);
    border-radius: 8px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    transition: all 0.2s;
}

.custom-select:hover {
    background-color: var(--upway-light-bg);
}

.custom-select:focus {
    outline: none;
    border-color: var(--upway-primary);
    box-shadow: 0 0 0 2px rgba(65, 63, 252, 0.1);
}

/* Style for the dropdown options */
.custom-select option {
    font-family: 'Space Grotesk', sans-serif;
    padding: 12px 20px;
    background-color: white;
    color: var(--upway-text);
}

.search-container {
    padding: 0 16px;
    margin-bottom: 16px;
    position: relative; /* Ensure this is set */
}

.search-input {
    width: 100%;
    box-sizing: border-box; /* Important: include padding in width calculation */
    padding: 12px 20px;
    padding-right: 40px;  /* Add right padding to prevent text overlap with clear button */
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--upway-text);
    background-color: white;
    border: 1px solid var(--upway-border);
    border-radius: 8px;
    transition: all 0.2s;
    height: 44px; /* Match height of dropdown */
}

.search-input::placeholder {
    color: #666;
    font-weight: normal;
}

.search-input:hover {
    background-color: var(--upway-light-bg);
}

.search-input:focus {
    outline: none;
    border-color: var(--upway-primary);
    box-shadow: 0 0 0 2px rgba(65, 63, 252, 0.1);
}

.clear-search {
    position: absolute;
    right: 24px;            /* Adjust right position */
    top: 50%;              /* Center vertically */
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    display: none;
    z-index: 1;           /* Ensure button is clickable */
}

.clear-search:hover {
    color: var(--upway-primary);
}