/*
 * Matric Math Practice Tool Pro - Spectacular Styles
 * Modern, elegant, and fully responsive design
 * 
 * @version 2.0.0
 * @author Fundamanje Development Team
 */

/* ===========================================
   CSS CUSTOM PROPERTIES & VARIABLES
   =========================================== */
.matric-math-practice-tool-container {
    /* Color Palette */
    --primary-color: #2575fc;
    --accent-color: #6c5ce7;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --error-color: #e17055;
    
    /* Neutral Colors */
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --background-light: #f7fafc;
    --background-white: #ffffff;
    --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-medium: 0 4px 6px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-large: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
    
    /* Breakpoints */
    --mobile-max: 767px;
    --tablet-min: 768px;
    --tablet-max: 1023px;
    --desktop-min: 1024px;
}

/* ===========================================
   RESET & BASE STYLES
   =========================================== */
.matric-math-practice-tool-container *,
.matric-math-practice-tool-container *::before,
.matric-math-practice-tool-container *::after {
    box-sizing: border-box;
}

/* Global SVG size constraints - High specificity to override Elementor */
.elementor .matric-math-practice-tool-container svg,
.elementor-element .matric-math-practice-tool-container svg,
.matric-math-practice-tool-container svg {
    /* max-width: 100% !important; */
    /* max-height: 100% !important; */
    /* width: auto !important; */
    /* height: auto !important; */
    /* display: block !important; */
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    flex-basis: auto !important;
    align-self: auto !important;
    overflow: visible !important;
    transform: none !important;
    position: static !important;
    /* Preserve SVG aspect ratio and content */
    vector-effect: non-scaling-stroke !important;
}

/* Reset Elementor container flex properties that might affect SVG sizing */
.elementor .matric-math-practice-tool-container,
.elementor-element .matric-math-practice-tool-container {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: none !important; /* Override Elementor constraints */
}

/* Strong Elementor overrides for proper widget width */
.elementor-widget-container .matric-math-practice-tool-container,
.elementor-element .elementor-widget-container .matric-math-practice-tool-container,
.elementor-column .matric-math-practice-tool-container {
    width: 100% !important;
    max-width: none !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
}

/* Additional centering for the widget wrapper */
.elementor-widget-matric-math-practice-tool .elementor-widget-container {
    display: flex !important;
    justify-content: center !important;
    align-items: stretch !important;
    width: 100% !important;
}

/* Override Elementor container width constraints specifically for our widget */
.elementor-element:has(.matric-math-practice-tool-container) .e-con,
.elementor-widget-matric-math-practice-tool .e-con {
    --container-max-width: 1600px !important;
    max-width: 1600px !important;
    margin: 0 auto !important; /* Center the container */
    display: flex !important;
    justify-content: center !important;
}

/* Force full width for widget containers with proper centering */
.elementor-widget-matric-math-practice-tool,
.elementor-widget-matric-math-practice-tool .elementor-widget-container {
    width: 100% !important;
    max-width: none !important;
    display: flex !important;
    justify-content: center !important;
    margin: 0 auto !important;
}

