/* Tasclass v0.3.0 - Teacher interface (mobile-first, RTL) */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body.tchr-body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    direction: rtl;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.tchr-shell {
    max-width: 720px;
    margin: 0 auto 0;
    min-height: 100vh;
    background: #f9fafb;
    border-radius: 0.9rem;
    box-shadow: 0 18px 40px rgba(15,23,42,0.12);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header + Hamburger */
.tchr-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #fff;
}

.tchr-header-inner {
    margin: 0;
    padding: 0.75rem 1rem 0.75rem;
}

.tchr-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 52px;
}

.tchr-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
}
.tchr-hamburger:hover { background: rgba(255,255,255,0.1); }
.tchr-hamburger span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.2s;
}
.tchr-hamburger.is-open span:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}
.tchr-hamburger.is-open span:nth-child(2) {
    opacity: 0;
}
.tchr-hamburger.is-open span:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

.tchr-logo {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
}
.tchr-logo-icon { font-size: 1.3rem; }
.tchr-version {
    font-size: 0.7rem;
    opacity: 0.8;
    font-weight: 400;
}

.tchr-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.tchr-avatar-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
.tchr-avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tchr-avatar-initials {
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
}

.tchr-avatar-btn::after {
    content: "";
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #ffffff;
    border: 2px solid #020617;
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23020617' d='M12 8.5A3.5 3.5 0 1 0 15.5 12 3.5 3.5 0 0 0 12 8.5Zm0-6.5a1 1 0 0 1 1 .84l.25 1.43a6.7 6.7 0 0 1 1.12.65l1.4-.51a1 1 0 0 1 1.18.46l1.5 2.6a1 1 0 0 1-.2 1.21l-1.1 1a5.7 5.7 0 0 1 0 1.3l1.1 1a1 1 0 0 1 .2 1.21l-1.5 2.6a1 1 0 0 1-1.18.46l-1.4-.51a6.7 6.7 0 0 1-1.12.65L13 21.66a1 1 0 0 1-1 .84H12a1 1 0 0 1-1-.84l-.25-1.43a6.7 6.7 0 0 1-1.12-.65l-1.4.51a1 1 0 0 1-1.18-.46l-1.5-2.6a1 1 0 0 1 .2-1.21l1.1-1a5.7 5.7 0 0 1 0-1.3l-1.1-1a1 1 0 0 1-.2-1.21l1.5-2.6a1 1 0 0 1 1.18-.46l1.4.51a6.7 6.7 0 0 1 1.12-.65L11 2.84A1 1 0 0 1 12 2Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 12px;
}

.tchr-greeting-text {
    color: #f9fafb;
    font-size: 0.88rem;
    font-weight: 400;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .tchr-logo-text {
        display: none;
    }
    .tchr-version {
        display: none;
    }
}

.tchr-nav-version {
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    font-size: 0.75rem;
    color: rgba(209,213,219,0.9);
    border-top: 1px solid rgba(55,65,81,0.8);
}

@media (min-width: 768px) {
    .tchr-nav-version {
        display: none;
    }
}

.tchr-account-menu {
    position: absolute;
    top: 115%;
    inset-inline-end: 0;
    background: #0b1120;
    color: #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.6rem;
    min-width: 170px;
    box-shadow: 0 10px 30px rgba(15,23,42,0.6);
    display: none;
    z-index: 120;
}
.tchr-account-menu.is-open {
    display: block;
}
.tchr-account-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    padding: 0.4rem 0.5rem 0.5rem;
    border-bottom: 1px solid rgba(148,163,184,0.35);
    margin-bottom: 0.35rem;
}
.tchr-account-greeting {
    font-size: 0.9rem;
    font-weight: 600;
}
.tchr-account-email {
    font-size: 0.8rem;
    color: #9ca3af;
}

.tchr-account-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.55rem;
    border-radius: 0.55rem;
    font-size: 0.9rem;
    text-decoration: none;
    color: inherit;
}
.tchr-account-item:hover {
    background: rgba(148,163,184,0.2);
}
.tchr-account-item-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tchr-account-item-icon svg {
    width: 100%;
    height: 100%;
}
.tchr-account-logout-form {
    margin: 0;
}
.tchr-account-logout-form button {
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    text-align: right;
    cursor: pointer;
}


