/**
 * Session Stats CSS
 * Стили для панели сессий и модального окна статистики
 */

/* ============================================
   FILTERS
   ============================================ */
.filters-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 120px;
}

.filter-group label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-group select:hover {
    border-color: var(--primary-color);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 158, 188, 0.1);
}

.btn-filter {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    align-self: flex-end;
}

.btn-filter:hover {
    background: var(--primary-dark);
}

/* ============================================
   SESSIONS LIST
   ============================================ */
#sessions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.session-item {
    padding: 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: visible;
    margin-right: 0;
}

.session-item:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-left-width: 6px;
    margin-right: -2px;
}

.session-item.completed {
    border-left-color: var(--success-color);
}

.session-item.running {
    border-left-color: var(--warning-color);
    animation: pulse-border 2s infinite;
}

.session-item.failed {
    border-left-color: var(--danger-color);
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.session-type {
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 15px;
}

.session-status {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--success-color);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
}

.session-status.running {
    background: var(--warning-color);
    animation: pulse-bg 2s infinite;
}

.session-status.failed {
    background: var(--danger-color);
}

.session-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.session-stat {
    text-align: center;
}

.session-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.session-stat-label {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

.session-date {
    font-size: 12px;
    color: #999;
    margin-top: 8px;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    background: var(--bg-light);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 22px;
    color: var(--primary-dark);
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    color: #666;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--danger-color);
    color: white;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

/* ============================================
   SESSION STATS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    padding: 25px 20px;
    border-radius: 16px;
    border: none;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.stat-card,
.stat-card .stat-value,
.stat-card .stat-label {
    color: white !important;
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

.stat-card.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-card.success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.stat-card.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card.info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-value {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
}

.stat-label {
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    z-index: 2;
}

.stat-icon {
    font-size: 100px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.08;
    filter: grayscale(100%) brightness(0) invert(1);
    transition: all 0.5s ease;
    pointer-events: none;
    z-index: 1;
}

.stat-card:hover .stat-icon {
    opacity: 0.15;
    filter: grayscale(0%) brightness(1.2);
    transform: translate(-50%, -50%) scale(1.15) rotate(8deg);
}

/* ============================================
   DECISIONS
   ============================================ */
.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-dark);
    margin: 30px 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.decisions-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.decision-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #eee;
    border-left: 4px solid var(--primary-color);
}

.decision-card.approved {
    border-left-color: var(--success-color);
}

.decision-card.rejected {
    border-left-color: var(--danger-color);
}

.decision-card.deferred {
    border-left-color: var(--warning-color);
}

.decision-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.decision-topic {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-dark);
}

.decision-badge {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.decision-badge.approved {
    background: var(--success-color);
    color: white;
}

.decision-badge.rejected {
    background: var(--danger-color);
    color: white;
}

.decision-badge.deferred {
    background: var(--warning-color);
    color: white;
}

.decision-votes {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.vote-count {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vote-count-value {
    font-size: 20px;
    font-weight: 700;
}

.vote-count-label {
    font-size: 13px;
    color: #666;
}

.vote-count.support .vote-count-value {
    color: var(--success-color);
}

.vote-count.oppose .vote-count-value {
    color: var(--danger-color);
}

.decision-impact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 10px;
}

.decision-arguments {
    margin-top: 15px;
    padding: 12px;
    background: #fafbfc;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.arguments-section {
    padding: 8px;
}

.arguments-section strong {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}

.arguments-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.arguments-list li {
    padding: 6px 10px;
    margin: 4px 0;
    background: white;
    border-radius: 6px;
    font-size: 13px;
    border-left: 3px solid var(--primary-color);
    line-height: 1.4;
}

.arguments-section.for .arguments-list li {
    border-left-color: var(--success-color);
}

.arguments-section.against .arguments-list li {
    border-left-color: var(--danger-color);
}

.impact-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.impact-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--warning-color), var(--danger-color));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.impact-score {
    font-size: 14px;
    font-weight: 600;
    min-width: 50px;
}

/* ============================================
   MESSAGE TREE
   ============================================ */
.message-tree {
    margin-top: 20px;
    max-height: 500px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
}

.message-item {
    background: white;
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s;
}

.message-item:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateX(5px);
}

.message-item.proposal {
    border-left-color: #fb8500;
}

