/* Time Master Z - Modern Gamified CSS Theme */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800;900&display=swap');

:root {
    --bg-dark: #070913;
    --bg-card: rgba(15, 23, 42, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --border-glow: rgba(255, 255, 255, 0.08);
    --border-active: rgba(6, 182, 212, 0.4);
    
    --primary: #06b6d4;
    --primary-glow: rgba(6, 182, 212, 0.25);
    --secondary: #a855f7;
    --secondary-glow: rgba(168, 85, 247, 0.25);
    --accent: #10b981;
    --warning: #f59e0b;
    --danger: #f43f5e;
    
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    
    --shadow-glow: 0 10px 30px -10px rgba(6, 182, 212, 0.3);
    --transition-fast: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 3rem;
}

/* Background Ambient Animation */
.ambient-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    filter: blur(100px);
    opacity: 0.25;
    border-radius: 50%;
    animation: blobFloat 18s infinite alternate ease-in-out;
}

.blob-1 {
    top: -10%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: var(--primary);
}

.blob-2 {
    bottom: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: var(--secondary);
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 30%;
    width: 400px;
    height: 400px;
    background: var(--accent);
    animation-delay: -10s;
}

@keyframes blobFloat {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, 60px) scale(1.1); }
    100% { transform: translate(-30px, 30px) scale(0.9); }
}

/* Container & Layout */
.tm-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navbar / Topbar Header */
.tm-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    margin-top: 1rem;
    margin-bottom: 2.5rem;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.tm-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-light);
}

.tm-brand-icon {
    width: 45px;
    height: 45px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    box-shadow: 0 0 15px var(--primary-glow);
}

.tm-brand-title {
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: -0.5px;
}

.tm-brand-title span {
    color: var(--primary);
}

.tm-nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glow);
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    transition: var(--transition-fast);
}

.btn-nav:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

/* User Progress Bar Header Component */
.user-xp-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.25);
    padding: 0.5rem 1rem;
    border-radius: 50px;
}

.xp-icon {
    color: var(--warning);
    font-size: 1.1rem;
}

.xp-value {
    font-weight: 800;
    color: #fff;
    font-size: 0.95rem;
}

/* Hero Section */
.hero-banner {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(180deg, rgba(6, 182, 212, 0.08) 0%, rgba(168, 85, 247, 0.03) 100%);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

.hero-tag {
    display: inline-block;
    padding: 0.4rem 1.25rem;
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--primary);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
}

.hero-title {
    font-size: 2.8rem;
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, #ffffff 0%, #a855f7 50%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 780px;
    margin: 0 auto 2rem;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-num {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Glassmorphism Cards & Modules */
.tm-section-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tm-section-title i {
    color: var(--primary);
}

.modules-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 3rem;
}

.module-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: var(--transition-smooth);
}

.module-card:hover {
    border-color: var(--border-active);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-glow);
    padding-bottom: 1rem;
}

.module-title-group h3 {
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
}

.module-title-group p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.lessons-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}

.lesson-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.lesson-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary-glow);
    transform: translateY(-3px);
}

.lesson-item.completed {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.03);
}

.lesson-item.completed::after {
    content: '✓ مكتمل';
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
}

.lesson-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lesson-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: rgba(6, 182, 212, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.lesson-info h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.25rem;
}

.lesson-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.lesson-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.xp-tag {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-start {
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), #0284c7);
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    transition: var(--transition-fast);
    border: none;
    cursor: pointer;
}

.btn-start:hover {
    box-shadow: 0 0 15px var(--primary-glow);
    transform: scale(1.03);
}

/* Interactive Components inside Lessons */
.interactive-box {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin: 2rem 0;
}

.interactive-box h3 {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Drag and Drop Container */
.dnd-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.dnd-zone {
    background: rgba(15, 23, 42, 0.8);
    border: 2px dashed var(--border-glow);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    min-height: 220px;
    transition: var(--transition-fast);
}

.dnd-zone.drag-over {
    border-color: var(--primary);
    background: rgba(6, 182, 212, 0.08);
}

.dnd-zone-title {
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--text-light);
}

.dnd-item {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
    cursor: grab;
    user-select: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.dnd-item:active {
    cursor: grabbing;
}

.dnd-item:hover {
    border-color: var(--primary);
    transform: scale(1.02);
}

/* Decision Simulator */
.simulator-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9));
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-md);
    padding: 2rem;
    margin: 1.5rem 0;
}

.sim-scenario {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.sim-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sim-option-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: right;
    cursor: pointer;
    transition: var(--transition-fast);
}

.sim-option-btn:hover {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.sim-feedback {
    display: none;
    margin-top: 1.5rem;
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #fff;
}

/* Timer Widget */
.timer-display {
    font-size: 3.5rem;
    font-weight: 900;
    font-family: monospace;
    color: var(--primary);
    text-align: center;
    margin: 1.5rem 0;
    letter-spacing: 2px;
}

.timer-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn-action {
    padding: 0.75rem 1.75rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #0284c7);
    color: #fff;
}

.btn-primary:hover {
    box-shadow: 0 0 20px var(--primary-glow);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid var(--border-glow);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Progress Bar */
.progress-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 50px;
    transition: width 0.5s ease-in-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    .tm-nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    .hero-stats {
        gap: 1.25rem;
    }
    .timer-display {
        font-size: 2.5rem;
    }
}

/* Certificate Modal & Contract Print */
@media print {
    body {
        background: #fff;
        color: #000;
    }
    .tm-nav, .ambient-glow, .btn-action, .btn-nav {
        display: none !important;
    }
    .printable-contract {
        border: 2px solid #000;
        padding: 2rem;
        color: #000;
    }
}