/* Nav (collapsed by default on mobile) */
.tchr-nav {
    display: none;
    flex-direction: column;
    padding: 0 1rem 1rem;
    gap: 0.25rem;
}
.tchr-nav.is-open {
    display: flex;
}
.tchr-nav-link {
    display: block;
    padding: 0.65rem 0.75rem;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.95rem;
    -webkit-tap-highlight-color: transparent;
}
.tchr-nav-link:hover,
.tchr-nav-link.is-active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}
.tchr-logout-form { margin: 0; }
.tchr-nav-logout {
    width: 100%;
    text-align: right;
    border: none;
    background: transparent;
    font: inherit;
    cursor: pointer;
    color: rgba(255,255,255,0.8);
}
.tchr-nav-logout:hover { color: #fff; }

@media (min-width: 768px) {
    .tchr-hamburger { display: none; }
    .tchr-nav {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0 0 0.75rem;
    }
    .tchr-nav-link { padding: 0.4rem 0.75rem; }
}

/* Main */
.tchr-main {
    flex: 1;
    padding: 1rem 1rem 1rem;
}

/* Auth */
.tchr-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
}
.tchr-auth-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(15,23,42,0.1);
}
.tchr-auth-title {
    margin: 0 0 0.25rem;
    font-size: 1.35rem;
}
.tchr-auth-subtitle {
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
    color: #64748b;
}
.tchr-auth-footer {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.85rem;
}
.tchr-auth-footer a { color: #3b82f6; }

/* Form */
.tchr-form { display: flex; flex-direction: column; gap: 0.9rem; }
.tchr-field { display: flex; flex-direction: column; gap: 0.25rem; }
.tchr-field-label { font-size: 0.9rem; color: #475569; }
.tchr-input {
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 0.65rem 0.75rem;
    font-size: 1rem;
    min-height: 44px;
}
.tchr-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}
.tchr-input-readonly {
    background: #f8fafc;
    color: #64748b;
}
.tchr-auth-actions { margin-top: 0.5rem; }

/* Buttons */
.tchr-btn {
    border-radius: 10px;
    border: none;
    padding: 0.65rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}
.tchr-btn-block { width: 100%; }
.tchr-btn-primary {
    background: #3b82f6;
    color: #fff;
}
.tchr-btn-primary:hover { background: #2563eb; }
.tchr-btn-secondary {
    background: #64748b;
    color: #fff;
}
.tchr-btn-secondary:hover { background: #475569; }

/* Panel */
.tchr-panel {
    background: #fff;
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.tchr-panel-title {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
}

.tchr-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.tchr-title-row h1 {
    margin: 0;
}

.tchr-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid #d1d5db;
    background: #f9fafb;
    color: #6b7280;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.tchr-refresh-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #374151;
}

.tchr-refresh-btn:active {
    transform: scale(0.9);
}

.tchr-refresh-btn .tchr-refresh-icon {
    transition: transform 0.5s ease;
}

@keyframes tchr-spin {
    to { transform: rotate(360deg); }
}

.tchr-refresh-btn.is-refreshing .tchr-refresh-icon {
    animation: tchr-spin 0.7s linear infinite;
}

.tchr-refresh-btn.is-refreshing {
    pointer-events: none;
    opacity: 0.6;
}
.tchr-panel-subtitle {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: #64748b;
}

/* Alerts */
.tchr-alert {
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.tchr-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}
.tchr-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

/* Empty state */
.tchr-empty {
    text-align: center;
    padding: 2rem 1rem;
}
.tchr-empty-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}
.tchr-empty h2 { margin: 0 0 0.25rem; font-size: 1.1rem; }
.tchr-empty p { margin: 0; color: #64748b; }

/* Task cards */
.tchr-task-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.tchr-task-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.tchr-task-card.tchr-task-overdue {
    border-color: #fca5a5;
    background: #fef2f2;
}
.tchr-task-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}
.tchr-task-event, .tchr-task-desc {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: #64748b;
}
.tchr-task-event { text-decoration: none; color: #3b82f6; }
.tchr-task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.35rem;
}
.tchr-tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    background: #e2e8f0;
    color: #475569;
}
.tchr-tag-warning {
    background: #fef3c7;
    color: #b45309;
}
.tchr-tag-status { font-weight: 500; }
.tchr-status-pending { background: #fef9c3; color: #854d0e; }
.tchr-status-in_progress { background: #dbeafe; color: #1d4ed8; }
.tchr-status-done { background: #dcfce7; color: #15803d; }

.tchr-task-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.tchr-status-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    min-height: 40px;
    -webkit-tap-highlight-color: transparent;
}
.tchr-status-in_progress {
    background: #3b82f6;
    color: #fff;
}
.tchr-status-done {
    background: #22c55e;
    color: #fff;
}
.tchr-status-btn:hover { opacity: 0.9; }

.tchr-dashboard-actions {
    margin-top: 1.5rem;
}

/* Task notes */
.tchr-task-note-row {
    margin-top: 0.5rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.4rem;
}
.tchr-note-input {
    flex: 1;
    min-height: 36px;
    resize: vertical;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    font-family: inherit;
}
.tchr-note-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px rgba(59,130,246,0.3);
}
.tchr-note-save {
    border-radius: 999px;
    border: none;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    background: #e5e7eb;
    color: #111827;
}
.tchr-note-save:hover {
    background: #d4d4d8;
}

.tchr-note-notify-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: #6b7280;
}
.tchr-note-notify-wrap input {
    margin: 0;
}

.tchr-note-history {
    list-style: none;
    padding: 0;
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    color: #4b5563;
}
.tchr-note-history li + li {
    margin-top: 0.15rem;
}
.tchr-note-time {
    color: #9ca3af;
    margin-left: 0.35rem;
}
.tchr-note-text {
    white-space: pre-wrap;
}

/* Event tabs on dashboard */
.tchr-event-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}
.tchr-event-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    font-size: 0.8rem;
    color: #334155;
    text-decoration: none;
    white-space: nowrap;
}
.tchr-event-tab-count {
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #e5e7eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}
.tchr-event-tab.is-active {
    background: #3b82f6;
    border-color: #2563eb;
    color: #f9fafb;
}
.tchr-event-tab.is-active .tchr-event-tab-count {
    background: rgba(15,23,42,0.2);
    color: #e5e7eb;
}

/* Event status summary in event view */
.tchr-status-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.tchr-status-filters .tchr-status-filter {
    cursor: pointer;
    border: 1px solid transparent;
    opacity: 0.5;
}
.tchr-status-filters .tchr-status-filter.is-active {
    border-color: rgba(15,23,42,0.4);
    box-shadow: 0 0 0 1px rgba(15,23,42,0.1);
    opacity: 1;
}

.tchr-link-inline {
    font-size: 0.85rem;
    color: #3b82f6;
    text-decoration: none;
    margin-right: 0.25rem;
}
.tchr-link-inline:hover {
    text-decoration: underline;
}

.tchr-footer {
    border-top: 1px solid #cbd5e1;
    background: #d1d5db;
    padding: 0.75rem 0;
    margin-top: 0;
}
.tchr-footer-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1rem;
    font-size: 0.8rem;
    color: #6b7280;
    text-align: right;
}

