/* ============================================================================
   GENX ACADEMY - MASTER CSS FRAMEWORK
   Purpose: Global Visibility & Contrast Fix
   Author: Senior UI/UX Engineer
   Version: 1.0
   ============================================================================ */

/* ============================================================================
   1. GLOBAL CSS VARIABLES - THE FOUNDATION
   ============================================================================ */

/* Light Mode (Default) */
:root {
    /* === PRIMARY COLORS === */
    --crimson-red: #E11D48;
    --crimson-red-dark: #BE123C;
    --crimson-red-light: #FB7185;

    /* === BACKGROUNDS === */
    --bg-primary: #050505;
    --bg-secondary: #0f172a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-hover: rgba(255, 255, 255, 0.05);

    /* === TEXT COLORS === */
    --text-main: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-on-red: #FFFFFF;
    /* Pure White for Red Backgrounds */
    --text-on-white: #1A1A1A;
    /* Dark Text for White Backgrounds */

    /* === BORDERS === */
    --border-light: #E2E8F0;
    --border-medium: #CBD5E1;
    --border-dark: #94A3B8;
    --border-focus: #E11D48;

    /* === SHADOWS === */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* === GRADIENTS === */
    --gradient-primary: linear-gradient(135deg, #E11D48 0%, #BE123C 100%);
    --gradient-text: linear-gradient(135deg, #1A1A1A 0%, #475569 100%);
}

/* ============================================================================
   2. LIGHT MODE OVERRIDES 
   ============================================================================ */

body.light-theme {
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-hover: #F1F5F9;
    --text-main: #1A1A1A;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --border-light: #E2E8F0;
    --gradient-text: linear-gradient(135deg, #1A1A1A 0%, #475569 100%);
}

/* ============================================================================
   2. WHITE-ON-WHITE EMERGENCY FIX
   ============================================================================ */

/* Force dark text on any white/light background */
[style*="background: white"],
[style*="background: #fff"],
[style*="background: #ffffff"],
[style*="background-color: white"],
[style*="background-color: #fff"],
[style*="background-color: #ffffff"],
.bg-white,
.bg-light {
    color: var(--text-on-white) !important;
}

/* Ensure white text on red backgrounds */
[style*="background: #E11D48"],
[style*="background-color: #E11D48"],
.bg-red,
.bg-crimson {
    color: var(--text-on-red) !important;
}

/* ============================================================================
   3. COMPONENT STANDARDIZATION
   ============================================================================ */

/* === BUTTONS === */

/* Base Button Styles */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

/* Primary Button - Crimson Red with White Text */
.btn-primary {
    background: var(--gradient-primary);
    color: var(--text-on-red) !important;
    border-color: var(--crimson-red);
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.25);
}

.btn-primary:hover {
    background: var(--crimson-red-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(225, 29, 72, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Secondary Button - Clear Border with Dark Text */
.btn-secondary {
    background: transparent;
    color: var(--text-main) !important;
    border: 2px solid var(--border-medium);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--crimson-red);
    color: var(--crimson-red) !important;
}

/* Outline Button */
.btn-outline {
    background: transparent;
    color: var(--text-main) !important;
    border: 2px solid var(--border-medium);
}

.btn-outline:hover {
    background: rgba(225, 29, 72, 0.05);
    border-color: var(--crimson-red);
    color: var(--crimson-red) !important;
}

/* Gold/Premium Button */
.btn-gold {
    background: var(--gradient-primary);
    color: var(--text-on-red) !important;
    border-color: var(--crimson-red);
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.25);
}

.btn-gold:hover {
    box-shadow: 0 8px 24px rgba(225, 29, 72, 0.5);
    transform: translateY(-2px);
}

/* === FORM INPUTS === */

/* Base Input Styles */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    line-height: 1.5;
    color: green;
    background-color: var(--bg-primary);
    border: 2px solid var(--border-medium);
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: inherit;
}

/* Input Focus State */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.1);
}

/* Input Placeholder */
input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Disabled Inputs */
input:disabled,
textarea:disabled,
select:disabled {
    background-color: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

/* === CARDS & CONTAINERS === */

.card,
.box,
[class*="card"] {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-medium);
}

