/* بوابة المعلم — أولوية للجوال (بدون تدرج أخضر) */

:root {
    --primary-color: #334155;
    --primary-hover: #1e293b;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-body: #e2e8f0;
    --bg-card: #ffffff;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --border-radius: 10px;
    --font-family: "Cairo", system-ui, sans-serif;
}

.tp-body {
    margin: 0;
    min-height: 100vh;
    font-family: "Cairo", system-ui, sans-serif;
    background: linear-gradient(180deg, #e8ecf4 0%, #dce3ee 38%, #f1f4f8 38%, #f8fafc 100%);
    color: #1e293b;
}

.tp-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.tp-brand {
    font-weight: 700;
    color: #0f172a;
    text-decoration: none;
    font-size: 1rem;
}

.tp-brand i {
    margin-inline-end: 0.35rem;
    color: #475569;
    font-style: normal;
}

.tp-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.tp-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.65rem;
    border-radius: 999px;
    font-size: 0.85rem;
    color: #334155;
    text-decoration: none;
    background: #e2e8f0;
    font-style: normal;
}

.tp-nav-link:hover {
    background: #cbd5e1;
    color: #0f172a;
}

.tp-nav-out {
    background: #fef2f2;
    color: #b91c1c;
}

.tp-main {
    max-width: 640px;
    margin: 0 auto;
    padding: 1rem 1rem 2.5rem;
}

.tp-hero {
    background: #fff;
    border-radius: 1rem;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.tp-hero h1 {
    font-size: 1.25rem;
    margin: 0 0 0.25rem;
    color: #0f172a;
}

.tp-hero p {
    margin: 0;
    font-size: 0.9rem;
    color: #64748b;
}

.tp-student-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.tp-card {
    display: block;
    background: #fff;
    border-radius: 0.85rem;
    padding: 1rem 1.1rem;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 14px rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tp-card:active {
    transform: scale(0.99);
}

.tp-card:hover {
    box-shadow: 0 6px 22px rgba(15, 23, 42, 0.1);
}

.tp-card-name {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.35rem;
    color: #0f172a;
}

.tp-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.82rem;
    color: #64748b;
}

.tp-card-meta i {
    color: #64748b;
    font-style: normal;
}

.tp-card-go {
    margin-top: 0.65rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
}

.tp-empty {
    text-align: center;
    padding: 2rem 1rem;
    background: #fff;
    border-radius: 1rem;
    color: #64748b;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

/* صفحة تسجيل الدخول فقط — خلفية هادئة، بدون خط مائل أخضر */
.tp-login-page--auth {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    font-family: "Cairo", system-ui, sans-serif;
    background: #f1f5f9;
    background-image: radial-gradient(ellipse 120% 80% at 50% -20%, #e2e8f0 0%, #f1f5f9 45%, #f8fafc 100%);
    color: #1e293b;
}

.tp-login-page--auth .tp-login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 1.1rem;
    padding: 1.5rem 1.35rem;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.tp-login-page--auth .tp-login-card h1 {
    font-size: 1.2rem;
    text-align: center;
    margin: 0 0 0.35rem;
    color: #0f172a;
    font-style: normal;
}

.tp-login-page--auth .tp-login-card h1 i {
    color: #475569;
    font-style: normal;
    margin-inline-end: 0.35rem;
}

.tp-login-page--auth .sub {
    text-align: center;
    font-size: 0.88rem;
    color: #64748b;
    margin-bottom: 1.25rem;
    font-style: normal;
}

.tp-login-page--auth .tp-login-submit {
    background: #334155;
    border-color: #334155;
}

.tp-login-page--auth .tp-login-submit:hover {
    background: #1e293b;
    border-color: #1e293b;
}

.tp-login-page--auth .tp-login-backlink a {
    color: #475569;
    font-style: normal;
}

.tp-login-page--auth .tp-login-backlink a:hover {
    color: #0f172a;
    text-decoration: underline !important;
}

/* حقول الإدخال في واجهة المعلم: النص والكتابة لليمين */
.tp-body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]),
.tp-body textarea,
.tp-body select,
.tp-login-page--auth input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]),
.tp-login-page--auth textarea,
.tp-login-page--auth select {
    direction: rtl;
    text-align: right;
}

.tp-body input::placeholder,
.tp-body textarea::placeholder,
.tp-login-page--auth input::placeholder,
.tp-login-page--auth textarea::placeholder {
    text-align: right;
    direction: rtl;
}

@media (min-width: 768px) {
    .tp-main {
        max-width: 720px;
    }
}

.tp-back-link {
    display: inline-block;
    font-size: 0.85rem;
    color: #64748b;
    text-decoration: none;
    margin-bottom: 0.5rem;
}

/* ——— بطاقات الحلقات (صفحة رئيسية للمعلم) ——— */
.tp-halaqa-showcase {
    display: grid;
    gap: 1rem;
}

@media (min-width: 540px) {
    .tp-halaqa-showcase {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.tp-halaqa-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 168px;
    padding: 1.15rem 1.2rem 1rem;
    border-radius: 1.15rem;
    text-decoration: none;
    color: #fff;
    overflow: hidden;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.14);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.tp-halaqa-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 44px rgba(15, 23, 42, 0.18);
    color: #fff;
}

