/* =========================================
   RapidExam Dashboard - Responsive CSS
   (Compatible with all Mobiles, Tablets, and PCs)
   ========================================= */

/* Base Container & Universal Box Sizing */
.rapidexam-dashboard {
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    box-sizing: border-box;
    width: 100%;
}

.rapidexam-dashboard *, 
.rapidexam-dashboard *::before, 
.rapidexam-dashboard *::after {
    box-sizing: inherit;
}

/* --- Hero Section --- */
.re-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    background: linear-gradient(135deg, #0ea5e9, #22c55e);
    color: #fff;
    padding: 35px;
    border-radius: 22px;
    margin-bottom: 30px;
    box-shadow: 0 12px 35px rgba(14, 165, 233, 0.25);
}

.re-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.18);
    padding: 8px 14px;
    border-radius: 50px;
    font-size: 14px;
    margin-bottom: 18px;
    backdrop-filter: blur(5px);
}

.re-hero h1 {
    font-size: 36px;
    margin: 0;
    line-height: 1.2;
}

.re-hero p {
    margin-top: 10px;
    margin-bottom: 0;
}

.re-subtitle {
    opacity: 0.9;
    font-size: 16px;
}

.re-date {
    background: #fff;
    color: #0f172a;
    padding: 14px 20px;
    border-radius: 14px;
    font-weight: 600;
    min-width: 170px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* --- Stat Cards Grid --- */
.re-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* All Stat Cards styled with soft orange theme */
.re-stat-card {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 24px;
    background: #fff7ed; /* Soft light orange background applied to all cards */
    border: 1px solid #fed7aa; /* Light orange border applied to all cards */
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    width: 100%;
}

.re-stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.re-icon {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    font-size: 28px;
    color: #fff;
}

.re-info {
    flex-grow: 1;
}

.re-info span {
    display: block;
    color: #64748b;
    font-size: 15px;
    margin-bottom: 4px;
    font-weight: 500;
}

.re-info h2 {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.1;
}

/* Stat Card Icon Color Variants */
.accuracy .re-icon { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.quizzes .re-icon  { background: linear-gradient(135deg, #22c55e, #16a34a); }
.correct .re-icon  { background: linear-gradient(135deg, #10b981, #059669); }
.wrong .re-icon    { background: linear-gradient(135deg, #f97316, #ea580c); }
.points .re-icon   { background: linear-gradient(135deg, #f59e0b, #d97706); }
.max .re-icon      { background: linear-gradient(135deg, #8b5cf6, #6366f1); }

/* --- Table Section (Desktop & Mobile Unified) --- */
.re-table-wrapper {
    background: #ffffff;
    padding: 20px;
    border-radius: 18px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center; /* Centers the inner content */
}

.re-table-wrapper h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 22px;
    color: #0f172a;
    text-align: center;
    width: 100%;
}

/* Resized and Centered Table */
.re-table-wrapper table {
    width: 90%; /* Resized to 90% so it doesn't touch the edges */
    max-width: 1000px; /* Prevents it from getting too wide on huge screens */
    border-collapse: collapse;
    margin: 0 auto; /* Forces perfect center alignment inside the wrapper */
    table-layout: fixed; /* Strictly forces columns to fit the screen width */
}

/* Table Headers */
.re-table-wrapper th {
    background: #f1f5f9 !important; /* Solid grey colour */
    color: #0f172a !important;
    padding: 16px 10px !important;
    text-align: center !important; /* Perfect center alignment */
    font-weight: 700 !important;
    border-bottom: 2px solid #cbd5e1 !important;
    font-size: 15px;
    word-wrap: break-word; /* Allows header text to wrap */
}

/* Table Body Cells */
.re-table-wrapper td {
    padding: 16px 10px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    color: #334155 !important;
    text-align: center !important; /* Perfect center alignment */
    vertical-align: middle !important;
    font-size: 15px;
    word-wrap: break-word; /* Forces long text like Quiz IDs to wrap properly */
}

/* Give the Quiz ID Column slightly more space since it holds the longest text */
.re-table-wrapper th:first-child,
.re-table-wrapper td:first-child {
    width: 35%;
    font-weight: 600 !important;
}

.re-table-wrapper tr:last-child td {
    border-bottom: none !important;
}

.re-table-wrapper tr:hover td {
    background: #f8fafc !important;
}

/* =========================================
   Mobile Breakpoints (Tablets & Phones)
   ========================================= */
@media (max-width: 768px) {
    .rapidexam-dashboard {
        margin: 10px auto;
        padding: 10px; 
    }

    /* Stack the hero section */
    .re-hero {
        flex-direction: column;
        text-align: center;
        padding: 25px 20px;
        gap: 15px;
    }
    
    .re-hero h1 {
        font-size: 24px;
    }

    .re-date {
        width: 100%;
    }

    .re-stats-grid {
        grid-template-columns: 1fr;
    }

    .re-stat-card {
        padding: 18px;
    }

    .re-info h2 {
        font-size: 26px;
    }

    .re-icon {
        width: 50px;
        height: 50px;
        font-size: 22px;
    }

    /* --- FIXED MOBILE TABLE SCROLLING --- */
    .re-table-wrapper {
        padding: 15px 10px; 
        border-radius: 12px;
        
        /* 1. Remove Flexbox centering to fix the scroll bug */
        display: block; 
        
        /* 2. Enable horizontal scrolling */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
    }

    .re-table-wrapper h3 {
        font-size: 18px;
        margin-bottom: 15px;
        text-align: center;
        
        /* 3. Keep the title centered on screen while scrolling the table */
        position: sticky;
        left: 0;
        width: 100%;
    }
    
    .re-table-wrapper table {
        /* 4. Force table to be wider than mobile screen to trigger scroll */
        min-width: 600px; 
        width: 100%; 
        margin: 0 auto; /* Keeps it centered if viewed on a tablet */
    }

    .re-table-wrapper th,
    .re-table-wrapper td {
        padding: 12px 6px !important; 
        font-size: 13px !important; 
        white-space: nowrap; /* Prevents text from stacking vertically */
    }

    /* Quiz ID Mobile specific sizing */
    .re-table-wrapper th:first-child,
    .re-table-wrapper td:first-child {
        width: 25%; 
        font-size: 13px !important; 
    }
}

.re-chart-wrapper{
    background:#fff;
    padding:20px;
    border-radius:18px;
    box-shadow:0 8px 25px rgba(0,0,0,.04);
    border:1px solid #e2e8f0;
    margin-bottom:30px;
}

.re-chart-wrapper h3{
    margin:0 0 20px;
    text-align:center;
    font-size:22px;
}

.re-chart-wrapper{

    background:#fff;

    padding:20px;

    border-radius:18px;

    border:1px solid #e2e8f0;

    margin-bottom:30px;

    height:420px;

}

.re-chart-wrapper canvas{

    width:100% !important;

    height:320px !important;

}