/* Override responsive constraints for our widget containers */
@media (min-width: 1024px) {
    .elementor-element:has(.matric-math-practice-tool-container) .e-con,
    .elementor-widget-matric-math-practice-tool .e-con {
        --container-max-width: 1600px !important;
        max-width: 1600px !important;
        margin: 0 auto !important;
        display: flex !important;
        justify-content: center !important;
    }
    
    /* Ensure widget itself is centered within its max-width */
    .matric-math-practice-tool-container {
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

@media (max-width: 1023px) {
    .elementor-element:has(.matric-math-practice-tool-container) .e-con,
    .elementor-widget-matric-math-practice-tool .e-con {
        --container-max-width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        display: flex !important;
        justify-content: center !important;
    }
}

/* EMERGENCY: Force ALL SVGs to be 24px max to prevent flashing issues */
.elementor .matric-math-practice-tool-container svg,
.elementor-element .matric-math-practice-tool-container svg,
.matric-math-practice-tool-container svg {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

/* Ensure SVGs without explicit dimensions display properly */
.elementor .matric-math-practice-tool-container svg:not([width]):not([height]),
.elementor-element .matric-math-practice-tool-container svg:not([width]):not([height]),
.matric-math-practice-tool-container svg:not([width]):not([height]) {
    /* Prevent huge SVGs during loading */
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    overflow: visible !important;
    vector-effect: non-scaling-stroke !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

.matric-math-practice-tool-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-large);
    overflow: hidden;
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    animation: slideInUp 0.6s ease-out;
    
    /* Prevent jarring resize during load */
    min-height: 400px; /* Reserve minimum space */
    transition: all 0.3s ease; /* Smooth transitions */
    
    /* Force full width in Elementor */
    width: 100% !important;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================================
   HEADER SECTION
   =========================================== */
.matric-math-practice-tool-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    padding: var(--spacing-xl) var(--spacing-lg);
    position: relative;
    overflow: hidden;
}

.matric-math-practice-tool-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="20" cy="20" r="1" fill="white" opacity="0.1"/><circle cx="80" cy="80" r="1" fill="white" opacity="0.1"/><circle cx="40" cy="60" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>') repeat;
    pointer-events: none;
}

.matric-math-practice-tool-header-content {
    position: relative;
    z-index: 2;
}

.matric-math-practice-tool-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    margin: 0 0 var(--spacing-sm) 0;
    letter-spacing: -0.025em;
}

.matric-math-practice-tool-description {
    font-size: 1.125rem;
    margin: 0;
    opacity: 0.9;
    font-weight: 400;
}

.matric-math-practice-tool-header-decoration {
    position: absolute;
    top: 50%;
    right: var(--spacing-lg);
    transform: translateY(-50%);
    display: flex;
    gap: var(--spacing-sm);
}

.matric-math-practice-tool-decoration-circle {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float 3s ease-in-out infinite;
}

.matric-math-practice-tool-decoration-circle:nth-child(2) {
    animation-delay: 1.5s;
    width: 30px;
    height: 30px;
}

/* Number decorations with similar styling to circles */
.matric-math-practice-tool-decoration-number {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float 3s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
}

.matric-math-practice-tool-decoration-number:nth-child(2) {
    animation-delay: 1.5s;
    width: 30px;
    height: 30px;
    font-size: 14px;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* ===========================================
   FORM CONTAINER
   =========================================== */
.matric-math-practice-tool-form-container {
    padding: var(--spacing-xl) var(--spacing-lg);
}

.matric-math-practice-tool-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

/* ===========================================
   SECTION STYLES
   =========================================== */
.matric-math-practice-tool-section {
    background: var(--background-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition-base);
    position: relative;
}

.matric-math-practice-tool-section:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-medium);
    transform: translateY(-1px);
}

.matric-math-practice-tool-section-hidden {
    display: none;
}

.matric-math-practice-tool-section-header {
    background: var(--background-light);
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.elementor .matric-math-practice-tool-section-icon,
.elementor-element .matric-math-practice-tool-section-icon,
.matric-math-practice-tool-section-icon {
    width: 24px !important;
    height: 24px !important;
    color: var(--primary-color);
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    flex-basis: auto !important;
    overflow: hidden;
}

.elementor .matric-math-practice-tool-section-icon svg,
.elementor-element .matric-math-practice-tool-section-icon svg,
.matric-math-practice-tool-section-icon svg {
    width: 100% !important;
    height: 100% !important;
    max-width: 24px !important;
    max-height: 24px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    flex-basis: auto !important;
    overflow: visible !important;
    /* Ensure the SVG scales proportionally */
    vector-effect: non-scaling-stroke !important;
}

.matric-math-practice-tool-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
    color: var(--text-primary);
}

/* Action title styling removed - now using standard section title styling */

.matric-math-practice-tool-section-content {
    padding: var(--spacing-lg);
}

