/**
 * Unified Historical Events Page Styles
 * Single-page layout combining live events, pipeline review, and publishing.
 */

/* ============================================
   HEADER & DATE NAV
   ============================================ */

.unified-events-section {
    padding: 24px;
}

.unified-header {
    margin-bottom: 20px;
}

.unified-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.unified-title-block h2 {
    margin: 0 0 4px 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--slate-900);
}

.unified-title-block p {
    margin: 0;
    font-size: 14px;
    color: var(--slate-500);
}

.pipeline-status-chip {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 20px;
    font-size: 13px;
    color: #92400e;
    font-weight: 500;
}

.pipeline-status-chip.active {
    display: inline-flex;
}

.pipeline-status-chip .status-dot {
    width: 8px;
    height: 8px;
    background: #f59e0b;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.pipeline-status-chip .cancel-all-btn {
    margin-left: 6px;
    padding: 2px 8px;
    font-size: 11px;
    background: white;
    border: 1px solid #fbbf24;
    border-radius: 4px;
    color: #92400e;
    cursor: pointer;
}

.unified-date-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid var(--slate-200);
    border-radius: 12px;
    flex-wrap: wrap;
}

.btn-icon {
    width: 36px;
    height: 36px;
    background: white;
    border: 2px solid var(--slate-200);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.btn-icon:hover {
    border-color: var(--patriot-blue);
    color: var(--patriot-blue);
}

.date-picker {
    padding: 8px 12px;
    border: 2px solid var(--slate-200);
    border-radius: 8px;
    font-size: 14px;
    font-family: monospace;
}

.date-picker:focus {
    outline: none;
    border-color: var(--patriot-blue);
}

.unified-date-label {
    margin-left: auto;
    font-size: 16px;
    font-weight: 700;
    color: var(--slate-700);
}

/* ============================================
   ACTIONS BAR
   ============================================ */

.unified-actions-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.unified-actions-bar button {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.unified-actions-bar button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.unified-actions-bar .btn-primary {
    background: var(--patriot-blue);
    color: white;
}

.unified-actions-bar .btn-primary:hover:not(:disabled) {
    background: #163a5f;
    transform: translateY(-1px);
}

.unified-actions-bar .btn-secondary {
    background: white;
    border: 2px solid var(--slate-300);
    color: var(--slate-700);
}

.unified-actions-bar .btn-secondary:hover:not(:disabled) {
    border-color: var(--patriot-blue);
    color: var(--patriot-blue);
}

.unified-actions-bar .btn-success {
    background: #059669;
    color: white;
}

.unified-actions-bar .btn-success:hover:not(:disabled) {
    background: #047857;
    transform: translateY(-1px);
}

/* ============================================
   CONTENT PANELS
   ============================================ */

.unified-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1100px) {
    .unified-content {
        grid-template-columns: 1fr;
    }
}

.unified-panel {
    background: white;
    border: 2px solid var(--slate-200);
    border-radius: 12px;
    overflow: hidden;
}

.unified-panel-live {
    border-color: #10b981;
}

.unified-panel-pipeline {
    border-color: var(--patriot-blue);
}

.unified-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    border-bottom: 2px solid var(--slate-200);
}

.unified-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--slate-800);
}

.panel-count {
    font-size: 12px;
    color: var(--slate-500);
    font-weight: 500;
}

.pipeline-status-filter {
    margin-left: auto;
}

.pipeline-status-filter select {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid var(--slate-300);
    border-radius: 6px;
    background: white;
}

/* ============================================
   EVENT LIST & CARDS
   ============================================ */

.unified-events-list {
    max-height: 70vh;
    overflow-y: auto;
}

.unified-loading,
.unified-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--slate-500);
}

.unified-empty .empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.unified-empty .empty-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--slate-600);
    margin-bottom: 4px;
}

.unified-empty .empty-hint {
    font-size: 12px;
    color: var(--slate-400);
    max-width: 280px;
    margin: 0 auto;
    line-height: 1.5;
}

