/**
 * Event History Styles
 * 
 * Styles for historical data display and actual value tracking
 */

/* ===========================
   History Modal
   =========================== */
.sfc-history-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sfc-history-modal-active {
    opacity: 1;
    visibility: visible;
}

.sfc-history-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.sfc-history-modal-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    margin: 5vh auto;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    border-radius: 16px;
    border: 1px solid rgba(34, 197, 94, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sfc-history-modal-header {
    padding: 24px 30px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
    border-bottom: 1px solid rgba(34, 197, 94, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.sfc-history-modal-header h3 {
    margin: 0;
    color: #22c55e;
    font-size: 22px;
    font-weight: 700;
    flex: 1;
}

.sfc-history-modal-meta {
    display: flex;
    gap: 12px;
    align-items: center;
}

.sfc-history-currency,
.sfc-history-country {
    padding: 6px 12px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 6px;
    color: #22c55e;
    font-size: 12px;
    font-weight: 600;
}

.sfc-history-modal-close {
    width: 36px;
    height: 36px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 50%;
    color: #ef4444;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sfc-history-modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.1);
}

.sfc-history-modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

/* ===========================
   History Chart
   =========================== */
.sfc-history-chart-container {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(34, 197, 94, 0.2);
    height: 300px;
}

#sfc-history-chart {
    max-height: 260px;
}

/* ===========================
   History Table
   =========================== */
.sfc-history-table-container {
    overflow-x: auto;
}

.sfc-history-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 12px;
    overflow: hidden;
}

.sfc-history-table thead {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.1));
}

.sfc-history-table th {
    padding: 14px 16px;
    text-align: left;
    color: #22c55e;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(34, 197, 94, 0.3);
}

.sfc-history-table tbody tr {
    border-bottom: 1px solid rgba(34, 197, 94, 0.1);
    transition: background 0.2s ease;
}

.sfc-history-table tbody tr:hover {
    background: rgba(34, 197, 94, 0.05);
}

.sfc-history-table tbody tr:last-child {
    border-bottom: none;
}

.sfc-history-table td {
    padding: 12px 16px;
    color: #cbd5e1;
    font-size: 14px;
}

.sfc-history-value {
    font-weight: 600;
    color: #e2e8f0;
}

.sfc-has-value {
    color: #22c55e;
}

.sfc-change-positive {
    color: #22c55e;
    font-weight: 600;
}

.sfc-change-negative {
    color: #ef4444;
    font-weight: 600;
}

.sfc-history-empty {
    padding: 60px 30px;
    text-align: center;
    color: #94a3b8;
}

.sfc-history-empty p {
    margin: 0;
    font-size: 16px;
}

/* ===========================
   Buttons
   =========================== */
.sfc-show-history-btn,
.sfc-sync-actual-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sfc-show-history-btn:hover,
.sfc-sync-actual-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.sfc-sync-actual-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.sfc-sync-actual-btn:hover {
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.sfc-show-history-btn:disabled,
.sfc-sync-actual-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===========================
   Actual Value Display
   =========================== */
.sfc-event-actual-container {
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(22, 163, 74, 0.1));
    border-radius: 8px;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.sfc-event-actual-label {
    display: block;
    color: #22c55e;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.sfc-event-actual-value {
    display: block;
    color: #e2e8f0;
    font-size: 24px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.sfc-value-updated {
    animation: valueUpdate 2s ease;
}

@keyframes valueUpdate {
    0%, 100% {
        background: transparent;
    }
    50% {
        background: rgba(34, 197, 94, 0.3);
    }
}

.sfc-event-no-actual {
    color: #94a3b8;
    font-style: italic;
}

/* ===========================
   Notifications
   =========================== */
.sfc-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    background: rgba(15, 23, 42, 0.95);
    border-radius: 8px;
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100001;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
}

.sfc-notification-show {
    transform: translateX(0);
    opacity: 1;
}

.sfc-notification-success {
    border-color: rgba(34, 197, 94, 0.5);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(22, 163, 74, 0.1));
}

.sfc-notification-error {
    border-color: rgba(239, 68, 68, 0.5);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
}

/* ===========================
   Event Data Comparison
   =========================== */
.sfc-event-data-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.sfc-event-data-item {
    padding: 12px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.sfc-event-data-label {
    display: block;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.sfc-event-data-value {
    display: block;
    color: #e2e8f0;
    font-size: 18px;
    font-weight: 700;
}

.sfc-event-data-actual {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.05);
}

.sfc-event-data-actual .sfc-event-data-value {
    color: #22c55e;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 768px) {
    .sfc-history-modal-content {
        width: 95%;
        margin: 2.5vh auto;
        max-height: 95vh;
    }
    
    .sfc-history-modal-header {
        padding: 20px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .sfc-history-modal-header h3 {
        font-size: 18px;
    }
    
    .sfc-history-modal-close {
        position: absolute;
        top: 16px;
        right: 16px;
    }
    
    .sfc-history-modal-body {
        padding: 20px;
    }
    
    .sfc-history-chart-container {
        height: 250px;
        padding: 15px;
    }
    
    .sfc-history-table th,
    .sfc-history-table td {
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .sfc-event-data-comparison {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .sfc-notification {
        right: 10px;
        left: 10px;
        top: 10px;
    }
    
    .sfc-history-table {
        font-size: 11px;
    }
    
    .sfc-history-table th,
    .sfc-history-table td {
        padding: 8px 6px;
    }
}
