/* ==========================================================================
   Profile Page Styles
   ========================================================================== */

.profile-page-container {
    padding: 20px 30px;
    position: relative;
    min-height: calc(100vh - 190px);
    overflow-y: auto;
}

/* Page Header */
.profile-page-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.profile-page-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

/* ==========================================================================
   KPI Section
   ========================================================================== */

.profile-kpi-section {
    margin-bottom: 30px;
}

.kpi-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 20px;
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.kpi-header:hover {
    background: #f8f9fa;
    margin: -10px -10px 20px -10px;
    padding: 10px 10px 15px 10px;
    border-radius: 4px;
}

.kpi-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.kpi-toggle-icon {
    font-size: 20px;
    color: #6c757d;
    transition: transform 0.3s;
}

.kpi-container.collapsed .kpi-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.kpi-items-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
}

.kpi-item {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px 20px;
    min-width: 180px;
    flex: 1;
    max-width: 250px;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.kpi-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Clickable KPI items (with tab mapping) */
.kpi-item[style*="cursor: pointer"] {
    position: relative;
}

.kpi-item[style*="cursor: pointer"]:hover {
    background: #e9ecef;
}

.kpi-item[style*="cursor: pointer"]::after {
    content: '\f2fa';
    font-family: 'Material-Design-Iconic-Font';
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 14px;
    color: #6c757d;
    opacity: 0.5;
}

[dir="ltr"] .kpi-item[style*="cursor: pointer"]::after {
    left: auto;
    right: 8px;
}

/* Active KPI (when its linked tab is selected) */
.kpi-item.kpi-active {
    background: #007bff !important;
    color: #fff;
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.3);
    transform: translateY(-3px);
}

.kpi-item.kpi-active .kpi-icon {
    color: #fff;
}

.kpi-item.kpi-active .kpi-value {
    color: #fff;
}

.kpi-item.kpi-active .kpi-label {
    color: rgba(255, 255, 255, 0.9);
}

.kpi-item.kpi-active .kpi-sublabel {
    color: rgba(255, 255, 255, 0.7);
}

.kpi-item.kpi-active::after {
    color: #fff;
    opacity: 0.8;
}

.kpi-icon {
    font-size: 28px;
    color: #6c757d;
    margin-left: 15px;
    width: 40px;
    text-align: center;
}

[dir="ltr"] .kpi-icon {
    margin-left: 0;
    margin-right: 15px;
}

.kpi-content {
    flex: 1;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    line-height: 1.2;
}

.kpi-label {
    font-size: 13px;
    color: #6c757d;
    margin-top: 4px;
}

.kpi-sublabel {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

/* KPI Color Classes */
.kpi-item.kpi-success {
    background: #d4edda;
    border-right: 4px solid #28a745;
}

[dir="ltr"] .kpi-item.kpi-success {
    border-right: none;
    border-left: 4px solid #28a745;
}

.kpi-item.kpi-success .kpi-icon {
    color: #28a745;
}

.kpi-item.kpi-success .kpi-value {
    color: #155724;
}

.kpi-item.kpi-warning {
    background: #fff3cd;
    border-right: 4px solid #ffc107;
}

[dir="ltr"] .kpi-item.kpi-warning {
    border-right: none;
    border-left: 4px solid #ffc107;
}

.kpi-item.kpi-warning .kpi-icon {
    color: #856404;
}

.kpi-item.kpi-warning .kpi-value {
    color: #856404;
}

.kpi-item.kpi-danger {
    background: #f8d7da;
    border-right: 4px solid #dc3545;
}

[dir="ltr"] .kpi-item.kpi-danger {
    border-right: none;
    border-left: 4px solid #dc3545;
}

.kpi-item.kpi-danger .kpi-icon {
    color: #dc3545;
}

.kpi-item.kpi-danger .kpi-value {
    color: #721c24;
}

.kpi-item.kpi-info {
    background: #d1ecf1;
    border-right: 4px solid #17a2b8;
}

[dir="ltr"] .kpi-item.kpi-info {
    border-right: none;
    border-left: 4px solid #17a2b8;
}

.kpi-item.kpi-info .kpi-icon {
    color: #17a2b8;
}

.kpi-item.kpi-info .kpi-value {
    color: #0c5460;
}

/* ==========================================================================
   Chart Section
   ========================================================================== */

.profile-chart-section {
    margin-bottom: 30px;
}

/* Multiple Charts Section */
.profile-charts-section {
    margin-bottom: 30px;
}

.charts-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.chart-col {
    box-sizing: border-box;
    margin-bottom: 0;
}

.chart-col-full {
    flex: 0 0 100%;
    max-width: 100%;
}

.chart-col-half {
    flex: 0 0 calc(50% - 10px);
    max-width: calc(50% - 10px);
}

/* Responsive: Stack charts on smaller screens */
@media (max-width: 992px) {
    .chart-col-half {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

.chart-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 20px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.chart-header:hover {
    background: #f8f9fa;
    margin: -10px -10px 15px -10px;
    padding: 10px 10px 12px 10px;
    border-radius: 4px;
}

.chart-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.chart-toggle-icon {
    font-size: 20px;
    color: #6c757d;
    transition: transform 0.3s;
}

.chart-container.collapsed .chart-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.chart-wrapper {
    position: relative;
    width: 100%;
}

.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    color: #6c757d;
}

.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    color: #999;
}

.chart-empty i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.chart-empty span {
    font-size: 14px;
}

#profileChart {
    width: 100% !important;
    height: 100% !important;
}

