/* Smart Forex Calendar - Frontend Styles */
/* Modern, Interactive & Responsive Design */

:root {
    --sfc-primary: #2563eb;
    --sfc-secondary: #64748b;
    --sfc-success: #10b981;
    --sfc-warning: #f59e0b;
    --sfc-danger: #ef4444;
    --sfc-bg-primary: #ffffff;
    --sfc-bg-secondary: #f8fafc;
    --sfc-text-primary: #1e293b;
    --sfc-text-secondary: #64748b;
    --sfc-border: #e2e8f0;
    --sfc-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --sfc-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --sfc-radius: 12px;
    --sfc-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --sfc-bg-primary: #1e293b;
    --sfc-bg-secondary: #0f172a;
    --sfc-text-primary: #f1f5f9;
    --sfc-text-secondary: #cbd5e1;
    --sfc-border: #334155;
}

/* Main Container */
.sfc-calendar-widget {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--sfc-text-primary);
    background: var(--sfc-bg-secondary);
    border-radius: var(--sfc-radius);
}

/* Warning Banner */
.sfc-warning-banner {
    position: sticky;
    top: 0;
    z-index: 1000;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.sfc-warning-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5);
    }
}

.sfc-warning-icon {
    flex-shrink: 0;
    color: white;
    animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.sfc-warning-text {
    flex: 1;
    color: white;
}

.sfc-warning-title {
    display: block;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sfc-warning-message {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    opacity: 0.95;
}

.sfc-warning-close {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 6px;
    padding: 8px;
    color: white;
    cursor: pointer;
    transition: var(--sfc-transition);
}

.sfc-warning-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Filters Panel */
.sfc-filters-panel {
    background: var(--sfc-bg-primary);
    border-radius: var(--sfc-radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--sfc-shadow);
    transition: var(--sfc-transition);
}

.sfc-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sfc-filters-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--sfc-text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sfc-filters-toggle {
    display: none;
    background: var(--sfc-primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: var(--sfc-transition);
}

.sfc-filters-toggle:hover {
    background: #1d4ed8;
    transform: scale(1.05);
}

.sfc-filters-content {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
}

.sfc-filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 180px;
}

.sfc-filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--sfc-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sfc-filter-select {
    padding: 12px 16px;
    border: 2px solid var(--sfc-border);
    border-radius: 8px;
    font-size: 15px;
    background: var(--sfc-bg-primary);
    color: var(--sfc-text-primary);
    transition: var(--sfc-transition);
    cursor: pointer;
}

.sfc-filter-select:focus {
    outline: none;
    border-color: var(--sfc-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.sfc-filter-actions {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.sfc-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--sfc-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sfc-btn-primary {
    background: var(--sfc-primary);
    color: white;
}

.sfc-btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: var(--sfc-shadow-lg);
}

.sfc-btn-secondary {
    background: var(--sfc-bg-secondary);
    color: var(--sfc-text-secondary);
    border: 2px solid var(--sfc-border);
}

.sfc-btn-secondary:hover {
    background: var(--sfc-border);
}

/* View Controls */
.sfc-view-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--sfc-bg-primary);
    border-radius: var(--sfc-radius);
    box-shadow: var(--sfc-shadow);
}

.sfc-view-toggle {
    display: flex;
    gap: 8px;
    background: var(--sfc-bg-secondary);
    padding: 4px;
    border-radius: 8px;
}

.sfc-view-btn {
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--sfc-text-secondary);
    transition: var(--sfc-transition);
}

.sfc-view-btn:hover {
    background: var(--sfc-bg-primary);
    color: var(--sfc-primary);
}

.sfc-view-btn.active {
    background: var(--sfc-primary);
    color: white;
}

.sfc-live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--sfc-success);
}

.sfc-pulse {
    width: 8px;
    height: 8px;
    background: var(--sfc-success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Loading Overlay */
.sfc-loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
}

.sfc-loading-overlay.active {
    display: flex;
}

.sfc-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.sfc-loading-overlay p {
    color: white;
    font-size: 16px;
    font-weight: 600;
}

/* Events Container */
.sfc-events-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* List View */
[data-view="list"] .sfc-events-container {
    grid-template-columns: 1fr;
}

/* Timeline View */
[data-view="timeline"] .sfc-events-container {
    grid-template-columns: 1fr;
    gap: 0;
}

[data-view="timeline"] .sfc-event-card {
    border-radius: 0;
    border-left: 4px solid var(--sfc-primary);
    position: relative;
    padding-left: 32px;
}

[data-view="timeline"] .sfc-event-card::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 24px;
    width: 12px;
    height: 12px;
    background: var(--sfc-primary);
    border-radius: 50%;
    border: 3px solid var(--sfc-bg-primary);
}

/* Event Card */
.sfc-event-card {
    background: var(--sfc-bg-primary);
    border-radius: var(--sfc-radius);
    padding: 20px;
    box-shadow: var(--sfc-shadow);
    transition: var(--sfc-transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.sfc-event-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--sfc-shadow-lg);
}

.sfc-event-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--sfc-primary);
    transition: var(--sfc-transition);
}

.sfc-event-card[data-impact="high"]::before {
    background: var(--sfc-danger);
}

.sfc-event-card[data-impact="medium"]::before {
    background: var(--sfc-warning);
}

.sfc-event-card[data-impact="low"]::before {
    background: var(--sfc-success);
}