/* Center the start button within its section */
.matric-math-practice-tool-section[data-section="start"] .matric-math-practice-tool-section-content {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ===========================================
   TOGGLE BUTTONS
   =========================================== */
.matric-math-practice-tool-toggle-container {
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    width: 100%;
}

.matric-math-practice-tool-toggle-all {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.matric-math-practice-tool-toggle-all::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: var(--transition-base);
}

.matric-math-practice-tool-toggle-all:hover::before {
    width: 100%;
    height: 100%;
}

.matric-math-practice-tool-toggle-all:hover {
    background: var(--accent-color);
    transform: scale(1.05);
}

.matric-math-practice-tool-toggle-all.active {
    background: var(--success-color);
}

.matric-math-practice-tool-toggle-check {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.matric-math-practice-tool-toggle-check svg {
    width: 100%;
    height: 100%;
    stroke-width: 2;
}

/* ===========================================
   SELECT DROPDOWN
   =========================================== */
.matric-math-practice-tool-select-wrapper {
    position: relative;
    display: block;
}

.matric-math-practice-tool-select {
    width: 100%;
    padding: var(--spacing-md) 3rem var(--spacing-md) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    background: var(--background-white);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    transition: var(--transition-base);
}

.matric-math-practice-tool-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 117, 252, 0.1);
}

.matric-math-practice-tool-select:hover {
    border-color: var(--primary-color);
}

.matric-math-practice-tool-select-arrow {
    position: absolute;
    right: var(--spacing-md);
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition-base);
}

.matric-math-practice-tool-select-wrapper:hover .matric-math-practice-tool-select-arrow {
    color: var(--primary-color);
    transform: translateY(-50%) rotate(180deg);
}

/* ===========================================
   TEST CARD SELECTION STYLES
   =========================================== */
.matric-math-practice-tool-test-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.matric-math-practice-tool-test-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.matric-math-practice-tool-test-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.matric-math-practice-tool-test-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.matric-math-practice-tool-test-card:hover::before {
    transform: scaleX(1);
}

.matric-math-practice-tool-test-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.matric-math-practice-tool-test-card.selected::before {
    transform: scaleX(1);
}

.matric-math-practice-tool-test-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.matric-math-practice-tool-test-card-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.matric-math-practice-tool-test-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    line-height: 1.3;
}

.matric-math-practice-tool-test-card-description {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
}

.matric-math-practice-tool-test-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
}

.matric-math-practice-tool-test-card-badge {
    background: var(--accent-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.matric-math-practice-tool-test-card-questions {
    color: var(--text-light);
    font-size: 0.8rem;
    font-weight: 500;
}

.matric-math-practice-tool-loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
    min-height: 200px; /* Consistent height during loading */
    background: var(--background-light);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.matric-math-practice-tool-loading-state p {
    margin: 1rem 0 0 0;
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.matric-math-practice-tool-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: matric-math-spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes matric-math-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty state for test cards */
.matric-math-practice-tool-test-cards-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
    background: #f8fafc;
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
}

.matric-math-practice-tool-test-cards-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Mobile optimizations for test cards */
@media (max-width: 640px) {
    .matric-math-practice-tool-test-cards {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .matric-math-practice-tool-test-card {
        padding: 1.25rem;
    }
    
    .matric-math-practice-tool-test-card-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    
    .matric-math-practice-tool-test-card-title {
        font-size: 1rem;
    }
    
    .matric-math-practice-tool-test-card-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Tablet optimizations */
@media (min-width: 641px) and (max-width: 1024px) {
    .matric-math-practice-tool-test-cards {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

/* ===========================================
   OPTIONS GRID (Checkboxes)
   =========================================== */
.matric-math-practice-tool-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-sm);
}

.matric-math-practice-tool-no-options {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-muted);
    font-style: italic;
}

.matric-math-practice-tool-no-options p {
    margin: 0;
    opacity: 0.8;
}

.matric-math-practice-tool-option {
    position: relative;
    display: block;
    cursor: pointer;
}

.matric-math-practice-tool-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.matric-math-practice-tool-option-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--background-white);
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

.matric-math-practice-tool-option-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(37, 117, 252, 0.1), transparent);
    transition: var(--transition-base);
}

.matric-math-practice-tool-option:hover .matric-math-practice-tool-option-content::before {
    left: 100%;
}

.matric-math-practice-tool-option-check {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--background-white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-base);
    flex-shrink: 0;
}

.matric-math-practice-tool-option-check svg {
    width: 12px;
    height: 12px;
    color: white;
    opacity: 0;
    transform: scale(0);
    transition: var(--transition-base);
}

