/* ============================================
   INVESTMENT STATISTICS PAGE - PROFESSIONAL STYLE
   Mobile App + Desktop | Admin Configurable Theme
   Chart: Left Pie + Right Legend
   TEXT CENTER FIX - All Pill Containers
   ============================================ */

/* ===== PAGE CONTAINER ===== */
.dashboard-inner {
    padding: 20px 16px 40px 16px;
    min-height: 100vh;
    background: var(--bg-secondary);
}

/* ===== HEADER SECTION ===== */
.invests-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 28px;
    padding: 24px 20px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.invests-header::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.invests-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    position: relative;
    z-index: 2;
}

.invests-header-title p {
    color: rgba(255,255,255,0.8);
    font-size: 12px;
    margin-bottom: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.15);
    padding: 4px 12px;
    border-radius: 40px;
}

.invests-header-title h3 {
    color: white;
    font-size: 24px;
    font-weight: 700;
    margin: 8px 0 0 0;
}

.invests-header-actions {
    display: flex;
    gap: 10px;
}

.btn-outline-light {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 40px;
    padding: 8px 16px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-outline-light:active {
    transform: scale(0.96);
    background: rgba(255,255,255,0.2);
}

.btn-light {
    background: white;
    border: none;
    border-radius: 40px;
    padding: 8px 16px;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-light:active {
    transform: scale(0.96);
}

/* Stats Cards */
.invests-header-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
}

.stat-item {
    flex: 1;
    min-width: 150px;
}

.stat-card {
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(4px);
    border-radius: 20px;
    padding: 14px 16px;
    transition: all 0.2s;
    text-align: center;
}

.stat-card:hover {
    background: rgba(0,0,0,0.3);
    transform: translateY(-2px);
}

.stat-label {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    display: block;
    margin-bottom: 6px;
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: white;
    display: block;
    margin-bottom: 8px;
    text-align: center;
}

.stat-value.text-success {
    color: #28c76f !important;
}

.stat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(255,255,255,0.15);
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 11px;
    color: white;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.stat-btn:active {
    transform: scale(0.95);
    background: rgba(255,255,255,0.25);
}

.invests-header-desc {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
    background: rgba(0,0,0,0.15);
    padding: 10px 16px;
    border-radius: 40px;
    backdrop-filter: blur(4px);
}

/* ===== QUICK SUMMARY CARDS ===== */
.quick-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
    width: 100%;
}

.summary-card {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 14px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
}

.summary-card:active {
    transform: scale(0.98);
}

.summary-label {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 8px;
    text-align: center;
    width: 100%;
}

.summary-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    text-align: center;
    width: 100%;
}

.summary-card.active .summary-value {
    color: var(--success);
}

.summary-card.paused .summary-value {
    color: var(--warning);
}

.summary-card.closed .summary-value {
    color: var(--info);
}

/* ===== CHART CARD - LEFT PIE + RIGHT LEGEND ===== */
.invest-chart-card {
    background: var(--bg-primary);
    border-radius: 24px;
    padding: 24px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}

.invest-chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.chart-container-wrapper {
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
}

/* Left Side - Pie Chart */
.chart-left {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chart-circle {
    position: relative;
    width: 160px;
    height: 160px;
}

.chart-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: var(--bg-primary);
    width: 75px;
    height: 75px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    border: 2px solid var(--primary-soft);
    z-index: 2;
}

.center-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    text-align: center;
}

.center-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

/* Right Side - Legend */
.chart-right {
    flex: 1;
    min-width: 180px;
}

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 8px;
}

.chart-legend::-webkit-scrollbar {
    width: 4px;
}

.chart-legend::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.chart-legend::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: 12px;
    transition: all 0.2s;
    cursor: pointer;
    width: 100%;
}

.legend-item:hover {
    background: var(--primary-soft);
    transform: translateX(4px);
}

.legend-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

.legend-right {
    text-align: right;
    min-width: 70px;
}

.legend-percent {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    display: block;
    text-align: right;
    white-space: nowrap;
}

.legend-amount {
    font-size: 10px;
    color: var(--text-muted);
    display: block;
    text-align: right;
    white-space: nowrap;
}

/* Empty Chart */
.empty-chart {
    text-align: center;
    padding: 40px;
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-soft);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.empty-icon i {
    font-size: 36px;
    color: var(--primary);
}

.empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    text-align: center;
}

.empty-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
    text-align: center;
}

.empty-chart .btn-primary {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 44px;
    padding: 10px 24px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

/* ===== FILTER ROW ===== */
.filter-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    flex: 2;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 44px;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.sort-box {
    flex: 1;
    position: relative;
}

.sort-box select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 44px;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
    appearance: none;
}

.sort-box i {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.refresh-box {
    flex: 0.3;
}

.refresh-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-soft);
    border: none;
    border-radius: 44px;
    color: var(--primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.refresh-btn:active {
    transform: scale(0.96);
    background: var(--primary);
    color: white;
}

/* ===== INVESTMENT TABS ===== */
.investment-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--bg-primary);
    padding: 6px;
    border-radius: 60px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 40px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.tab-btn i {
    font-size: 14px;
}

