/* ============================================================
   Maahir Progress Tracker — Custom Styles
   Complements the Tailwind Play CDN classes.
   ============================================================ */

:root {
    --color-primary: #2563eb;
    --color-success: #22c55e;
    --color-danger:  #ef4444;
}

/* ---------- Base ---------- */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

a, button, input, select, textarea { outline: none; }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Smooth transitions for interactive elements */
.btn, .card, a, button, input, select, textarea { transition: all .2s ease; }

/* ---------- Cards ---------- */
.card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,.05), 0 1px 3px 0 rgba(0,0,0,.05);
    border: 1px solid #e5e7eb;
    transition: transform .25s ease, box-shadow .25s ease;
}
.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 28px -10px rgba(37,99,235,.22), 0 6px 10px -6px rgba(0,0,0,.10);
}

/* ---------- Hamburger menu animation ---------- */
.hamburger { cursor: pointer; }
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 5px auto;
    background-color: currentColor;
    border-radius: 9999px;
    transition: transform .25s ease, opacity .2s ease;
}
.nav-toggle-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle-active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile dropdown entrance */
.mobile-menu { animation: slideDown .2s ease-out; }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Timer ---------- */
.timer-display { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.timer-warning { color: #d97706; font-weight: 700; animation: pulseWarn 1.2s ease-in-out infinite; }
.timer-critical { color: #dc2626; font-weight: 800; animation: pulseCrit .8s ease-in-out infinite; }
@keyframes pulseWarn { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes pulseCrit {
    0%,100% { opacity: 1; transform: scale(1); }
    50%     { opacity: .70; transform: scale(1.06); }
}

/* ---------- Leaderboard medals ---------- */
.medal-gold   { background: linear-gradient(135deg,#FFD700,#FFA500); color:#7c5600; }
.medal-silver { background: linear-gradient(135deg,#E5E4E2,#A8A8A8); color:#4b5563; }
.medal-bronze { background: linear-gradient(135deg,#CD7F32,#92400e); color:#fff; }
.medal {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.25rem; height: 2.25rem; border-radius: 9999px;
    font-weight: 700;
    box-shadow: inset 0 1px 2px rgba(255,255,255,.45), 0 2px 6px rgba(0,0,0,.18);
}

/* ---------- Progress bars ---------- */
.progress-track { background: #e5e7eb; border-radius: 9999px; overflow: hidden; }
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg,#3b82f6,#2563eb);
    border-radius: 9999px;
    transition: width .6s cubic-bezier(.4,0,.2,1);
    position: relative;
    overflow: hidden;
}
.progress-bar::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
    animation: shimmer 2s infinite;
}
.progress-bar.success { background: linear-gradient(90deg,#22c55e,#16a34a); }
.progress-bar.danger  { background: linear-gradient(90deg,#ef4444,#b91c1c); }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* ---------- Responsive tables ---------- */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrapper table { min-width: 100%; }
.table-scrollable { position: relative; border-left: 3px solid var(--color-primary); }
.table-hint {
    font-size: .75rem; color: #6b7280; padding: .25rem .5rem;
    display: inline-flex; align-items: center; gap: .25rem;
}

/* ---------- Exercise type badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: .25rem;
    padding: .125rem .625rem; border-radius: 9999px;
    font-size: .75rem; font-weight: 600; line-height: 1.25rem;
    border: 1px solid transparent; white-space: nowrap;
}
.badge-quiz      { background:#eff6ff; color:#1d4ed8; border-color:#bfdbfe; }
.badge-coding    { background:#ecfdf5; color:#047857; border-color:#a7f3d0; }
.badge-writing   { background:#fef3c7; color:#b45309; border-color:#fde68a; }
.badge-reading   { background:#f5f3ff; color:#6d28d9; border-color:#ddd6fe; }
.badge-challenge { background:#fff1f2; color:#be123c; border-color:#fecdd3; }
.badge-default   { background:#f3f4f6; color:#374151; border-color:#e5e7eb; }

/* ---------- Points badge ---------- */
.points-badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .3rem .75rem; border-radius: 9999px;
    background: linear-gradient(135deg,#fbbf24,#f59e0b);
    color: #78350f; font-weight: 700; font-size: .8rem;
    box-shadow: 0 1px 3px rgba(245,158,11,.40);
}

/* ---------- Prose (rendered markdown) ---------- */
.prose-content h1, .prose-content h2, .prose-content h3 { font-weight: 700; }
.prose-content ul, .prose-content ol { padding-left: 1.5rem; }
.prose-content ul { list-style: disc; }
.prose-content ol { list-style: decimal; }
.prose-content a { color: #2563eb; text-decoration: underline; }
.prose-content pre { background: #1e293b; color: #f1f5f9; padding: 1rem; border-radius: .5rem; overflow-x: auto; }
.prose-content code { background: #f1f5f9; padding: .125rem .375rem; border-radius: .25rem; font-size: .875em; }

/* ---------- Alerts ---------- */
.alert { transition: opacity .3s ease, transform .3s ease; }
.alert-dismissing { opacity: 0; transform: translateY(-8px); }

/* ---------- Print styles ---------- */
@media print {
    nav, .no-print { display: none !important; }
    body { background: #fff !important; }
    main, .max-w-7xl { max-width: 100% !important; }
    .card, .table-wrapper { box-shadow: none !important; border: 1px solid #d1d5db !important; }
    a { color: #000 !important; text-decoration: none !important; }
    .progress-bar::after, .timer-warning, .timer-critical { animation: none !important; }
}

/* ---------- Reduced motion (a11y) ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}
