/* --- History Page Styles --- */

/* Controls: Search and Filters */
.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.search-container {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.search-container .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

.search-container input {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 2.8rem;
    border: 1px solid var(--surface-border);
    border-radius: 9999px;
    background: var(--surface);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition);
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.filter-tabs {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 9999px;
    padding: 0.3rem;
    gap: 0.2rem;
}

.filter-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 9999px;
    font-family: var(--font-sans);
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.filter-btn:hover {
    color: var(--text-main);
}

.filter-btn.active {
    background: var(--bg-alt);
    color: var(--primary);
    font-weight: 600;
}

[data-theme="dark"] .filter-btn.active {
    background: #2a3441;
}

/* History List & Cards */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.history-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-light);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .history-card:hover {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
}

/* Left side of card (Info) */
.history-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 0; /* allows text truncation */
}

.history-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.history-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.history-meta-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.meta-item i {
    font-size: 1rem;
    color: var(--primary);
}

.meta-item img.tiny-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

/* Right side of card (Actions) */
.history-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--surface);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.1rem;
    border: 1px solid var(--surface-border);
}

.action-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: transparent;
}

.action-btn.play-btn {
    background: var(--primary);
    color: white;
    border-color: transparent;
}

.action-btn.play-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.action-btn.delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem;
    text-align: center;
    background: var(--glass-bg);
    border: 1px dashed var(--surface-border);
    border-radius: 16px;
}

.empty-state.hidden {
    display: none !important;
}

.empty-icon {
    font-size: 4rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h2 {
    margin-bottom: 0.5rem;
}

.empty-state p {
    max-width: 400px;
    margin: 0 auto 1.5rem auto;
}

/* Responsive */
@media (max-width: 768px) {
    .empty-state {
        padding: 2rem 1rem;
    }
    .empty-icon {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }
    .empty-state h2 {
        font-size: 1.1rem;
    }
    .empty-state p {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }
    .empty-state .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    .history-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .history-actions {
        width: 100%;
        justify-content: space-between;
        padding-top: 1rem;
        border-top: 1px solid var(--surface-border);
    }
    
    .history-controls {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .search-container {
        max-width: 100%;
        width: 100%;
    }
    
    .filter-tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px; /* for scrollbar */
        width: 100%;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }
}