.unified-event-card {
    border-bottom: 1px solid var(--slate-100);
    transition: background 0.1s;
}

.unified-event-card:last-child {
    border-bottom: none;
}

.unified-event-card.focused {
    background: #f0f9ff;
}

.unified-event-card:hover:not(.focused) {
    background: #f8fafc;
}

.card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
}

.confidence-bar {
    width: 4px;
    height: 24px;
    border-radius: 2px;
    flex-shrink: 0;
}

.confidence-bar.conf-high { background: #10b981; }
.confidence-bar.conf-med { background: #f59e0b; }
.confidence-bar.conf-low { background: #ef4444; }

.score-chip {
    display: inline-block;
    min-width: 32px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--slate-700);
}

.year-chip {
    font-size: 12px;
    font-weight: 600;
    color: var(--patriot-blue);
    min-width: 40px;
}

.tier-chip {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.tier-chip.tier-free {
    background: #dbeafe;
    color: #1e40af;
}

.tier-chip.tier-premium {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #78350f;
}

.card-title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--slate-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.status-chip {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.status-chip.status-pending { background: #fef3c7; color: #92400e; }
.status-chip.status-approved { background: #d1fae5; color: #065f46; }
.status-chip.status-rejected { background: #fee2e2; color: #991b1b; }
.status-chip.status-filtered { background: #e2e8f0; color: var(--slate-600); }
.status-chip.status-live { background: #10b981; color: white; }

.expand-btn {
    background: transparent;
    border: none;
    font-size: 12px;
    color: var(--slate-500);
    cursor: pointer;
    padding: 4px 8px;
}

.card-desc {
    padding: 0 16px 12px 34px;
    font-size: 13px;
    color: var(--slate-600);
    line-height: 1.5;
}

.card-actions {
    display: none;
    gap: 8px;
    padding: 0 16px 12px 34px;
}

.unified-event-card.focused .card-actions {
    display: flex;
}

.card-actions .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.card-actions .btn-success {
    background: #059669;
    color: white;
}
.card-actions .btn-success:hover:not(:disabled) { background: #047857; }

.card-actions .btn-danger {
    background: #dc2626;
    color: white;
}
.card-actions .btn-danger:hover:not(:disabled) { background: #b91c1c; }

.card-actions .btn-secondary {
    background: white;
    border: 2px solid var(--slate-300);
    color: var(--slate-700);
}
.card-actions .btn-secondary:hover:not(:disabled) {
    border-color: var(--patriot-blue);
    color: var(--patriot-blue);
}

/* ============================================
   EXPANDED DETAIL
   ============================================ */

.unified-event-detail {
    padding: 16px 16px 16px 34px;
    background: #f8fafc;
    border-top: 1px solid var(--slate-200);
}

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

.detail-block:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.detail-block p {
    margin: 0 0 10px 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--slate-700);
}

.detail-block p:last-child {
    margin-bottom: 0;
}

.dyk-card {
    background: white;
    border: 1px solid var(--slate-200);
    border-left: 3px solid var(--patriot-blue);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 8px;
}

.dyk-card:last-child {
    margin-bottom: 0;
}

.dyk-q {
    font-size: 13px;
    font-weight: 600;
    color: var(--slate-800);
    margin-bottom: 4px;
}

.dyk-a {
    font-size: 13px;
    color: var(--slate-600);
    line-height: 1.6;
}

.detail-image-block {
    margin-bottom: 16px;
}

.detail-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    border: 1px solid var(--slate-200);
    display: block;
    margin-bottom: 4px;
}

.image-credit {
    font-size: 11px;
    color: var(--slate-500);
}

.image-prompt {
    font-family: monospace;
    font-size: 11px;
    background: white;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--slate-200);
    white-space: pre-wrap;
    line-height: 1.5;
}

.detail-attribution {
    padding-top: 10px;
    border-top: 1px solid var(--slate-200);
    font-size: 11px;
    color: var(--slate-500);
}

.detail-attribution a {
    color: var(--patriot-blue);
    text-decoration: none;
}

.detail-attribution a:hover {
    text-decoration: underline;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}


/* ============================================
   CALENDAR VIEW
   ============================================ */

.unified-calendar-wrap {
    background: white;
    border: 2px solid var(--slate-200);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 900px) {
    .calendar-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
    .calendar-grid { grid-template-columns: 1fr; }
}

.calendar-month {
    background: #f8fafc;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    padding: 10px;
}

.calendar-month-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--slate-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    text-align: center;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-day {
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid var(--slate-200);
    background: white;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s;
    color: var(--slate-700);
    padding: 0;
}

.cal-day:hover {
    transform: scale(1.15);
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.cal-day.selected {
    outline: 2px solid var(--patriot-blue);
    outline-offset: 1px;
    z-index: 5;
}

.cal-day.day-empty { background: white; color: var(--slate-400); }
.cal-day.day-live { background: #10b981; color: white; border-color: #059669; }
.cal-day.day-approved { background: #3b82f6; color: white; border-color: #2563eb; }
.cal-day.day-pending { background: #f59e0b; color: white; border-color: #d97706; }
.cal-day.day-filtered { background: #94a3b8; color: white; border-color: #64748b; }

.calendar-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--slate-200);
    font-size: 12px;
    color: var(--slate-600);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.1);
}

.legend-swatch.day-empty { background: white; border-color: var(--slate-300); }
.legend-swatch.day-live { background: #10b981; }
.legend-swatch.day-approved { background: #3b82f6; }
.legend-swatch.day-pending { background: #f59e0b; }
.legend-swatch.day-filtered { background: #94a3b8; }


/* ============================================
   UNIFIED DAILY LIST (single-panel view)
   ============================================ */

.unified-day-panel {
    background: white;
    border: 2px solid var(--slate-200);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.day-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    border-bottom: 2px solid var(--slate-200);
}

.day-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--slate-800);
}

.unified-day-list {
    max-height: 70vh;
    overflow-y: auto;
}

.day-card {
    border-bottom: 1px solid var(--slate-100);
    transition: background 0.1s;
}

.day-card:last-child { border-bottom: none; }
.day-card.focused { background: #f0f9ff; }
.day-card:hover:not(.focused) { background: #f8fafc; }

.day-card .card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
}

.day-card-detail {
    padding: 12px 16px 16px 34px;
    background: #f8fafc;
    border-top: 1px solid var(--slate-200);
}

.day-card .card-actions {
    display: flex;
    gap: 8px;
    padding: 0 16px 12px 34px;
    flex-wrap: wrap;
}

/* ============================================
   BACKLOG (collapsible bottom panel)
   ============================================ */

.unified-backlog-wrap {
    margin-top: 16px;
}

.backlog-toggle-btn {
    width: 100%;
    padding: 12px 18px;
    background: white;
    border: 2px solid var(--slate-200);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--slate-700);
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
}

.backlog-toggle-btn:hover {
    background: #f8fafc;
    border-color: var(--patriot-blue);
}

.unified-backlog {
    margin-top: 10px;
    background: white;
    border: 2px solid var(--slate-200);
    border-radius: 10px;
    overflow: hidden;
}

.backlog-summary {
    padding: 10px 18px;
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    border-bottom: 1px solid var(--slate-200);
    font-size: 13px;
    font-weight: 600;
    color: var(--slate-700);
}

.backlog-date-group {
    border-bottom: 1px solid var(--slate-100);
}

.backlog-date-group:last-child { border-bottom: none; }

.backlog-date-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    background: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    color: var(--slate-700);
}

.backlog-date-header span:first-child { flex: 0 0 auto; font-weight: 700; }
.backlog-count {
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.backlog-date-header button {
    margin-left: auto;
}

.backlog-events {
    padding: 6px 18px;
}

.backlog-event-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 13px;
    color: var(--slate-700);
    border-bottom: 1px dashed var(--slate-100);
}

.backlog-event-row:last-child { border-bottom: none; }

.backlog-event-row .card-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
