/**
 * Nour Al-Bayan Interactive Platform - Index Page Styles
 * Layout, cards grid, hero banner, badges, and responsive utilities.
 */

:root {
    --primary: #047857;
    --primary-hover: #059669;
    --primary-light: #ecfdf5;
    --accent: #d97706;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --border-color: #e2e8f0;
  }

  /* رابط التخطي للوصولية */
  .skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #047857;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 0 0 12px 12px;
    font-weight: 800;
    font-size: 0.9rem;
    z-index: 1000;
    text-decoration: none;
    transition: top 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  .skip-link:focus-visible {
    top: 0;
    outline: 3px solid #fbbf24;
  }

  body {
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
    background-color: var(--bg);
  }

  header {
    background: linear-gradient(135deg, #065f46 0%, #047857 50%, #0d9488 100%);
    color: #ffffff;
    text-align: center;
    padding: 40px 20px 32px;
    box-shadow: 0 4px 20px rgba(4, 120, 87, 0.15);
    position: relative;
    overflow: hidden;
  }

  header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #fbbf24, #10b981, #d97706);
  }

  header h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 900;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
  }

  header p {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    opacity: 0.95;
    font-weight: 500;
  }

  .header-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
  }

  .stats-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 7px 18px;
    border-radius: 9999px;
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffffff;
  }

  .action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #ffffff;
    padding: 7px 18px;
    border-radius: 9999px;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .action-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  }

  .action-btn:focus-visible, .lesson-card:focus-visible {
    outline: 3px solid #047857;
    outline-offset: 3px;
  }

  /* Active Student Header Chip */
  .active-student-chip {
    background: rgba(255, 255, 255, 0.22);
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    padding: 5px 14px;
    gap: 8px;
    font-weight: 800;
  }
  .active-student-chip:hover {
    background: rgba(255, 255, 255, 0.38);
    border-color: #ffffff;
  }
  .chip-avatar {
    font-size: 1.15rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .chip-name {
    font-size: 0.88rem;
    font-weight: 800;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .chip-score {
    background: rgba(0, 0, 0, 0.25);
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.78rem;
    color: #fef08a;
    font-weight: 900;
    font-family: ui-monospace, SFMono-Regular, monospace;
  }

  /* Roster Modal Styles */
  .roster-tab-btn {
    padding: 10px 18px;
    font-weight: 800;
    font-size: 0.88rem;
    color: #64748b;
    border-bottom: 3px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    border-top: none;
    border-left: none;
    border-right: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
  }
  .roster-tab-btn:hover {
    color: #047857;
    background: rgba(4, 120, 87, 0.04);
  }
  .roster-tab-btn.active {
    color: #047857;
    border-bottom-color: #047857;
    background: rgba(4, 120, 87, 0.08);
  }
  .roster-tab-btn:focus-visible {
    outline: 2px solid #047857;
    outline-offset: -2px;
  }

  /* Avatar Picker Grid */
  .avatar-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 8px;
    margin-top: 8px;
  }
  .avatar-option-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 2px solid #e2e8f0;
    background: #ffffff;
    font-size: 1.35rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .avatar-option-btn:hover {
    transform: scale(1.1);
    border-color: #10b981;
    background: #f0fdf4;
  }
  .avatar-option-btn.selected {
    border-color: #047857;
    background: #d1fae5;
    box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.25);
    transform: scale(1.08);
  }
  .avatar-option-btn:focus-visible {
    outline: 2px solid #047857;
    outline-offset: 2px;
  }

  /* Color Swatches */
  .color-picker-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
  }
  .color-swatch-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  .color-swatch-btn:hover {
    transform: scale(1.18);
  }
  .color-swatch-btn.selected {
    box-shadow: 0 0 0 3px #047857, 0 4px 10px rgba(4, 120, 87, 0.3);
    transform: scale(1.15);
  }
  .color-swatch-btn:focus-visible {
    outline: 2px solid #047857;
    outline-offset: 3px;
  }

  /* Quranic Mistake Bank Text */
  .mistake-word-card {
    background: #ffffff;
    border: 2px solid #fecdd3;
    border-radius: 18px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    box-shadow: 0 2px 8px rgba(244, 63, 94, 0.06);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .mistake-word-card:hover {
    transform: translateY(-2px);
    border-color: #f43f5e;
    box-shadow: 0 8px 16px rgba(244, 63, 94, 0.14);
  }
  .mistake-quran-text {
    font-family: 'Amiri', 'Traditional Arabic', serif;
    font-size: 1.85rem;
    font-weight: 700;
    color: #9f1239;
    line-height: 1.6;
    margin: 4px 0;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    letter-spacing: normal !important;
  }

  main {
    flex: 1;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 16px 48px;
  }

  .shortcuts-section {
    background: #ffffff;
    border: 2px solid #d1fae5;
    border-radius: 24px;
    padding: 22px 20px;
    margin-bottom: 32px;
    box-shadow: 0 4px 16px rgba(4, 120, 87, 0.05);
  }

  .shortcuts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .shortcuts-title {
    font-size: 1.15rem;
    font-weight: 900;
    color: #065f46;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
  }

  .shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
  }

  .shortcut-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .shortcut-card-title {
    font-size: 0.84rem;
    font-weight: 800;
    color: #047857;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
  }

  .shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.86rem;
    font-weight: 700;
    color: #334155;
  }

  .kbd-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    font-size: 0.76rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 800;
    color: #0f172a;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-bottom: 2px solid #94a3b8;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
  }

  .kbd-hint {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
  }

  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
  }

  .grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .card-item {
    display: flex;
  }

  .lesson-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    width: 100%;
  }

  @media (hover: hover) {
    .lesson-card:hover {
      transform: translateY(-3px);
      border-color: #34d399;
      box-shadow: 0 12px 24px -6px rgba(16, 185, 129, 0.18);
      background: #ffffff;
    }
    .lesson-card:hover .card-arrow {
      color: var(--primary);
      transform: translateX(-4px);
    }
  }

  .lesson-card:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  }

  .card-num {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: linear-gradient(135deg, #059669, #047857);
    color: #ffffff;
    font-size: 1.45rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(4, 120, 87, 0.25);
  }

  .card-info {
    flex: 1;
    min-width: 0;
    text-align: right;
  }

  .card-badge {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-block;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
  }

  .card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .card-arrow {
    font-size: 1.25rem;
    color: #94a3b8;
    transition: transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    font-weight: 900;
  }

  .empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 48px 20px;
    background: #ffffff;
    border: 2px dashed var(--border-color);
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: 600;
  }

  footer {
    text-align: center;
    padding: 24px 20px;
    font-size: 0.88rem;
    color: var(--text-main);
    border-top: 1px solid var(--border-color);
    background: #ffffff;
  }

  footer p {
    margin-top: 4px;
    font-size: 0.82rem;
    color: #475569;
  }
