/* ======================== */
/* === History Page Styles === */
/* ======================== */

.main-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.main-content-header h1 {
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.reload-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--text-color);
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reload-button:hover {
    background-color: #f0f0e6;
    border-color: #ccc;
}

/* Style the image inside the button */
.reload-button img {
    width: 20px; /* Adjust size as needed */
    height: 20px; /* Adjust size as needed */
    transition: transform 0.5s ease;
}

/* Apply the spinning animation to the image on click */
.reload-button:active img {
    transform: rotate(-360deg);
}

/* All other history page styles remain the same */
.history-container {
    display: grid;
    gap: 1.5rem;
}

.chat-item {
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.chat-item h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-color);
}

.chat-item .timestamp {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 1rem;
}

.chat-item .snippet {
    font-size: 1rem;
    color: #555;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delete-history-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%; /* Makes the button circular */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Prevents the button from shrinking */
    margin-left: 1rem;
    transition: background-color 0.2s ease;
}

/* Style the icon image *inside* the button */
.delete-history-btn img {
    width: 18px; /* Adjust size of the icon itself */
    height: 18px;
    opacity: 0.6; /* Makes the icon a bit more subtle */
    transition: opacity 0.2s ease;
}

/* Add a clean hover effect */
.delete-history-btn:hover {
    background-color: #f0f0e6; /* A light, clean background on hover */
}

.delete-history-btn:hover img {
    opacity: 1; /* Makes the icon fully visible on hover */
}

/* Styles for the chat view modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    background: #fff;
    width: 90%;
    max-width: 700px;
    height: 80%;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h2 { margin: 0; font-size: 1.2rem; }
.close-modal-btn { background: none; border: none; font-size: 1.8rem; cursor: pointer; color: #888; }
.modal-body { padding: 1.5rem; overflow-y: auto; flex-grow: 1; display: flex; flex-direction: column; gap: 1rem; }
.modal-body .message { padding: 0.5rem 1rem; border-radius: 12px; max-width: 85%; }
.modal-body .message.user { background-color: #eef2ff; color: #4338ca; align-self: flex-end; }
.modal-body .message.ai { background-color: #f1f5f9; color: #334155; align-self: flex-start; }
.modal-body .message strong { display: block; margin-bottom: 0.25rem; font-size: 0.8rem; opacity: 0.8; }