.tp-halaqa-tile__glow {
    position: absolute;
    inset: -30% auto auto -20%;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    filter: blur(2px);
    pointer-events: none;
}

.tp-halaqa-tile__icon-wrap {
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    font-size: 1.35rem;
}

.tp-halaqa-tile__body {
    flex: 1;
}

.tp-halaqa-tile__title {
    margin: 0 0 0.2rem;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.35;
    color: #fff;
}

.tp-halaqa-tile__subtitle {
    margin: 0 0 0.65rem;
    font-size: 0.78rem;
    opacity: 0.88;
}

.tp-halaqa-tile__count {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    font-size: 0.82rem;
    font-weight: 600;
}

.tp-halaqa-tile__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
    font-weight: 700;
    opacity: 0.95;
}

.tp-halaqa-tile--emerald {
    background: linear-gradient(145deg, #059669 0%, #047857 55%, #065f46 100%);
}

.tp-halaqa-tile--indigo {
    background: linear-gradient(145deg, #4f46e5 0%, #4338ca 55%, #3730a3 100%);
}

.tp-halaqa-tile--amber {
    background: linear-gradient(145deg, #d97706 0%, #b45309 55%, #92400e 100%);
}

.tp-halaqa-tile--rose {
    background: linear-gradient(145deg, #e11d48 0%, #be123c 55%, #9f1239 100%);
}

.tp-halaqa-tile--sky {
    background: linear-gradient(145deg, #0284c7 0%, #0369a1 55%, #075985 100%);
}

.tp-halaqa-tile--violet {
    background: linear-gradient(145deg, #7c3aed 0%, #6d28d9 55%, #5b21b6 100%);
}

/* ——— قائمة الطلاب ——— */
.tp-search-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: stretch;
}

.tp-search-field {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem 0.45rem 0.75rem;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tp-search-field:focus-within {
    border-color: #64748b;
    box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.15);
}

.tp-search-field__icon {
    color: #94a3b8;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.tp-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    padding: 0.35rem 0;
    font-family: inherit;
    font-size: 0.95rem;
    color: #0f172a;
    border-radius: 0;
}

.tp-search-input::placeholder {
    color: #94a3b8;
}

.tp-search-field__clear {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 10px;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tp-search-field__clear:hover {
    background: #e2e8f0;
    color: #334155;
}

.tp-search-qr-btn {
    flex-shrink: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-width: 4.25rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid #0f766e;
    border-radius: 10px;
    background: linear-gradient(180deg, #14b8a6 0%, #0d9488 100%);
    color: #fff;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.25);
}

.tp-search-qr-btn i {
    font-size: 1.15rem;
}

.tp-search-qr-btn:hover {
    filter: brightness(1.05);
}

.tp-search-empty {
    margin-top: 0.5rem;
}

.tp-qr-modal[hidden] {
    display: none !important;
}

.tp-qr-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.tp-qr-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.tp-qr-modal__panel {
    position: relative;
    width: min(420px, 100%);
    max-height: calc(100vh - 2rem);
    overflow: auto;
    background: #fff;
    border-radius: 10px;
    padding: 1rem 1rem 1.15rem;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.tp-qr-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.tp-qr-modal__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

.tp-qr-modal__close {
    border: none;
    background: #f1f5f9;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
}

.tp-qr-modal__hint {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: #64748b;
}

.tp-qr-reader {
    border-radius: 10px;
    overflow: hidden;
    background: #0f172a;
    min-height: 280px;
}

.tp-qr-reader video {
    border-radius: 10px;
}

.tp-search-bar {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tp-search-btn,
.tp-search-clear {
    border-radius: 10px;
    padding: 0.55rem 0.85rem;
    border: 1px solid #cbd5e1;
    background: #fff;
    text-decoration: none;
    color: #334155;
    font-size: 0.9rem;
}

.tp-search-btn {
    background: #334155;
    color: #fff;
    border-color: #334155;
}

.tp-card-top {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    margin-bottom: 0.35rem;
}

.tp-status-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: flex-start;
}

.tp-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
}

.tp-card--status.tds-progress { border-inline-start: 4px solid #16a34a; }
.tp-card--status.tds-review { border-inline-start: 4px solid #0891b2; }
.tp-card--status.tds-absent { border-inline-start: 4px solid #dc2626; }
.tp-card--status.tds-late { border-inline-start: 4px solid #ea580c; }
.tp-card--status.tds-excused { border-inline-start: 4px solid #64748b; }
.tp-card--status.tds-alert { border-inline-start: 4px solid #ca8a04; }
.tp-card--status.tds-present { border-inline-start: 4px solid #2563eb; }

.tp-status-badge.tds-progress { background: #dcfce7; color: #166534; }
.tp-status-badge.tds-review { background: #cffafe; color: #155e75; }
.tp-status-badge.tds-absent { background: #fee2e2; color: #991b1b; }
.tp-status-badge.tds-late { background: #ffedd5; color: #9a3412; }
.tp-status-badge.tds-excused { background: #f1f5f9; color: #475569; }
.tp-status-badge.tds-alert { background: #fef9c3; color: #854d0e; }
.tp-status-badge.tds-present { background: #dbeafe; color: #1d4ed8; }
