/* 
--------------------------------------------------------------
Admin Dashboard V2 Styles
--------------------------------------------------------------
*/

:root {
    --v2-primary: #004F44;
    --v2-secondary: #FFA729;
    --v2-text: #27282C;
    --v2-header: #141519;
    --v2-bg: #F0F4F5;
    --v2-white: #ffffff;
    --v2-border: rgba(73, 81, 91, 0.15);
    --v2-shadow: 0px 4px 25px 0px rgba(0, 0, 0, 0.06);
    --v2-success: #10b981;
    --v2-violet: #8b5cf6;
    
    /* Aliases for better compatibility */
    --theme: var(--v2-primary);
    --theme-2: var(--v2-secondary);
    --text: var(--v2-text);
    --header: var(--v2-header);
    --white: var(--v2-white);
}

/* Dashboard Container */
.dashboard-v2 {
    font-family: 'Inter', sans-serif;
    color: var(--v2-text);
}

.dashboard-v2 h1, .dashboard-v2 h3, .dashboard-v2 h4, .dashboard-v2 h5 {
    font-family: 'Poppins', sans-serif;
    color: var(--v2-header);
}

/* Stats Grid */
.stats-grid-v2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card-v2 {
    background: var(--v2-white);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--v2-border);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--v2-shadow);
}

.stat-card-v2:hover {
    transform: translateY(-4px);
    border-color: var(--v2-primary);
}

.stat-icon-v2 {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--v2-white);
    flex-shrink: 0;
}

.stat-icon-v2.bg-primary { background: var(--v2-primary) !important; }
.stat-icon-v2.bg-secondary { background: var(--v2-secondary) !important; }
.stat-icon-v2.bg-success { background: var(--v2-success) !important; }
.stat-icon-v2.bg-violet { background: var(--v2-violet) !important; }

.stat-info-v2 .label {
    font-size: 14px;
    color: #6c706f;
    margin-bottom: 4px;
    display: block;
}

.stat-info-v2 .value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    display: block;
}