.tab-btn .count {
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.tab-btn.active .count {
    background: rgba(255,255,255,0.2);
    color: white;
}

.tab-btn:active {
    transform: scale(0.96);
}

/* ===== LOADING STATE ===== */
.loading-state {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.loading-state i {
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 12px;
    display: block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== INVESTMENT CARDS ===== */
.invest-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.invest-card {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 16px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    cursor: pointer;
}

.invest-card:active {
    transform: scale(0.98);
}

.invest-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.invest-plan h5 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: var(--text-primary);
}

.invest-plan small {
    font-size: 11px;
    color: var(--text-muted);
}

/* Badges - Center Fix */
.badge-active, .badge-paused, .badge-closed {
    background: rgba(40, 199, 111, 0.1);
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}

.badge-active {
    color: #28c76f;
}

.badge-paused {
    background: rgba(255, 159, 67, 0.1);
    color: #ff9f43;
}

.badge-closed {
    background: rgba(0, 207, 232, 0.1);
    color: #00cfe8;
}

.manage-capital-btn {
    background: linear-gradient(135deg, #ff9f43, #e67e22);
    color: white;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

/* Card Body */
.invest-card-body {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.invest-amount, .invest-date, .invest-next, .invest-paused-info {
    text-align: center;
}

.invest-amount .label,
.invest-date .label,
.invest-next .label,
.invest-paused-info .label {
    font-size: 10px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 2px;
    text-align: center;
}

.invest-amount .value,
.invest-date .value,
.invest-next .value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.invest-paused-info .value {
    font-size: 12px;
    font-weight: 600;
    color: #ff9f43;
    text-align: center;
}

/* Progress Bar */
.invest-progress {
    grid-column: span 3;
    margin-top: 8px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 6px;
    width: 100%;
}

.progress-label span {
    white-space: nowrap;
}

.progress-bar-container {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 3px;
    transition: width 0.3s;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Paused Alert */
.invest-paused-alert {
    grid-column: span 3;
    background: rgba(255, 159, 67, 0.1);
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #ff9f43;
    margin-top: 8px;
}

.invest-paused-alert i {
    font-size: 14px;
}

/* Card Footer */
.invest-card-footer {
    text-align: right;
}

.action-link {
    color: var(--primary);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.action-link:active {
    opacity: 0.7;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    background: var(--bg-primary);
    border-radius: 24px;
    padding: 50px 20px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.empty-state i {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: block;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-align: center;
}

.empty-state .btn-primary {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 44px;
    padding: 12px 24px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

/* ===== PAGINATION ===== */
.pagination-wrapper {
    margin-top: 20px;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
}

.pagination .page-item {
    display: inline-block;
}

.pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.pagination .page-link:active {
    transform: scale(0.95);
}

.pagination .active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ===== DESKTOP ===== */
@media (min-width: 768px) {
    .dashboard-inner {
        max-width: 1200px;
        margin: 0 auto;
        padding: 30px 24px 50px 24px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    .quick-summary {
        gap: 16px;
    }
    
    .summary-value {
        font-size: 32px;
    }
    
    .chart-container-wrapper {
        flex-wrap: nowrap;
    }
    
    .chart-circle {
        width: 180px;
        height: 180px;
    }
    
    .chart-center {
        width: 85px;
        height: 85px;
    }
    
    .center-value {
        font-size: 28px;
    }
    
    .invest-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    }
}

@media (max-width: 640px) {
    .dashboard-inner {
        padding: 16px 12px 30px 12px;
    }
    
    .invests-header {
        padding: 20px 16px;
    }
    
    .invests-header-title h3 {
        font-size: 22px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .stat-card {
        padding: 10px 12px;
    }
    
    .quick-summary {
        gap: 8px;
    }
    
    .summary-value {
        font-size: 24px;
    }
    
    .chart-container-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .chart-left {
        margin-bottom: 0;
    }
    
    .chart-circle {
        width: 140px;
        height: 140px;
    }
    
    .chart-center {
        width: 65px;
        height: 65px;
    }
    
    .center-value {
        font-size: 20px;
    }
    
    .filter-row {
        flex-direction: column;
    }
    
    .refresh-box {
        flex: 1;
    }
    
    .investment-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: auto;
        padding: 8px 12px;
        white-space: nowrap;
        font-size: 11px;
    }
    
    .tab-btn .count {
        min-width: 20px;
        font-size: 10px;
    }
    
    .invest-card-body {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .invest-progress {
        grid-column: span 2;
    }
    
    .badge-active, .badge-paused, .badge-closed {
        white-space: normal;
        word-break: keep-all;
        font-size: 10px;
        padding: 3px 8px;
    }
    
    .legend-percent, .legend-amount {
        font-size: 10px;
    }
    
    .stat-btn {
        padding: 4px 10px;
        font-size: 10px;
    }
    
    .stat-btn i {
        font-size: 9px;
    }
}

/* ===== DARK THEME ===== */
body.dark-theme .invest-card,
body.dark-theme .empty-state,
body.dark-theme .loading-state,
body.dark-theme .summary-card,
body.dark-theme .invest-chart-card,
body.dark-theme .search-box input,
body.dark-theme .sort-box select {
    background: var(--dark-bg-secondary);
    border-color: var(--dark-border);
}

body.dark-theme .legend-item {
    background: var(--dark-bg-tertiary);
}

body.dark-theme .stat-value,
body.dark-theme .invest-amount .value,
body.dark-theme .invest-date .value,
body.dark-theme .invest-next .value,
body.dark-theme .invest-plan h5,
body.dark-theme .empty-title,
body.dark-theme .summary-value {
    color: var(--dark-text-primary);
}

body.dark-theme .stat-label,
body.dark-theme .invest-plan small,
body.dark-theme .label,
body.dark-theme .progress-label,
body.dark-theme .progress-stats,
body.dark-theme .center-label,
body.dark-theme .empty-text,
body.dark-theme .summary-label,
body.dark-theme .legend-amount {
    color: var(--dark-text-secondary);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.invest-card {
    animation: fadeInUp 0.3s ease-out;
    animation-fill-mode: both;
}