.matric-math-practice-tool-option-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition-base);
}

.matric-math-practice-tool-option:hover .matric-math-practice-tool-option-content {
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
}

.matric-math-practice-tool-option input:checked ~ .matric-math-practice-tool-option-content {
    border-color: var(--primary-color);
    background: rgba(37, 117, 252, 0.05);
}

.matric-math-practice-tool-option input:checked ~ .matric-math-practice-tool-option-content .matric-math-practice-tool-option-check {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.matric-math-practice-tool-option input:checked ~ .matric-math-practice-tool-option-content .matric-math-practice-tool-option-check svg {
    opacity: 1;
    transform: scale(1);
}

.matric-math-practice-tool-option input:checked ~ .matric-math-practice-tool-option-content .matric-math-practice-tool-option-text {
    color: var(--primary-color);
    font-weight: 600;
}

/* ===========================================
   RADIO GRID
   =========================================== */
.matric-math-practice-tool-radio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-sm);
}

.matric-math-practice-tool-radio-option {
    position: relative;
    display: block;
    cursor: pointer;
}

.matric-math-practice-tool-radio-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.matric-math-practice-tool-radio-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--background-white);
    transition: var(--transition-base);
    position: relative;
}

.matric-math-practice-tool-radio-check {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background: var(--background-white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-base);
    flex-shrink: 0;
    position: relative;
}

.matric-math-practice-tool-radio-check::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    transform: scale(0);
    transition: var(--transition-base);
}

.matric-math-practice-tool-radio-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition-base);
}

.matric-math-practice-tool-radio-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
}

.matric-math-practice-tool-radio-option input:checked ~ .matric-math-practice-tool-radio-check {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.matric-math-practice-tool-radio-option input:checked ~ .matric-math-practice-tool-radio-check::after {
    transform: scale(1);
}

.matric-math-practice-tool-radio-option input:checked ~ .matric-math-practice-tool-radio-text {
    color: var(--primary-color);
    font-weight: 600;
}

/* ===========================================
   QUESTION CONTROLS
   =========================================== */
.matric-math-practice-tool-question-controls {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.matric-math-practice-tool-range-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.matric-math-practice-tool-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.matric-math-practice-tool-range {
    width: 100%;
    height: 8px;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, #f0f4f8 0%, #d1e7fd 100%);
    outline: none;
    appearance: none;
    cursor: pointer;
    transition: var(--transition-base);
}

.matric-math-practice-tool-range::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: var(--shadow-light);
    transition: var(--transition-base);
}

.matric-math-practice-tool-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-medium);
}

.matric-math-practice-tool-range::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-light);
    transition: var(--transition-base);
}

.matric-math-practice-tool-number-controls {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.matric-math-practice-tool-number {
    flex: 1;
    padding: var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    background: var(--background-white);
    color: var(--text-primary);
    transition: var(--transition-base);
    min-width: 100px;
}

.matric-math-practice-tool-number:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 117, 252, 0.1);
}

.matric-math-practice-tool-max-btn {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--background-light);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-base);
    white-space: nowrap;
}

.matric-math-practice-tool-max-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.matric-math-practice-tool-max-btn.active {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.matric-math-practice-tool-question-info {
    text-align: center;
    margin-top: var(--spacing-sm);
}

.matric-math-practice-tool-info-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ===========================================
   MODE CARDS
   =========================================== */
.matric-math-practice-tool-mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.matric-math-practice-tool-mode-card {
    position: relative;
    display: block;
    cursor: pointer;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--background-white);
    transition: var(--transition-base);
    overflow: hidden;
    min-height: 120px;
}

.matric-math-practice-tool-mode-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.matric-math-practice-tool-mode-content {
    padding: var(--spacing-lg);
    text-align: center;
    position: relative;
    z-index: 1;
}

.matric-math-practice-tool-mode-icon {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
    display: block;
}

.matric-math-practice-tool-mode-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 var(--spacing-xs) 0;
    color: var(--text-primary);
    transition: var(--transition-base);
}

.matric-math-practice-tool-mode-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
    transition: var(--transition-base);
}

.matric-math-practice-tool-mode-check {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: var(--transition-base);
}