/* ============================================================================
   4. ACCESSIBILITY & CONTRAST (WCAG COMPLIANCE)
   ============================================================================ */

/* === HIGH CONTRAST TEXT === */

/* Ensure minimum 4.5:1 contrast ratio */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-main);
    font-weight: 700;
}

p,
span,
div {
    color: var(--text-main);
}

/* Muted text with sufficient contrast */
.text-muted,
small {
    color: var(--text-secondary);
}

/* === LINKS === */

a {
    color: var(--crimson-red);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--crimson-red-dark);
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--crimson-red);
    outline-offset: 2px;
}

/* Navigation Links */
.nav-link,
.menu-link {
    color: var(--text-main) !important;
    font-weight: 700;
}

.nav-link:hover,
.menu-link:hover {
    color: var(--crimson-red) !important;
}

/* === BADGES & LABELS === */

.badge,
.label,
.tag {
    display: inline-block;
    padding: 4px 12px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-main);
    border: 1px solid var(--border-light);
}

.badge-primary {
    background: var(--crimson-red);
    color: var(--text-on-red);
    border-color: var(--crimson-red);
}

.badge-success {
    background: #10B981;
    color: #FFFFFF;
    border-color: #10B981;
}

.badge-warning {
    background: #F59E0B;
    color: #FFFFFF;
    border-color: #F59E0B;
}

.badge-danger {
    background: #EF4444;
    color: #FFFFFF;
    border-color: #EF4444;
}

/* ============================================================================
   5. UTILITY CLASSES
   ============================================================================ */

/* Background Utilities */
.bg-white {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}

.bg-dark {
    background-color: #0f172a !important;
    color: #f8fafc !important;
}

.bg-primary {
    background-color: var(--bg-primary) !important;
}

.bg-secondary {
    background-color: var(--bg-secondary) !important;
}

.bg-red {
    background-color: var(--crimson-red) !important;
    color: var(--text-on-red) !important;
}

/* Text Utilities */
.text-primary {
    color: var(--text-main) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-white {
    color: #FFFFFF !important;
}

.text-red {
    color: var(--crimson-red) !important;
}

/* Border Utilities */
.border {
    border: 1px solid var(--border-light) !important;
}

.border-medium {
    border: 1px solid var(--border-medium) !important;
}

.border-red {
    border: 2px solid var(--crimson-red) !important;
}

/* Shadow Utilities */
.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow-md {
    box-shadow: var(--shadow-md) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

/* Responsive Header Utilities */
@media (max-width: 768px) {
    .mobile-hide {
        display: none !important;
    }
}

/* ============================================================================
   6. EMERGENCY OVERRIDES (Nuclear Option)
   ============================================================================ */

/* Force visibility on potentially invisible elements */
button:not([class*="btn"]) {
    background: var(--crimson-red) !important;
    color: var(--text-on-red) !important;
    border: 2px solid var(--crimson-red) !important;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

/* Ensure all white backgrounds have dark text */
*[style*="background:#fff"],
*[style*="background: #fff"],
*[style*="background:#ffffff"],
*[style*="background: #ffffff"],
*[style*="background:white"],
*[style*="background: white"] {
    color: var(--text-on-white) !important;
}

/* ============================================================================
   END OF MASTER CSS FRAMEWORK
   ============================================================================ */

/* ============================================================================
   7. ENABLE TEXT SELECTION (User Request) - Expanded Scope
   ============================================================================ */

/* Force Enable Selection on Content Pages */
body.auth-page,
/* Login/Signup */
body.courses-page,
/* Courses */
.community-grid,
/* Community Feed */
.user-content,
/* User Dashboard Content */
.post-content,
.post-content-text,
.course-description,
.video-description-box,
.lesson-description,
.description,
.content-area,
.caption,
.comment-content,
.comment-bubble,
.resource-item,
input,
textarea,
.form-control {
    user-select: text !important;
    -webkit-user-select: text !important;
    cursor: auto;
}

/* BUT: Still Protect Media & UI Elements */
img,
video,
.sidebar,
.header,
.btn,
.nav-link,
.secure-player,
.secure-player-forum {
    user-select: none !important;
    -webkit-user-select: none !important;
}