.stat-info-v2 .trend {
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.trend.up { color: var(--v2-success); }
.trend.down { color: #ef4444; }

/* Charts Container */
.chart-card-v2 {
    background: var(--v2-white);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid var(--v2-border);
    box-shadow: var(--v2-shadow);
    margin-bottom: 30px;
    height: 100%;
}

.chart-card-v2 .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-card-v2 h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.period-filters {
    display: flex;
    gap: 8px;
    align-items: center;
}

.period-btn {
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid var(--v2-border);
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: var(--v2-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.period-btn:hover {
    border-color: var(--v2-primary);
    color: var(--v2-primary);
}

.period-btn.active {
    background: var(--v2-primary);
    border-color: var(--v2-primary);
    color: var(--v2-white);
}

.period-select {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--v2-border);
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: var(--v2-text);
    cursor: pointer;
    outline: none;
}

.period-select:focus {
    border-color: var(--v2-primary);
}

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

.stat-card-mini-v2 {
    background: var(--v2-white);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--v2-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-card-mini-v2 .icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 79, 68, 0.05);
    color: var(--v2-primary);
}

.stat-card-mini-v2 .info .label {
    font-size: 12px;
    color: #6c706f;
}

.stat-card-mini-v2 .info .value {
    font-size: 16px;
    font-weight: 600;
}

/* Ranked List (Top Courses) */
.ranked-list-v2 {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ranked-item-v2 {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--v2-border);
}

.ranked-item-v2:last-child {
    border-bottom: none;
}

.ranked-rank-v2 {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 79, 68, 0.1);
    color: var(--v2-primary);
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.ranked-info-v2 {
    flex: 1;
    min-width: 0;
}

.ranked-info-v2 h5 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranked-info-v2 p {
    font-size: 13px;
    color: #6c706f;
}

.ranked-meta-v2 {
    text-align: right;
}

.ranked-meta-v2 .revenue {
    font-weight: 700;
    color: var(--v2-header);
    display: block;
}

.ranked-meta-v2 .rating {
    font-size: 12px;
    color: var(--v2-secondary);
}

/* Sidebar Sections (Engagement & Activity) */
.sidebar-section-v2 {
    margin-bottom: 30px;
}

.sidebar-card-v2 {
    background: var(--v2-white);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--v2-border);
    box-shadow: var(--v2-shadow);
}

.engagement-bar-v2 {
    margin-bottom: 15px;
}

.engagement-bar-v2 .label-group {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 13px;
}

.engagement-bar-v2 .progress {
    height: 8px;
    border-radius: 4px;
    background: #f3f4f6;
}

.engagement-bar-v2 .progress-bar {
    border-radius: 4px;
}

.activity-list-v2 {
    list-style: none;
    padding: 0;
}

.activity-item-v2 {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

.activity-icon-v2 {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(0, 79, 68, 0.05);
    color: var(--v2-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.activity-content-v2 p {
    font-size: 13px;
    margin-bottom: 2px;
}

.activity-content-v2 span {
    font-size: 11px;
    color: #9ca3af;
}

/* Transactions Table */
.transaction-table-v2 {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.transaction-table-v2 th {
    padding: 10px 15px;
    font-weight: 600;
    font-size: 13px;
    color: #6c706f;
    text-transform: uppercase;
    border: none;
}

.transaction-table-v2 td {
    padding: 15px;
    background: #fff;
    border-top: 1px solid var(--v2-border);
    border-bottom: 1px solid var(--v2-border);
}

.transaction-table-v2 td:first-child {
    border-left: 1px solid var(--v2-border);
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.transaction-table-v2 td:last-child {
    border-right: 1px solid var(--v2-border);
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.status-badge-v2 {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge-v2.completed { background: rgba(16, 185, 129, 0.1); color: var(--v2-success); }
.status-badge-v2.pending { background: rgba(255, 167, 41, 0.1); color: var(--v2-secondary); }

/* Custom Filters */
.filter-group-v2 {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-btn-v2 {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    background: #f3f4f6;
    color: #6c706f;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.filter-btn-v2.active {
    background: var(--v2-primary);
    color: #fff;
}

.filter-btn-v2:hover:not(.active) {
    background: #e5e7eb;
}

/* Transaction Table Styles (Instructor Style) */
.transactions-wrapper-v2 {
    background: var(--white);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.table-header-v2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.table-header-v2 h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--header);
    margin: 0;
}

.table-filters-v2 {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(108, 112, 111, 0.2);
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: var(--theme);
    color: var(--theme);
}

.filter-btn.active {
    background: var(--theme);
    border-color: var(--theme);
    color: var(--white);
}

.students-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--white);
    border-radius: 12px;
    min-width: 800px;
}

.students-table thead {
    background: rgba(0, 79, 68, 0.05);
}

.students-table thead th {
    padding: 18px 15px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    color: var(--header);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(108, 112, 111, 0.1);
    white-space: nowrap;
}

.students-table thead th:first-child { border-top-left-radius: 12px; }
.students-table thead th:last-child { border-top-right-radius: 12px; }

.students-table tbody tr {
    border-bottom: 1px solid rgba(108, 112, 111, 0.1);
    transition: all 0.2s ease;
}

.students-table tbody tr:hover {
    background: rgba(0, 79, 68, 0.03);
}

.students-table tbody td {
    padding: 18px 15px;
    vertical-align: middle;
    font-size: 14px;
    color: var(--text);
}

/* Transaction Table Exact Matching */
.transaction-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(0, 79, 68, 0.08);
    color: var(--theme);
    font-size: 12px;
    font-weight: 600;
}

.transaction-type-badge i {
    font-size: 10px;
}

.transaction-amount {
    font-weight: 700;
    font-size: 14px;
}

.transaction-amount.positive {
    color: #10b981;
}

.transaction-amount.negative {
    color: #ef4444;
}

.status-badge-table {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.status-badge-table.completed {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.status-badge-table.pending {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.status-badge-table.failed {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.view-all-btn-wrapper {
    margin-top: 25px;
    text-align: center;
}

.view-all-link {
    display: inline-block;
    padding: 10px 30px;
    border: 1px solid var(--theme);
    color: var(--theme);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.view-all-link:hover {
    background: var(--theme);
    color: var(--white);
    text-decoration: none;
}

/* Mini Stats Cards (Instructor Style) */
.stat-card-minimal {
    background: var(--white);
    border-radius: 12px;
    padding: 18px;
    border: 1px solid rgba(108, 112, 111, 0.15);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    flex: 1;
}

.stat-card-minimal:hover {
    border-color: var(--theme);
    box-shadow: 0 2px 12px rgba(0, 79, 68, 0.1);
    transform: translateY(-2px);
}

.stat-icon-minimal {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #ffffff !important; /* Force white color for icons */
    flex-shrink: 0;
}

.stat-icon-minimal.stat-icon-1 { background: var(--theme); }
.stat-icon-minimal.stat-icon-2 { background: var(--theme-2); }
.stat-icon-minimal.stat-icon-3 { background: #10b981; }
.stat-icon-minimal.stat-icon-4 { background: #8b5cf6; }

.stat-content-minimal {
    flex: 1;
    min-width: 0;
}

.stat-value-minimal {
    font-size: 22px;
    font-weight: 700;
    color: var(--header);
    line-height: 1.2;
    margin-bottom: 3px;
}

.stat-label-minimal {
    font-size: 13px;
    color: var(--text);
    opacity: 0.65;
    line-height: 1.3;
}

/* Secondary Stats Row */
.secondary-stats-row-v2 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* Ranking List (Instructor Style) */
.section-title-area-v2 {
    margin-bottom: 25px;
}

.section-title-area-v2 h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--header);
    margin-bottom: 5px;
}

.top-course-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--white);
    border-radius: 12px;
    border: 1px solid rgba(108, 112, 111, 0.1);
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.top-course-item:hover {
    box-shadow: 0 4px 15px rgba(0, 79, 68, 0.1);
    transform: translateY(-2px);
    border-color: var(--theme);
}

.course-thumb-v2 {
    width: 60px;
    height: 45px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #eee;
}

.course-thumb-v2 img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.course-details { flex: 1; min-width: 0; }
.course-details h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--header);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.course-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 13px;
    color: var(--text);
    opacity: 0.8;
}

.metric-item { display: flex; align-items: center; gap: 6px; }
.metric-item i { color: var(--theme); }

.course-revenue-v2 {
    text-align: right;
    flex-shrink: 0;
}

.course-revenue-v2 .rev-amount {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--header);
}

.course-revenue-v2 .rev-rating {
    font-size: 12px;
    color: var(--theme-2);
}

/* Main Dashboard Container Margin */
.dashboard-v2 {
    padding: 30px;
    background: #f8faf9;
    min-height: 100vh;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid-v2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 991px) {
    .secondary-stats-row-v2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .main-content {
        padding-left: 10px !important;
        padding-right: 10px !important;
        padding-top: 80px !important; 
    }

    .section {
        padding: 0 !important;
    }

    .section-header {
        margin-bottom: 10px !important;
        padding: 15px 15px !important;
    }

    .dashboard-v2 {
        padding: 5px;
        margin-top: 5px; /* Added small margin top */
    }
    
    .stats-grid-v2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .stats-grid-v2, .secondary-stats-row-v2 {
        grid-template-columns: 1fr;
    }
    
    .table-header-v2 {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .stat-card-minimal {
        padding: 12px;
        gap: 10px;
    }
    
    .stat-icon-minimal {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .stat-value-minimal {
        font-size: 18px;
    }

    .top-course-item {
        padding: 10px;
    }
    
    .course-thumb-v2 {
        width: 50px;
        height: 38px;
    }
}