.message-item.vote {
    border-left-color: #4caf50;
}

.message-item.warning {
    border-left-color: #f44336;
}

.message-item.request {
    border-left-color: #219ebc;
}

.message-item.info {
    border-left-color: #9c27b0;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.message-agent {
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-agent-name {
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 15px;
}

.message-type-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.message-type-badge.proposal {
    background: #fb8500;
    color: white;
}

.message-type-badge.vote {
    background: #4caf50;
    color: white;
}

.message-type-badge.warning {
    background: #f44336;
    color: white;
}

.message-type-badge.request {
    background: #219ebc;
    color: white;
}

.message-type-badge.info {
    background: #9c27b0;
    color: white;
}

.message-time {
    font-size: 12px;
    color: #999;
}

.message-content {
    margin-top: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
}

.message-text {
    margin: 10px 0;
    padding: 10px;
    background: #fff;
    border-left: 3px solid var(--primary-color);
    border-radius: 4px;
    font-style: italic;
}

.message-arguments {
    margin: 10px 0;
    padding: 0;
}

.argument-item {
    padding: 8px 12px;
    margin: 5px 0;
    background: #f8f9fa;
    border-left: 3px solid var(--primary-color);
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
}

.message-topic {
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.message-arguments {
    list-style: none;
    padding: 0;
    margin: 0;
}

.message-arguments li {
    padding: 4px 0;
    padding-left: 20px;
    position: relative;
}

.message-arguments li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.message-priority {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 10px;
}

.message-priority.critical {
    background: #f44336;
    color: white;
}

.message-priority.high {
    background: #ff9800;
    color: white;
}

.message-priority.normal {
    background: #219ebc;
    color: white;
}

/* ============================================
   TABS
   ============================================ */
.tabs-container {
    margin-bottom: 20px;
}

.tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #f0f0f0;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================
   AGENTS TABLE
   ============================================ */
.agents-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.agents-table th,
.agents-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.agents-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
}

.agents-table tr:hover {
    background: #f8f9fa;
}

.agent-name {
    font-weight: 500;
    color: var(--primary-dark);
}

.agent-block {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 4px;
    background: #e0e0e0;
}

.agent-block.admin { background: #ffe0b2; }
.agent-block.federal { background: #ffcdd2; }
.agent-block.shadow { background: #cfd8dc; }
.agent-block.civil { background: #c8e6c9; }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes pulse-border {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(251, 133, 0, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(251, 133, 0, 0);
    }
}

@keyframes pulse-bg {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* ============================================
   DEBATE PHASES
   ============================================ */
.debate-phase-indicator {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    border-radius: 12px;
    padding: 16px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.phase-indicator-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.phase-indicator-icon {
    font-size: 32px;
    line-height: 1;
}

.phase-indicator-text {
    font-size: 14px;
    color: #555;
}

.phase-indicator-text strong {
    color: #333;
    font-weight: 600;
}

.phase-progress-bar {
    display: flex;
    gap: 4px;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: #e0e0e0;
}

.phase-step {
    flex: 1;
    border-radius: 2px;
    transition: all 0.3s ease;
    position: relative;
}

.phase-step.current {
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.3);
    animation: pulse-phase 2s infinite;
}

@keyframes pulse-phase {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Phases Timeline */
.phases-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.phase-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #e0e0e0;
    transition: all 0.3s ease;
}

.phase-card.current {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left-color: #2196F3;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.2);
}

.phase-card.completed {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-left-color: #4CAF50;
}

.phase-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.phase-card-icon {
    font-size: 28px;
    line-height: 1;
}

.phase-card-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.phase-card-badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.phase-card-badge.current {
    background: #2196F3;
    color: white;
}

.phase-card-badge.completed {
    background: #4CAF50;
    color: white;
}

.phase-card-stats {
    display: flex;
    gap: 16px;
}

.phase-stat {
    font-size: 13px;
    color: #666;
}

/* Debate Summary */
.debate-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    border-radius: 12px;
}

.summary-stat {
    text-align: center;
}

.summary-label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.summary-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .filters-container {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .session-meta {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .agents-table {
        font-size: 12px;
    }

    .phases-timeline {
        gap: 8px;
    }

    .phase-card {
        padding: 12px 16px;
    }

    .debate-summary {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .summary-value {
        font-size: 20px;
    }
}
