/* MajidTek Team — shared look for ClientWeb and AdminWeb.
   Teams-flavoured: violet accent, soft grey workspace, white cards. */

:root {
    --mt-primary: #5B5FC7;
    --mt-primary-dark: #4F52B2;
    --mt-primary-soft: #E8E9FA;
    --mt-bg: #F0F0F0;
    --mt-rail: #E4E4E7;
    --mt-sidebar: #EBEBEF;
    --mt-border: #E0E0E0;
    --mt-text: #242424;
    --mt-text-dim: #616161;
    --mt-online: #13A10E;
    --mt-offline: #B5B5B5;
}

html, body { height: 100%; margin: 0; background: var(--mt-bg); }

/* ---------- Full-page loader ---------- */
.mt-loader-page {
    position: fixed; inset: 0; z-index: 2000;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 18px; background: linear-gradient(160deg, #5B5FC7 0%, #7B83EB 55%, #9EA2F0 100%);
}
.mt-loader-logo { width: 84px; height: 84px; filter: drop-shadow(0 8px 22px rgba(0,0,0,.25)); animation: mt-bob 2.2s ease-in-out infinite; }
@keyframes mt-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.mt-loader-bar { width: 160px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.3); overflow: hidden; }
.mt-loader-bar i { display: block; height: 100%; width: 40%; border-radius: 2px; background: #fff; animation: mt-slide 1.2s ease-in-out infinite; }
@keyframes mt-slide { 0% { margin-inline-start: -40%; } 100% { margin-inline-start: 100%; } }
.mt-loader-label { color: #fff; font-size: 14px; opacity: .9; }

/* ---------- Login ---------- */
.mt-login-bg {
    min-height: 100vh;
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(255,255,255,.18), transparent 60%),
        radial-gradient(700px 500px at -10% 110%, rgba(0,0,0,.18), transparent 60%),
        linear-gradient(160deg, #464775 0%, #5B5FC7 55%, #7B83EB 100%);
}
.mt-login-card { backdrop-filter: blur(4px); }
.mt-login-logo { width: 64px; height: 64px; }
.mt-login-tabs {
    display: flex; background: var(--mt-bg); border-radius: 10px; padding: 4px; gap: 4px;
}
.mt-login-tabs button {
    flex: 1; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px;
    font: inherit; font-weight: 600; color: var(--mt-text-dim); cursor: pointer;
}
.mt-login-tabs button.on { background: #fff; color: var(--mt-primary); box-shadow: 0 1px 4px rgba(0,0,0,.12); }

/* ---------- App shell ---------- */
.mt-shell { display: flex; height: 100vh; overflow: hidden; }

.mt-rail {
    width: 68px; flex: 0 0 68px; background: var(--mt-rail);
    display: flex; flex-direction: column; align-items: center;
    padding: 10px 0; gap: 4px; border-inline-end: 1px solid var(--mt-border);
}
.mt-rail-logo { width: 40px; height: 40px; margin-bottom: 10px; }
.mt-rail-btn {
    width: 58px; padding: 8px 0 6px; border: 0; background: transparent; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    border-radius: 8px; color: var(--mt-text-dim); font-size: 10.5px; font-family: inherit;
    position: relative;
}
.mt-rail-btn:hover { color: var(--mt-primary); }
.mt-rail-btn.on { color: var(--mt-primary); background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.10); }
.mt-rail-btn.on::before {
    content: ""; position: absolute; inset-inline-start: -5px; top: 25%; height: 50%;
    width: 3px; border-radius: 2px; background: var(--mt-primary);
}
.mt-rail-spacer { flex: 1; }

.mt-sidebar {
    width: 288px; flex: 0 0 288px; background: var(--mt-sidebar);
    border-inline-end: 1px solid var(--mt-border);
    display: flex; flex-direction: column; overflow: hidden;
}
.mt-sidebar-head {
    padding: 14px 16px 10px; display: flex; align-items: center; gap: 8px;
}
.mt-sidebar-head h2 { margin: 0; font-size: 18px; flex: 1; }
.mt-sidebar-scroll { flex: 1; overflow-y: auto; padding-bottom: 16px; }

.mt-team-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 14px; border: 0; background: transparent; cursor: pointer;
    font: inherit; font-weight: 600; color: var(--mt-text); text-align: start;
}
.mt-team-item:hover { background: rgba(0,0,0,.05); }
.mt-team-emoji {
    width: 32px; height: 32px; border-radius: 8px; background: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 17px;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.mt-team-caret { margin-inline-start: auto; opacity: .6; transition: transform .15s; }
.mt-team-caret.open { transform: rotate(90deg); }

.mt-channel-item {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 6px 14px 6px 56px; border: 0; background: transparent; cursor: pointer;
    font: inherit; font-size: 14px; color: var(--mt-text-dim); text-align: start;
}
[dir="rtl"] .mt-channel-item { padding: 6px 56px 6px 14px; }
.mt-channel-item:hover { color: var(--mt-text); background: rgba(0,0,0,.05); }
.mt-channel-item.on { color: var(--mt-primary); font-weight: 700; background: #fff; }

.mt-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--mt-bg); }
.mt-channel-head {
    background: #fff; border-bottom: 1px solid var(--mt-border);
    padding: 10px 20px; display: flex; align-items: center; gap: 12px; min-height: 56px;
}
.mt-channel-head .title { font-weight: 700; font-size: 16px; }
.mt-channel-head .sub { color: var(--mt-text-dim); font-size: 12.5px; }

.mt-posts { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 12px; }

.mt-post-card {
    background: #fff; border-radius: 10px; padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
    max-width: 860px; width: 100%; margin: 0 auto; position: relative;
}
.mt-post-card .mt-post-actions { position: absolute; top: 8px; inset-inline-end: 10px; opacity: 0; transition: opacity .12s; display: flex; gap: 2px; }
.mt-post-card:hover .mt-post-actions { opacity: 1; }
.mt-post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.mt-post-name { font-weight: 700; font-size: 14px; }
.mt-post-meta { color: var(--mt-text-dim); font-size: 12px; }
.mt-post-text { font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.mt-post-text.deleted { color: var(--mt-text-dim); font-style: italic; }

.mt-reactions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mt-reaction-chip {
    border: 1px solid var(--mt-border); background: var(--mt-bg); border-radius: 999px;
    padding: 2px 9px; font-size: 13px; cursor: pointer; display: inline-flex; gap: 5px; align-items: center;
    font-family: inherit;
}
.mt-reaction-chip:hover { border-color: var(--mt-primary); }
.mt-reaction-chip.mine { background: var(--mt-primary-soft); border-color: var(--mt-primary); color: var(--mt-primary-dark); font-weight: 600; }

.mt-reply-link {
    margin-top: 8px; border: 0; background: transparent; color: var(--mt-primary);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 0;
    display: inline-flex; align-items: center; gap: 6px;
}
.mt-reply-link:hover { text-decoration: underline; }

.mt-composer { padding: 12px 22px 18px; }
.mt-composer-inner {
    max-width: 860px; margin: 0 auto; background: #fff; border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07); padding: 8px 12px;
    display: flex; align-items: flex-end; gap: 8px;
}
.mt-composer textarea, .mt-composer-input {
    flex: 1; border: 0; outline: none; resize: none; font: inherit; font-size: 14.5px;
    line-height: 1.45; max-height: 140px; padding: 8px 4px; background: transparent;
}

/* ---------- Thread pane ---------- */
.mt-thread-pane {
    width: 400px; flex: 0 0 400px; background: #fff; border-inline-start: 1px solid var(--mt-border);
    display: flex; flex-direction: column; min-width: 0;
}
.mt-thread-head {
    padding: 12px 16px; border-bottom: 1px solid var(--mt-border);
    display: flex; align-items: center; gap: 8px; font-weight: 700;
}
.mt-thread-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.mt-thread-body .mt-post-card { box-shadow: none; border: 1px solid var(--mt-border); padding: 10px 12px; }
.mt-thread-composer { padding: 10px 14px 14px; border-top: 1px solid var(--mt-border); }
.mt-thread-composer .mt-composer-inner { box-shadow: none; border: 1px solid var(--mt-border); padding: 4px 8px; }

@media (max-width: 1100px) {
    .mt-thread-pane { position: fixed; inset-inline-end: 0; top: 0; bottom: 0; z-index: 40; box-shadow: -8px 0 24px rgba(0,0,0,.18); }
}
@media (max-width: 800px) {
    .mt-sidebar { width: 232px; flex-basis: 232px; }
    .mt-rail-btn span.lbl { display: none; }
}

/* ---------- Avatars & presence ---------- */
.mt-avatar-wrap { position: relative; flex: 0 0 auto; }
.mt-avatar {
    width: 100%; height: 100%; border-radius: 50%; color: #fff; font-weight: 700;
    display: flex; align-items: center; justify-content: center; user-select: none;
}
.mt-avatar-emoji { background: #fff; box-shadow: inset 0 0 0 1px var(--mt-border); }
.mt-presence {
    position: absolute; bottom: -1px; inset-inline-end: -1px; width: 11px; height: 11px;
    border-radius: 50%; border: 2px solid #fff;
}
.mt-presence.on { background: var(--mt-online); }
.mt-presence.off { background: var(--mt-offline); }

/* ---------- Admin ---------- */
.mt-stat-card { border: 1px solid var(--mt-border); }
.mt-stat-emoji { font-size: 30px; }

.mt-bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.mt-bars .bar { flex: 1; background: var(--mt-primary-soft); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; }
.mt-bars .bar i { position: absolute; inset: auto 0 0 0; background: var(--mt-primary); border-radius: 4px 4px 0 0; display: block; }
.mt-bars .bar .cap { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--mt-text-dim); }

/* ---------- Meetings ---------- */
.mt-meeting {
    position: fixed; inset: 0; z-index: 1250;
    background: #1F1F1F; display: flex; flex-direction: column;
}
.mt-meeting-head {
    color: #fff; padding: 12px 20px; display: flex; align-items: center; gap: 10px;
}
.mt-meeting-head .title { font-weight: 700; font-size: 15px; }
.mt-meeting-head .count { font-size: 14px; opacity: .85; }
.mt-live { color: #FF6A6A; font-weight: 700; font-size: 12px; letter-spacing: .3px; }
.mt-meeting-note { color: #FFD27D; text-align: center; font-size: 13px; padding: 2px 16px 6px; }
.mt-meeting-grid {
    flex: 1; min-height: 0; display: grid; gap: 10px; padding: 0 20px 10px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-content: center;
}
.mt-tile {
    position: relative; background: #2B2B30; border-radius: 12px; overflow: hidden;
    aspect-ratio: 16 / 10; max-height: 100%;
    display: flex; align-items: center; justify-content: center;
}
.mt-tile .ph {
    /* Sits UNDER the (transparent-until-playing) video: shows whenever there is no frame. */
    position: absolute; width: 76px; height: 76px; border-radius: 50%;
    background: var(--mt-primary); color: #fff; font-size: 34px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.mt-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mt-tile .st {
    position: absolute; top: 8px; inset-inline-start: 10px; z-index: 2;
    color: #fff; font-size: 12px; background: rgba(0,0,0,.55); padding: 2px 9px; border-radius: 6px;
}
.mt-tile .st.bad { background: #D13438; }
.mt-tile .name {
    position: absolute; bottom: 8px; inset-inline-start: 10px; z-index: 2;
    color: #fff; font-size: 12.5px; background: rgba(0,0,0,.5); padding: 2px 9px; border-radius: 6px;
    max-width: calc(100% - 30px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mt-meeting-controls { display: flex; justify-content: center; gap: 14px; padding: 14px 0 20px; }
.mt-ctl {
    width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
    background: #3A3A40; color: #fff; display: flex; align-items: center; justify-content: center;
}
.mt-ctl:hover { background: #4A4A52; }
.mt-ctl.off { background: #fff; color: #1F1F1F; }
.mt-ctl.end { background: #D13438; }
.mt-ctl.end:hover { background: #B02A2E; }

/* ---------- Mobile (phones) ---------- */
/* Desktop: rail + sidebar side by side. Mobile: rail becomes a bottom tab bar and
   the sidebar becomes a slide-in drawer opened from the channel header. */
.mt-only-mobile { display: none; }
.mt-backdrop {
    position: fixed; inset: 0; z-index: 105; border: 0; padding: 0;
    background: rgba(0,0,0,.35); display: none;
}

@media (max-width: 700px) {
    .mt-shell { padding-bottom: 56px; }

    .mt-rail {
        position: fixed; bottom: 0; top: auto; inset-inline: 0; z-index: 120;
        width: auto; height: 56px; flex-direction: row; align-items: center;
        padding: 0 14px; gap: 12px;
        border-inline-end: none; border-top: 1px solid var(--mt-border);
    }
    .mt-rail-logo { display: none; }
    .mt-rail-btn { width: auto; padding: 5px 14px 3px; }
    .mt-rail-btn.on::before { content: none; }

    .mt-sidebar {
        position: fixed; top: 0; bottom: 56px; inset-inline-start: 0; z-index: 110;
        width: min(86vw, 320px); flex-basis: auto;
        transform: translateX(-105%); transition: transform .2s ease;
        box-shadow: 8px 0 24px rgba(0,0,0,.25);
    }
    [dir="rtl"] .mt-sidebar { transform: translateX(105%); }
    .mt-sidebar.open { transform: none; }
    .mt-backdrop { display: block; }
    .mt-only-mobile { display: inline-flex; }

    .mt-burger {
        border: 0; background: transparent; cursor: pointer; padding: 6px;
        color: var(--mt-text); align-items: center;
    }

    .mt-channel-head { padding: 8px 10px; gap: 8px; min-height: 52px; flex-wrap: wrap; }
    .mt-channel-head .sub { display: none; }
    .mt-posts { padding: 12px 10px; }
    .mt-composer { padding: 8px 10px 12px; }

    .mt-thread-pane { width: 100vw; flex-basis: 100vw; bottom: 56px; }

    .mt-meeting-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); padding: 0 10px 8px; }
    .mt-meeting-head { padding: 10px 12px; }
}

/* Scrollbars, subtle like Teams */
* { scrollbar-width: thin; scrollbar-color: #c9c9c9 transparent; }