.matric-math-practice-tool-mode-check svg {
    width: 14px;
    height: 14px;
    color: white;
}

.matric-math-practice-tool-mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(37, 117, 252, 0.05) 0%, rgba(108, 92, 231, 0.05) 100%);
    opacity: 0;
    transition: var(--transition-base);
}

.matric-math-practice-tool-mode-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.matric-math-practice-tool-mode-card:hover::before {
    opacity: 1;
}

.matric-math-practice-tool-mode-card input:checked ~ .matric-math-practice-tool-mode-content .matric-math-practice-tool-mode-title {
    color: var(--primary-color);
}

.matric-math-practice-tool-mode-card input:checked ~ .matric-math-practice-tool-mode-content .matric-math-practice-tool-mode-desc {
    color: var(--text-secondary);
}

.matric-math-practice-tool-mode-card input:checked ~ .matric-math-practice-tool-mode-check {
    opacity: 1;
    transform: scale(1);
}

.matric-math-practice-tool-mode-card input:checked {
    border-color: var(--primary-color);
}

/* ===========================================
   VALIDATION MESSAGE
   =========================================== */
.matric-math-practice-tool-validation {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    font-weight: 500;
    text-align: center;
    margin: var(--spacing-lg) 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: var(--transition-base);
    display: none;
}

.matric-math-practice-tool-validation.show {
    opacity: 1;
    transform: translateY(0);
    display: block;
    animation: shake 0.5s ease-in-out;
}

.matric-math-practice-tool-validation.error {
    background: rgba(225, 112, 85, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(225, 112, 85, 0.3);
}

.matric-math-practice-tool-validation.success {
    background: rgba(0, 184, 148, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(0, 184, 148, 0.3);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ===========================================
   ACTION BUTTON
   =========================================== */
/* Actions styling removed - now using standard section styling */

.matric-math-practice-tool-start-button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%) !important;
    color: white !important;
    border: none !important;
    padding: 18px 36px !important;
    border-radius: 12px !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: var(--transition-base);
    position: relative;
    box-shadow: var(--shadow-medium);
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-width: 180px;
    min-height: 60px;
    overflow: hidden;
}

.matric-math-practice-tool-start-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: var(--transition-slow);
}

.matric-math-practice-tool-start-button:hover::before {
    left: 100%;
}

.matric-math-practice-tool-start-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-large);
}

.matric-math-practice-tool-start-button:active {
    transform: translateY(0);
}

.matric-math-practice-tool-btn-content {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-base);
}

.matric-math-practice-tool-btn-icon {
    width: 24px !important;
    height: 24px !important;
    transition: var(--transition-base);
    color: white;
    fill: currentColor;
    display: block !important;
    flex-shrink: 0 !important;
    max-width: 24px !important;
    max-height: 24px !important;
}

.matric-math-practice-tool-btn-text {
    transition: var(--transition-base);
    position: relative;
    z-index: 1;
    color: white !important;
    font-weight: 600;
    display: inline-block;
}

.matric-math-practice-tool-btn-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: var(--transition-base);
}

.matric-math-practice-tool-start-button.loading .matric-math-practice-tool-btn-content {
    opacity: 0;
}

.matric-math-practice-tool-start-button.loading .matric-math-practice-tool-btn-loader {
    opacity: 1;
}

.matric-math-practice-tool-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===========================================
   UPGRADE BUTTON
   =========================================== */
.matric-math-practice-tool-upgrade-container {
    padding: var(--spacing-lg);
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--background-light);
}

.matric-math-practice-tool-upgrade-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--warning-color);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition-base);
    box-shadow: var(--shadow-light);
}

.matric-math-practice-tool-upgrade-btn:hover {
    background: #e07d39;
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
    text-decoration: none;
    color: white;
}

.matric-math-practice-tool-upgrade-btn svg {
    width: 16px;
    height: 16px;
}

/* ===========================================
   SECTION VISIBILITY CONTROL
   =========================================== */