/* Event Header */
.sfc-event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.sfc-event-time {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sfc-date {
    font-size: 14px;
    font-weight: 600;
    color: var(--sfc-text-secondary);
    text-transform: uppercase;
}

.sfc-time {
    font-size: 20px;
    font-weight: 700;
    color: var(--sfc-primary);
}

.sfc-event-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sfc-currency-badge {
    padding: 6px 12px;
    background: var(--sfc-primary);
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sfc-impact-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sfc-impact-high {
    background: #fee2e2;
    color: var(--sfc-danger);
}

.sfc-impact-medium {
    background: #fef3c7;
    color: var(--sfc-warning);
}

.sfc-impact-low {
    background: #d1fae5;
    color: var(--sfc-success);
}

/* Event Title */
.sfc-event-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--sfc-text-primary);
    margin: 0 0 16px 0;
    line-height: 1.4;
}

/* Event Meta */
.sfc-event-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--sfc-bg-secondary);
    border-radius: 8px;
}

.sfc-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sfc-meta-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--sfc-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sfc-meta-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--sfc-text-primary);
}

.sfc-actual-value {
    color: var(--sfc-success);
    font-weight: 700;
}

/* Impact Bar */
.sfc-event-impact {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.sfc-impact-bar {
    flex: 1;
    height: 8px;
    background: var(--sfc-bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.sfc-impact-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease-in-out;
}

.sfc-impact-fill.sfc-impact-high {
    background: linear-gradient(90deg, var(--sfc-danger), #dc2626);
}

.sfc-impact-fill.sfc-impact-medium {
    background: linear-gradient(90deg, var(--sfc-warning), #d97706);
}

.sfc-impact-fill.sfc-impact-low {
    background: linear-gradient(90deg, var(--sfc-success), #059669);
}

.sfc-impact-score {
    font-size: 14px;
    font-weight: 700;
    color: var(--sfc-text-primary);
    white-space: nowrap;
}

/* Countdown */
.sfc-countdown {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--sfc-bg-secondary);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sfc-text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.sfc-countdown svg {
    flex-shrink: 0;
}

.sfc-countdown-text {
    flex: 1;
}

.sfc-countdown.passed {
    color: var(--sfc-text-secondary);
    opacity: 0.6;
}

.sfc-countdown.upcoming {
    color: var(--sfc-primary);
}

.sfc-countdown.imminent {
    color: var(--sfc-danger);
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Event Card Actions (Countdown + Buttons) */
.sfc-event-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.sfc-event-action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Actual Value Styling */
.sfc-meta-actual {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid var(--sfc-success);
}

.sfc-meta-actual .sfc-actual-value {
    color: var(--sfc-success);
    font-weight: 700;
}

/* Chart Button */
.sfc-chart-button,
.sfc-show-history-btn,
.sfc-sync-actual-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--sfc-primary) 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--sfc-transition);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
    white-space: nowrap;
}

.sfc-show-history-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2);
}

.sfc-sync-actual-btn {
    background: linear-gradient(135deg, var(--sfc-success) 0%, #059669 100%);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.sfc-chart-button:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.sfc-show-history-btn:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.sfc-sync-actual-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.sfc-chart-button:active,
.sfc-show-history-btn:active,
.sfc-sync-actual-btn:active {
    transform: translateY(0);
}

.sfc-chart-button:disabled,
.sfc-show-history-btn:disabled,
.sfc-sync-actual-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.sfc-chart-button svg,
.sfc-show-history-btn svg,
.sfc-sync-actual-btn svg {
    flex-shrink: 0;
}

/* TradingView Chart Modal */
.sfc-chart-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.sfc-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sfc-modal-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    background: var(--sfc-bg-primary);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.sfc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid var(--sfc-border);
}

.sfc-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--sfc-text-primary);
}

.sfc-modal-close {
    background: transparent;
    border: none;
    color: var(--sfc-text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--sfc-transition);
}

.sfc-modal-close:hover {
    background: var(--sfc-bg-secondary);
    color: var(--sfc-danger);
    transform: scale(1.1);
}

.sfc-modal-body {
    flex: 1;
    padding: 24px;
    overflow: auto;
}

#sfc-tradingview-widget {
    width: 100%;
    height: 600px;
    border-radius: 8px;
    overflow: hidden;
}

/* Modal Responsive */
@media (max-width: 768px) {
    .sfc-chart-modal {
        padding: 0;
    }
    
    .sfc-modal-content {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    #sfc-tradingview-widget {
        height: 400px;
    }
}

/* No Events */
.sfc-no-events {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--sfc-text-secondary);
}

.sfc-no-events svg {
    opacity: 0.3;
    margin-bottom: 20px;
}

.sfc-no-events p {
    font-size: 18px;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sfc-calendar-widget {
        padding: 12px;
    }
    
    .sfc-filters-toggle {
        display: block;
    }
    
    .sfc-filters-content {
        display: none;
        grid-template-columns: 1fr;
        margin-top: 16px;
    }
    
    .sfc-filters-content.active {
        display: grid;
    }
    
    .sfc-events-container {
        grid-template-columns: 1fr;
    }
    
    .sfc-view-controls {
        flex-direction: column;
        gap: 12px;
    }
    
    .sfc-event-meta {
        grid-template-columns: 1fr;
    }
    
    /* Stack event actions vertically on mobile */
    .sfc-event-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sfc-countdown {
        width: 100%;
        justify-content: center;
    }
    
    .sfc-event-action-buttons {
        flex-direction: column;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .sfc-filters-header h3 {
        font-size: 18px;
    }
    
    .sfc-event-title {
        font-size: 16px;
    }
    
    .sfc-filter-actions {
        flex-direction: column;
    }
    
    .sfc-btn {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .sfc-filters-panel,
    .sfc-view-controls {
        display: none;
    }
    
    .sfc-event-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
