/* base.css */
/* Global styles, root variables, and default element styles */

/* Root CSS Variables */
:root {
    --main-bg-color: white;
    --secondary-bg-color: #F3F4F6;
    --text-color: black;
    --button-color: #3B82F6;
    --button-color-hover: #2563EB;
    --button-text-color: white;
    --bg-AI-color: #F3F4F6;
    --bg-AI-text-color: #374151;
    --bg-user-color: #DBEAFE;
    --bg-user-text-color: #1D4ED8;
}

/* Base Styles */
body {
    position: relative;
    color: var(--text-color);
}

/* File input styling */
#file-input {
    display: none;
}

/* File name container styling - consolidated */
#file-name-container {
    z-index: 10;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    top: -40px;
    right: 0;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#file-name-container.hidden {
    opacity: 0;
    visibility: hidden;
}

#file-name-container:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

/* Background color utilities */
.bg-main_color {
    background-color: var(--main-bg-color);
}

.bg-secondary_color {
    background-color: var(--secondary-bg-color);
}

.bg-button_color {
    background-color: var(--button-color);
    color: var(--button-text-color);
}

.bg-button_color:hover {
    background-color: var(--button-color-hover);
}

/* Font size settings */
body[data-font='small'] {
    font-size: 0.8em;
}

body[data-font='normal'] {
    font-size: 1em;
}

body[data-font='large'] {
    font-size: 1.2em;
}

body[data-font='x-large'] {
    font-size: 1.5em;
}

body[data-font='xx-large'] {
    font-size: 2em;
}

/* Message input styling */
#message-input {
    max-height: 120px;
    overflow-y: auto;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-all;
    outline: none;
}

#message-input:empty::before {
    content: attr(placeholder);
    color: gray;
}

#message-input:focus {
    caret-color: auto;
}

#message-input span[contenteditable="false"] {
    display: inline-block;
    vertical-align: middle;
}

/* File upload section */
#file-upload-section {
    transform: translateX(100%);
    z-index: 200;
    top: 0;
    right: 0;
    height: 100vh;
    width: 33.3333%;
    background-color: var(--main-bg-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out;
    position: fixed;
    display: flex;
    flex-direction: column;
}

#file-upload-section.active {
    transform: translateX(0);
}

/* Upload loader animation */
.upload-loader {
    width: 50px;
    height: 50px;
    border: 3px solid var(--secondary-bg-color);
    border-radius: 50%;
    border-top-color: var(--button-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

#upload-backdrop {
    z-index: 190; /* Just below the upload section */
    display: none;
}

#upload-backdrop.active {
    display: block;
}

/* Pagination input styles */
.pagination-inputs {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
}

.pagination-input-group {
    margin-bottom: 0.75rem;
}

.pagination-input-group label {
    display: block;
    margin-bottom: 0.25rem;
    color: #374151;
    font-size: 0.875rem;
}

.pagination-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.pagination-input:focus {
    outline: none;
    border-color: #91785d;
    box-shadow: 0 0 0 2px rgba(145, 120, 93, 0.2);
}

@media (max-width: 1124px) {
    .modal-mobile-top {
        top: 5% !important; /* Moves modal a bit higher on mobile */
    }
}

/* Update the contenteditable div styles in the modal */
#problem-modal div[contenteditable="true"] {
    border: 2px solid #d1d5db;
    min-height: 16rem;
    height: 16rem;  /* Add fixed height */
    padding: 1rem;
    border-radius: 0.5rem;
    font-family: Georgia, serif;
    background-color: #ffffff;
    outline: none;
    transition: all 0.2s ease;
    color: #374151;
    width: 100%;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#problem-modal div[contenteditable="true"]:focus {
    border-color: #91785d;
    box-shadow: 0 0 0 2px rgba(145, 120, 93, 0.2);
}

/* Add responsive adjustments */
@media (max-width: 1124px) {
    #problem-modal div[contenteditable="true"] {
        min-height: 12rem;
        height: 12rem;
        padding: 0.75rem;
    }
}
