/* ===========================================================================
   PHASE 3: ADVANCED FEATURES - CSS (HISTORY ONLY)
   Features: History & Logs
   =========================================================================== */

/* ===== HISTORY BUTTON ===== */
.history-btn {
    position: fixed;
    top: 15px;
    right: 140px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(240, 147, 251, 0.35);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9997;
}

.history-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 24px rgba(240, 147, 251, 0.5);
}

.history-btn i {
    transition: transform 0.4s ease;
}

.history-btn:hover i {
    transform: rotate(360deg);
}

/* ===== HISTORY MODAL ===== */
.history-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.history-modal-content {
    background: var(--theme-bg-secondary, #1A1A1A);
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--theme-border, #333);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

.history-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.history-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.history-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.history-toolbar {
    padding: 16px 24px;
    background: var(--theme-bg-tertiary, #252525);
    border-bottom: 1px solid var(--theme-border, #333);
    display: flex;
    gap: 12px;
}

.btn-export-history,
.btn-clear-history {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-export-history {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-export-history:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-clear-history {
    background: #dc3545;
    color: white;
    margin-left: auto;
}

.btn-clear-history:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.history-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.no-history {
    text-align: center;
    padding: 60px 20px;
    color: var(--theme-text-secondary, #B0B0B0);
    font-size: 1.1rem;
}

.history-item {
    background: var(--theme-bg-primary, #0D0D0D);
    border: 1px solid var(--theme-border, #333);
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
}

.history-item:hover {
    border-color: var(--theme-accent, #8A2BE2);
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.15);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-checker-type {
    color: var(--theme-accent, #8A2BE2);
    font-weight: 600;
    font-size: 1rem;
}

.history-date {
    color: var(--theme-text-secondary, #B0B0B0);
    font-size: 0.85rem;
}

.history-item-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    gap: 6px;
}

.stat-label {
    color: var(--theme-text-secondary, #B0B0B0);
    font-size: 0.9rem;
}

.stat-value {
    color: var(--theme-text-primary, #E8E8E8);
    font-weight: 600;
    font-size: 0.9rem;
}

.stat-success {
    color: #28a745;
}

.stat-failed {
    color: #dc3545;
}

.stat-vbv {
    color: #ffc107;
}

.history-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--theme-border, #333);
}

.history-duration {
    color: var(--theme-text-secondary, #B0B0B0);
    font-size: 0.85rem;
}

.btn-replay {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--theme-accent, #8A2BE2);
    color: var(--theme-accent, #8A2BE2);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-replay:hover {
    background: var(--theme-accent, #8A2BE2);
    color: white;
}

/* ===== LIGHT MODE OVERRIDES ===== */
html[data-theme="light"] .history-btn {
    background: linear-gradient(135deg, #FA8BFF 0%, #2BD2FF 100%);
    box-shadow: 0 4px 16px rgba(250, 139, 255, 0.35);
}

html[data-theme="light"] .history-modal-content {
    background: #FFFFFF;
    border-color: #E2E8F0;
}

html[data-theme="light"] .history-toolbar {
    background: #F7FAFC;
    border-bottom-color: #E2E8F0;
}

html[data-theme="light"] .history-body {
    background: #F7FAFC;
}

html[data-theme="light"] .history-item {
    background: #FFFFFF;
    border-color: #E2E8F0;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .history-btn {
        top: 70px;
        right: 130px;
        width: 42px;
        height: 42px;
        font-size: 1rem;
    }

    .history-modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .history-toolbar {
        flex-wrap: wrap;
    }
}
