/**
 * History View Styles for Pet Companion
 */

/* Tab Navigation */
#tabs {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab {
    flex: 1;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.tab.active {
    background: rgba(74, 222, 128, 0.3);
    color: #4ade80;
}

/* Tab Content */
.tab-content {
    display: none;
    height: 100%;
    overflow: hidden;
}

.tab-content.active {
    display: block;
}

/* History View Container */
#history-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
}

/* Search Bar */
#history-search {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#search-input {
    flex: 1;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 12px;
}

#search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#search-input:focus {
    outline: none;
    border-color: #4ade80;
}

#filter-select {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 12px;
    cursor: pointer;
}

/* Conversation List */
#conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.conversation-item {
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.conversation-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(74, 222, 128, 0.5);
}

.conversation-item.selected {
    background: rgba(74, 222, 128, 0.2);
    border-color: #4ade80;
}

.conversation-title {
    font-size: 13px;
    font-weight: 600;
    color: white;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.conversation-date {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.conversation-preview {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-tags {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.conversation-tag {
    padding: 2px 8px;
    background: rgba(74, 222, 128, 0.2);
    border-radius: 12px;
    font-size: 10px;
    color: #4ade80;
}

/* Conversation Detail View */
#conversation-detail {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-header {
    margin-bottom: 16px;
}

.detail-title {
    font-size: 16px;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
}

.detail-meta {
    display: flex;
    gap: 16px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.detail-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.detail-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.detail-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.detail-btn.primary {
    background: rgba(74, 222, 128, 0.3);
    border-color: #4ade80;
    color: #4ade80;
}

.detail-btn.primary:hover {
    background: rgba(74, 222, 128, 0.5);
}

/* Messages List */
#messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-item {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid transparent;
}

.message-item.user {
    border-left-color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
}

.message-item.assistant {
    border-left-color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.message-item.system {
    border-left-color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.message-role {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.message-role.user { color: #60a5fa; }
.message-role.assistant { color: #4ade80; }
.message-role.system { color: #fbbf24; }

.message-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
}

.message-content {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    padding: 24px;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 14px;
}

/* Split View */
#history-split {
    display: flex;
    height: 100%;
}

#history-split.left-panel {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

#history-split.right-panel {
    flex: 2;
}

/* Scrollbar Styling */
#conversation-list::-webkit-scrollbar,
#conversation-detail::-webkit-scrollbar {
    width: 6px;
}

#conversation-list::-webkit-scrollbar-track,
#conversation-detail::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

#conversation-list::-webkit-scrollbar-thumb,
#conversation-detail::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#conversation-list::-webkit-scrollbar-thumb:hover,
#conversation-detail::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Loading State */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #4ade80;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}