/* Initially hide dependent sections until test is selected */
.matric-math-practice-tool-container .matric-math-practice-tool-section[data-section="subjects"],
.matric-math-practice-tool-container .matric-math-practice-tool-section[data-section="topics"],
.matric-math-practice-tool-container .matric-math-practice-tool-section[data-section="levels"],
.matric-math-practice-tool-container .matric-math-practice-tool-section[data-section="pool"],
.matric-math-practice-tool-container .matric-math-practice-tool-section[data-section="questions"],
.matric-math-practice-tool-container .matric-math-practice-tool-section[data-section="mode"],
.matric-math-practice-tool-container .matric-math-practice-tool-section[data-section="start"],
.matric-math-practice-tool-container .matric-math-practice-tool-validation {
    display: none;
}

/* Hide Topics section when no topics available */
.matric-math-practice-tool-section[data-section="topics"].matric-math-hide-section {
    display: none !important;
}

/* Show sections when test is selected */
.matric-math-practice-tool-container.matric-math-test-selected .matric-math-practice-tool-section[data-section="subjects"],
.matric-math-practice-tool-container.matric-math-test-selected .matric-math-practice-tool-section[data-section="levels"],
.matric-math-practice-tool-container.matric-math-test-selected .matric-math-practice-tool-section[data-section="pool"],
.matric-math-practice-tool-container.matric-math-test-selected .matric-math-practice-tool-section[data-section="questions"],
.matric-math-practice-tool-container.matric-math-test-selected .matric-math-practice-tool-section[data-section="mode"],
.matric-math-practice-tool-container.matric-math-test-selected .matric-math-practice-tool-section[data-section="start"],
.matric-math-practice-tool-container.matric-math-test-selected .matric-math-practice-tool-validation {
    display: block;
}

/* Show topics section only when test is selected AND topics are available */
.matric-math-practice-tool-container.matric-math-test-selected .matric-math-practice-tool-section[data-section="topics"]:not(.matric-math-hide-section) {
    display: block;
}

/* ===========================================
   RESPONSIVE DESIGN
   =========================================== */

/* Mobile Devices (up to 767px) */
@media (max-width: 767px) {
    .matric-math-practice-tool-container {
        border-radius: 0;
        margin: 0;
    }
    
    .matric-math-practice-tool-header {
        padding: var(--spacing-lg) var(--spacing-md);
        text-align: center;
    }
    
    .matric-math-practice-tool-header-decoration {
        display: none;
    }
    
    .matric-math-practice-tool-title {
        font-size: 1.75rem;
    }
    
    .matric-math-practice-tool-description {
        font-size: 1rem;
    }
    
    .matric-math-practice-tool-form-container {
        padding: var(--spacing-lg) var(--spacing-md);
    }
    
    .matric-math-practice-tool-form {
        gap: var(--spacing-lg);
    }
    
    .matric-math-practice-tool-section-header {
        padding: var(--spacing-sm) var(--spacing-md);
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .matric-math-practice-tool-section-content {
        padding: var(--spacing-md);
    }
    
    .matric-math-practice-tool-options-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-xs);
    }
    
    .matric-math-practice-tool-radio-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-xs);
    }
    
    .matric-math-practice-tool-mode-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .matric-math-practice-tool-question-controls {
        gap: var(--spacing-md);
    }
    
    .matric-math-practice-tool-number-controls {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .matric-math-practice-tool-number {
        min-width: auto;
        width: 100%;
    }
    
    .matric-math-practice-tool-max-btn {
        width: 100%;
        justify-content: center;
    }
    
    .matric-math-practice-tool-start-button {
        padding: 14px 28px;
        font-size: 16px;
    }
}

/* Tablet Devices (768px to 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .matric-math-practice-tool-header {
        padding: var(--spacing-xl) var(--spacing-lg);
    }
    
    .matric-math-practice-tool-form-container {
        padding: var(--spacing-xl) var(--spacing-lg);
    }
    
    .matric-math-practice-tool-options-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    
    .matric-math-practice-tool-mode-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .matric-math-practice-tool-question-controls {
        gap: var(--spacing-lg);
    }
    
    .matric-math-practice-tool-number-controls {
        flex-direction: row;
    }
}

/* Desktop Devices (1024px and above) */
@media (min-width: 1024px) {
    .matric-math-practice-tool-container {
        max-width: 1200px; /* Increased from 900px for better desktop utilization */
    }
    
    .matric-math-practice-tool-section:hover {
        transform: translateY(-2px);
    }
    
    .matric-math-practice-tool-options-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
    
    .matric-math-practice-tool-mode-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .matric-math-practice-tool-start-button:hover .matric-math-practice-tool-btn-icon {
        transform: translateX(3px);
    }
}