/* Events grid */
.tchr-events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}
.tchr-event-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.tchr-event-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.tchr-event-hero {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.25rem;
}
.tchr-event-hero-icon { font-size: 2rem; }
.tchr-event-hero-label { font-size: 0.75rem; color: rgba(0,0,0,0.6); }
.tchr-event-body { padding: 0.75rem; }
.tchr-event-title {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    font-weight: 600;
}
.tchr-event-meta {
    font-size: 0.8rem;
    color: #64748b;
}

/* Event single view */
.tchr-back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.9rem;
}
.tchr-event-view .tchr-event-header {
    border-radius: 12px;
    padding: 1.5rem;
    margin: 0 0 1rem;
    color: #1e293b;
}
.tchr-event-hero-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.tchr-event-hero-big { font-size: 2.5rem; }
.tchr-event-title-main {
    margin: 0 0 0.35rem;
    font-size: 1.25rem;
}
.tchr-event-meta-row {
    font-size: 0.9rem;
    opacity: 0.9;
}
.tchr-event-desc {
    margin-bottom: 1.25rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e2e8f0;
}
.tchr-section-title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

/* Profile */
.tchr-profile-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.tchr-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 1.5rem;
}
.tchr-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tchr-avatar-upload input { display: none; }
.tchr-profile-actions { margin-top: 1rem; }

/* Toast */
.tchr-toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: 320px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    background: #1e293b;
    color: #fff;
    border-radius: 10px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 200;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}
.tchr-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.tchr-toast.is-error { background: #b91c1c; }