/* ==========================================================================
   Tabs Section
   ========================================================================== */

.profile-tabs-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.tabs-container {
    width: 100%;
}

.tabs-header-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #f8f9fa;
}

.tab-scroll-btn {
    flex-shrink: 0;
    width: 40px;
    height: 50px;
    border: none;
    background: linear-gradient(to right, rgba(248, 249, 250, 0.95), rgba(248, 249, 250, 1));
    color: #6c757d;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
    z-index: 2;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-scroll-btn:hover {
    background: linear-gradient(to right, rgba(233, 236, 239, 0.95), rgba(233, 236, 239, 1));
    color: #333;
}

.tab-scroll-left {
    border-left: 1px solid #e9ecef;
}

[dir="ltr"] .tab-scroll-left {
    border-left: none;
    border-right: 1px solid #e9ecef;
    background: linear-gradient(to left, rgba(248, 249, 250, 0.95), rgba(248, 249, 250, 1));
}

[dir="ltr"] .tab-scroll-left:hover {
    background: linear-gradient(to left, rgba(233, 236, 239, 0.95), rgba(233, 236, 239, 1));
}

.tab-scroll-right {
    border-right: 1px solid #e9ecef;
}

[dir="ltr"] .tab-scroll-right {
    border-right: none;
    border-left: 1px solid #e9ecef;
    background: linear-gradient(to right, rgba(248, 249, 250, 0.95), rgba(248, 249, 250, 1));
}

[dir="ltr"] .tab-scroll-right:hover {
    background: linear-gradient(to right, rgba(233, 236, 239, 0.95), rgba(233, 236, 239, 1));
}

.tabs-header {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

/* Hide scrollbar while maintaining functionality */
.tabs-header::-webkit-scrollbar {
    height: 0;
    width: 0;
    display: none;
}

.tabs-header {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.tab-item {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    white-space: nowrap;
    color: #6c757d;
    font-weight: 500;
}

.tab-item:hover {
    background: #e9ecef;
    color: #333;
}

.tab-item.active {
    background: #fff;
    border-bottom-color: #007bff;
    color: #007bff;
}

.tab-icon {
    margin-left: 10px;
    font-size: 16px;
}

[dir="ltr"] .tab-icon {
    margin-left: 0;
    margin-right: 10px;
}

.tab-title {
    font-size: 14px;
}

.tab-badge {
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 10px;
    min-width: 20px;
    text-align: center;
}

[dir="ltr"] .tab-badge {
    margin-right: 0;
    margin-left: 10px;
}

.tabs-content {
    padding: 0;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Tab Actions and Filters Bar */
.tab-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    flex-wrap: wrap;
}

.tab-actions-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tab-action .btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
}

.tab-action .btn i {
    font-size: 14px;
}

.tab-filters-group {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.tab-filter {
    display: flex;
    align-items: center;
}

.filter-control {
    min-width: 200px;
}

.filter-control .form-control {
    height: 36px;
    font-size: 13px;
    border-radius: 4px;
    border: 1px solid #ced4da;
    padding: 6px 12px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.filter-control .form-control:focus {
    border-color: #007bff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.filter-control .form-control:disabled {
    background-color: #e9ecef;
    opacity: 1;
}

/* Tab Grid Container */
.tab-grid-container {
    padding: 20px;
    min-height: 300px;
    overflow: auto;
}

.tab-grid-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6c757d;
    font-size: 14px;
}

.tab-grid-loading i {
    font-size: 24px;
    margin-left: 10px;
}

[dir="ltr"] .tab-grid-loading i {
    margin-left: 0;
    margin-right: 10px;
}

.tab-grid {
    width: 100%;
}

/* Kendo Grid alternating row colors */
.tab-grid .k-grid-content tr.k-alt {
    background-color: #f8f9fa;
}

.tab-grid .k-grid-content tr:not(.k-alt) {
    background-color: #fff;
}

.tab-grid .k-grid-content tr:hover {
    background-color: #e9ecef;
}

/* Tab Custom Content */
.tab-custom-content {
    padding: 20px;
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */

.profile-page-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-spinner {
    font-size: 40px;
    color: #007bff;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 768px) {
    .profile-page-container {
        padding: 15px;
    }

    .profile-page-title {
        font-size: 20px;
    }

    .kpi-items-wrapper {
        flex-direction: column;
    }

    .kpi-item {
        max-width: 100%;
    }

    .tabs-header {
        flex-wrap: nowrap;
    }

    .tab-item {
        padding: 12px 18px;
    }

    .tab-grid-container {
        padding: 10px;
    }

    .tab-actions-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 15px;
        gap: 12px;
    }

    .tab-actions-group {
        width: 100%;
        justify-content: flex-start;
    }

    .tab-filters-group {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .tab-filter {
        width: 100%;
    }

    .filter-control {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .kpi-item {
        padding: 12px 15px;
        min-width: 100%;
    }

    .kpi-value {
        font-size: 20px;
    }

    .kpi-icon {
        font-size: 24px;
    }

    .tab-item {
        padding: 10px 15px;
    }

    .tab-title {
        font-size: 13px;
    }
}