/* Extra Large Screens (1440px and above) */
@media (min-width: 1440px) {
    .matric-math-practice-tool-container {
        max-width: 1400px; /* Increased from 1000px for ultra-wide screens */
    }
    
    .matric-math-practice-tool-mode-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Ultra Wide Screens (1920px and above) */
@media (min-width: 1920px) {
    .matric-math-practice-tool-container {
        max-width: 1600px; /* Optimal width for ultra-wide monitors */
    }
    
    .matric-math-practice-tool-options-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: var(--spacing-xl);
    }
    
    .matric-math-practice-tool-mode-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ===========================================
   ACCESSIBILITY & FOCUS STATES
   =========================================== */
.matric-math-practice-tool-container *:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.matric-math-practice-tool-container button:focus,
.matric-math-practice-tool-container input:focus,
.matric-math-practice-tool-container select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 117, 252, 0.3);
}

/* ===========================================
   MEMBERSHIP NOTIFICATION STYLES
   =========================================== */
.matric-math-practice-tool-membership-notice {
    display: none;
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-xl);
    background: linear-gradient(135deg, #f8faff 0%, #e3f2fd 100%);
    border: 2px solid rgba(37, 117, 252, 0.2);
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden;
}

.matric-math-practice-tool-membership-notice::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #2575fc 0%, #6c5ce7 100%);
}

.matric-math-practice-tool-membership-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    text-align: left;
}

.matric-math-practice-tool-membership-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #2575fc 0%, #6c5ce7 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.matric-math-practice-tool-membership-icon svg {
    width: 24px;
    height: 24px;
}

.matric-math-practice-tool-membership-text {
    flex: 1;
}

.matric-math-practice-tool-membership-text h3 {
    margin: 0 0 var(--spacing-sm) 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.matric-math-practice-tool-membership-text p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

.matric-math-practice-tool-membership-actions {
    flex-shrink: 0;
}

.matric-math-practice-tool-upgrade-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    background: linear-gradient(135deg, #2575fc 0%, #6c5ce7 100%);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 2px 8px rgba(37, 117, 252, 0.3);
}

.matric-math-practice-tool-upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 117, 252, 0.4);
    color: white;
    text-decoration: none;
}

.matric-math-practice-tool-upgrade-btn svg {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-speed) ease;
}

.matric-math-practice-tool-upgrade-btn:hover svg {
    transform: translate(2px, -2px);
}

/* Mobile responsive membership notice */
@media (max-width: 768px) {
    .matric-math-practice-tool-membership-content {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-md);
    }
    
    .matric-math-practice-tool-membership-icon {
        width: 56px;
        height: 56px;
    }
    
    .matric-math-practice-tool-membership-icon svg {
        width: 28px;
        height: 28px;
    }
    
    .matric-math-practice-tool-upgrade-btn {
        width: 100%;
        justify-content: center;
        padding: var(--spacing-lg);
    }
}

/* ===========================================
   ACCESSIBILITY & PREFERENCES
   =========================================== */

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .matric-math-practice-tool-container *,
    .matric-math-practice-tool-container *::before,
    .matric-math-practice-tool-container *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .matric-math-practice-tool-container {
        --border-color: #000000;
        --text-primary: #000000;
        --text-secondary: #333333;
    }
}

/* ===========================================
   PRINT STYLES
   =========================================== */
@media print {
    .matric-math-practice-tool-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .matric-math-practice-tool-header {
        background: #f0f0f0 !important;
        color: #000 !important;
    }
    
    .matric-math-practice-tool-start-button,
    .matric-math-practice-tool-upgrade-container {
        display: none;
    }
}/* Updated at Sun Sep 14 20:29:07 SAST 2025 */
/* SVG fixes applied at Sun Sep 14 20:35:46 SAST 2025 */
/* Removed problematic width/height constraints at Sun Sep 14 20:38:35 SAST 2025 */
