/* Performance Dashboard Stylesheet */

/* =================================================
   LAYOUT & STRUCTURE
   ================================================= */

.performance-main {
    padding: 80px 30px 30px 30px;
    max-width: 1400px;
    margin: 0 auto;
    background: #f5f7fa;
    min-height: 100vh;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    gap: 20px;
    flex-wrap: wrap;
}

.page-header h1 {
    margin: 0;
    font-size: 28px;
    color: #2c3e50;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

.page-header h1 i {
    margin-right: 12px;
    color: #8b5cf6;
}

.header-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

/* =================================================
   NAVIGATION
   ================================================= */

.nav-links {
    display: flex;
    gap: 20px;
    margin-left: auto;
    margin-right: 20px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: 6px;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link:hover {
    background: rgba(255,255,255,0.2);
}

.nav-link.active {
    background: rgba(255,255,255,0.25);
    font-weight: 600;
}

/* =================================================
   SECTION LAYOUT
   ================================================= */

.performance-section {
    margin-bottom: 40px;
}

.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    color: #2c3e50;
    font-weight: 600;
}

.section-header h2 i {
    margin-right: 10px;
    color: #3b82f6;
}

.section-subtitle {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

/* =================================================
   KPI CARDS
   ================================================= */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s;
}

.kpi-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    flex-shrink: 0;
}

.kpi-icon.bg-purple { background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%); }
.kpi-icon.bg-green { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.kpi-icon.bg-blue { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.kpi-icon.bg-orange { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.kpi-icon.bg-success { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); }
.kpi-icon.bg-danger { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.kpi-icon.bg-info { background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); }
.kpi-icon.bg-gray { background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%); }

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.kpi-trend {
    font-size: 13px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-trend.positive {
    color: #10b981;
}

.kpi-trend.negative {
    color: #ef4444;
}

/* =================================================
   CHARTS
   ================================================= */

.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.chart-card.wide {
    grid-column: 1 / -1;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.chart-legend {
    display: flex;
    gap: 16px;
    font-size: 13px;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chart-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.chart-container {
    position: relative;
    height: 300px;
}

.chart-card.wide .chart-container {
    height: 400px;
}

/* =================================================
   DATA TABLES
   ================================================= */

.table-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.table-header h3 i {
    margin-right: 8px;
    color: #8b5cf6;
}

.table-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Tab Switcher */
.tab-switcher {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 8px;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover {
    color: #374151;
    background: rgba(255,255,255,0.5);
}

.tab-btn.active {
    background: white;
    color: #8b5cf6;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab-btn i {
    font-size: 12px;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    background: #f9fafb;
    padding: 14px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    color: #374151;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge.badge-buy {
    background: #dcfce7;
    color: #166534;
}

.badge.badge-sell {
    background: #fee2e2;
    color: #991b1b;
}

.badge.badge-open {
    background: #dbeafe;
    color: #1e40af;
}

.badge.badge-tp {
    background: #d1fae5;
    color: #065f46;
}

.badge.badge-sl {
    background: #fecaca;
    color: #7f1d1d;
}

/* Colored Values */
.value-positive {
    color: #10b981;
    font-weight: 600;
}

.value-negative {
    color: #ef4444;
    font-weight: 600;
}

.value-neutral {
    color: #6b7280;
}

/* Agent Name Cell */
.agent-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.agent-badge {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.agent-badge.top { background: #fbbf24; }
.agent-badge.good { background: #10b981; }
.agent-badge.warning { background: #f59e0b; }
.agent-badge.poor { background: #ef4444; }

/* Grade Badge */
.grade-badge {
    display: inline-block;
    width: 36px;
    text-align: center;
    padding: 4px 0;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
}

.grade-badge.grade-a { background: #d1fae5; color: #065f46; }
.grade-badge.grade-b { background: #bfdbfe; color: #1e3a8a; }
.grade-badge.grade-c { background: #fef3c7; color: #78350f; }
.grade-badge.grade-d { background: #fed7aa; color: #7c2d12; }
.grade-badge.grade-f { background: #fecaca; color: #7f1d1d; }

/* Loading State */
.loading-row {
    text-align: center;
    padding: 40px !important;
    color: #9ca3af;
    font-size: 15px;
}

.loading-row i {
    margin-right: 8px;
}

/* Pagination */
.table-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 8px;
}

.pagination-btn {
    padding: 8px 14px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
}

/* =================================================
   FORM CONTROLS
   ================================================= */

.filter-select,
.filter-select-sm {
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-select:hover,
.filter-select-sm:hover {
    border-color: #9ca3af;
}

.filter-select:focus,
.filter-select-sm:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.filter-select-sm {
    padding: 8px 12px;
    font-size: 13px;
}

/* Buttons */
.btn-refresh,
.btn-export {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-refresh {
    background: #8b5cf6;
    color: white;
}

.btn-refresh:hover {
    background: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-export {
    background: #10b981;
    color: white;
}

.btn-export:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-refresh i.fa-spin,
.btn-export i.fa-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* =================================================
   LOADING OVERLAY
   ================================================= */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 40px 60px;
    border-radius: 12px;
    text-align: center;
}

.loading-spinner i {
    color: #8b5cf6;
    margin-bottom: 16px;
}

.loading-spinner p {
    margin: 0;
    color: #6b7280;
    font-size: 16px;
}

/* =================================================
   RESPONSIVE DESIGN
   ================================================= */

@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .chart-card.wide {
        grid-column: 1;
    }
}

@media (max-width: 768px) {
    .performance-main {
        padding: 12px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .header-controls {
        width: 100%;
        flex-direction: column;
    }

    .header-controls select,
    .header-controls button {
        width: 100%;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .table-controls {
        width: 100%;
        flex-direction: column;
    }

    .table-controls select,
    .table-controls button {
        width: 100%;
    }

    .nav-links {
        display: none;
    }
}

@media (max-width: 480px) {
    .kpi-card {
        flex-direction: column;
        text-align: center;
    }

    .kpi-icon {
        margin: 0 auto;
    }
}
