/* =========================================================
   NANES — COMPONENTS
   11 — CARDS
   12 — GRIDS
   13 — STAT CARDS
   14 — BUTTONS
   15 — FORMS
   16 — TABLES
   17 — BADGES
   18 — RANKINGS
   19 — MEMBER ROW
   20 — EMPTY STATES
   21 — CHAT
   22 — TEAM CARDS
   23 — MODAL
   24 — TOAST
   25 — LOADING
   26 — ICON
   ========================================================= */


/* =========================================================
   CARDS
   ========================================================= */

.card {

    position: relative;

    padding: 20px;

    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.045),
            rgba(255, 255, 255, 0.015)
        );

    background-color:
        rgba(18, 24, 38, 0.65);

    border:
        1px solid var(--border);

    border-radius:
        var(--radius-lg);

    box-shadow:
        var(--shadow-sm);

    backdrop-filter:
        blur(18px);

    transition:
        transform var(--transition-normal),
        border-color var(--transition-normal),
        box-shadow var(--transition-normal);
}


[data-theme="light"] .card {

    background:
        rgba(255, 255, 255, 0.82);
}


.card:hover {

    border-color:
        rgba(185, 154, 98, 0.16);

    box-shadow:
        var(--shadow-md);
}


.card-glow:hover {

    box-shadow:
        var(--shadow-md),
        var(--glow-primary);
}


.card-title {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 15px;

    margin-bottom: 16px;
}


.card-title h3 {
    font-size: 16px;
}


.card-title p {

    color:
        var(--text-muted);

    font-size: 12px;

    margin-top: 3px;
}


/* =========================================================
   GRIDS
   ========================================================= */

.grid {

    display: grid;

    gap: 18px;
}


.grid-2 {

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );
}


.grid-3 {

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );
}


.grid-4 {

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );
}


.overview-stats-grid {

    display: grid;

    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 18px;
}


.grid-fit {

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(220px, 1fr)
        );
}


.grid-fit-sm {

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(160px, 1fr)
        );
}


/* =========================================================
   STAT CARDS
   ========================================================= */

.stat-card {

    position: relative;

    overflow: hidden;

    padding: 20px;

    border:
        1px solid var(--border);

    border-radius:
        var(--radius-lg);

    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, .045),
            rgba(255, 255, 255, .015)
        );

    transition:
        transform var(--transition-normal),
        box-shadow var(--transition-normal);
}


.stat-card::before {

    content: "";

    position: absolute;

    width: 130px;
    height: 130px;

    border-radius: 50%;

    top: -70px;
    left: -70px;

    background:
        var(--primary);

    opacity: 0.06;

    filter: blur(15px);
}


.stat-card:hover {

    transform:
        translateY(-4px);

    box-shadow:
        var(--shadow-md);
}


.stat-icon {

    width: 40px;
    height: 40px;

    display: grid;

    place-items: center;

    border-radius: 12px;

    color:
        var(--primary-light);

    background:
        rgba(185, 154, 98, 0.09);

    margin-bottom: 14px;
}


.stat-value {

    font-size: 30px;

    font-weight: 900;

    letter-spacing: -1px;
}


.stat-label {

    color:
        var(--text-secondary);

    font-size: 13px;

    margin-top: 3px;
}


.stat-sub {

    color:
        var(--text-muted);

    font-size: 11px;

    margin-top: 7px;
}


/* =========================================================
   BUTTONS
   ========================================================= */

.btn {

    min-height: 42px;

    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 8px;

    padding:
        9px 15px;

    border-radius:
        11px;

    border:
        1px solid transparent;

    font-size: 13px;

    font-weight: 700;

    white-space: nowrap;

    transition:
        transform var(--transition-fast),
        background var(--transition-fast),
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}


.btn:hover {
    transform: translateY(-2px);
}


.btn:active {

    transform:
        translateY(0)
        scale(.98);
}


.btn-primary {

    color: #15120c;

    background:
        var(--gradient-primary);

    box-shadow:
        0 8px 22px
        rgba(185, 154, 98, 0.16);
}


.btn-primary:hover {

    box-shadow:
        0 12px 30px
        rgba(185, 154, 98, 0.24);
}


.btn-ghost {

    color:
        var(--text-secondary);

    background:
        var(--surface-light);

    border:
        1px solid var(--border);
}


.btn-ghost:hover {

    color:
        var(--text);

    border-color:
        var(--border-strong);

    background:
        rgba(255,255,255,.07);
}


.btn-danger {

    color: #fecaca;

    background:
        rgba(239, 68, 68, 0.08);

    border:
        1px solid
        rgba(239, 68, 68, 0.16);
}


.btn-danger:hover {

    background:
        rgba(239, 68, 68, 0.15);
}


.btn-success {

    color: #bbf7d0;

    background:
        rgba(34, 197, 94, 0.08);

    border:
        1px solid
        rgba(34, 197, 94, 0.16);
}


.btn-icon {

    width: 40px;
    height: 40px;

    padding: 0;
}


/* =========================================================
   FORMS
   ========================================================= */

.form-card {

    max-width: 720px;

    margin: 0 auto;

    padding: 25px;
}


.field {

    display: flex;

    flex-direction: column;

    gap: 7px;
}


.field label {

    color:
        var(--text-secondary);

    font-size: 12px;

    font-weight: 700;
}


.input,
select,
textarea {

    width: 100%;

    min-height: 43px;

    padding:
        9px 12px;

    color:
        var(--text);

    background:
        rgba(8, 11, 18, 0.65);

    border:
        1px solid var(--border);

    border-radius:
        10px;

    outline: none;

    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background var(--transition-fast);
}


[data-theme="light"] .input,
[data-theme="light"] select,
[data-theme="light"] textarea {

    background:
        rgba(255,255,255,.85);
}


.input:focus,
select:focus,
textarea:focus {

    border-color:
        rgba(185, 154, 98, 0.55);

    box-shadow:
        0 0 0 3px
        rgba(185, 154, 98, 0.08);
}


textarea {

    resize: vertical;

    min-height: 110px;
}


select option {

    background:
        var(--surface-solid);

    color:
        var(--text);
}


.form-grid {

    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 16px;
}


.form-grid-full {
    grid-column: 1 / -1;
}


/* =========================================================
   TABLES
   ========================================================= */

.table-wrap {

    width: 100%;

    overflow-x: auto;

    border:
        1px solid var(--border);

    border-radius:
        var(--radius-lg);

    background:
        rgba(255,255,255,.015);
}


table {

    width: 100%;

    border-collapse: collapse;

    min-width: 650px;
}


th,
td {

    padding:
        14px 15px;

    border-bottom:
        1px solid var(--border);

    text-align: right;

    font-size: 13px;
}


th {

    color:
        var(--text-muted);

    background:
        rgba(255,255,255,.025);

    font-size: 11px;

    font-weight: 800;
}


td {

    color:
        var(--text-secondary);
}


tr:last-child td {
    border-bottom: 0;
}


tbody tr {

    transition:
        background var(--transition-fast);
}


tbody tr:hover {

    background:
        rgba(255,255,255,.025);
}


.score {

    font-weight: 900;

    color:
        var(--primary-light);
}


/* =========================================================
   BADGES
   ========================================================= */

.badge {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    padding:
        4px 9px;

    border-radius:
        999px;

    font-size: 10px;

    font-weight: 800;

    white-space: nowrap;
}


.badge-primary {

    color:
        var(--primary-light);

    background:
        rgba(185,154,98,.1);

    border:
        1px solid
        rgba(185,154,98,.14);
}


.badge-success {

    color: #86efac;

    background:
        rgba(34,197,94,.09);

    border:
        1px solid
        rgba(34,197,94,.14);
}


.badge-warning {

    color: #fcd34d;

    background:
        rgba(245,158,11,.09);

    border:
        1px solid
        rgba(245,158,11,.14);
}


.badge-danger {

    color: #fca5a5;

    background:
        rgba(239,68,68,.09);

    border:
        1px solid
        rgba(239,68,68,.14);
}


/* =========================================================
   RANKINGS
   ========================================================= */

.rank-badge {

    width: 34px;
    height: 34px;

    display: grid;

    place-items: center;

    border-radius: 10px;

    font-weight: 900;

    background:
        var(--surface-light);

    border:
        1px solid var(--border);
}


.rank-first {

    color: #fbbf24;

    background:
        rgba(251,191,36,.09);

    border-color:
        rgba(251,191,36,.18);
}


.rank-second {

    color: #cbd5e1;

    background:
        rgba(203,213,225,.08);
}


.rank-third {

    color: #d97706;

    background:
        rgba(217,119,6,.08);
}


/* =========================================================
   MEMBER ROW
   ========================================================= */

.member-row {

    display: flex;

    align-items: center;

    gap: 12px;

    padding: 12px;

    border:
        1px solid transparent;

    border-radius: 13px;

    transition:
        background var(--transition-fast),
        border-color var(--transition-fast);
}


.member-row:hover {

    background:
        var(--surface-light);

    border-color:
        var(--border);
}


.member-info {

    flex: 1;

    min-width: 0;
}


.member-name {

    font-size: 13px;

    font-weight: 800;
}


.member-role {

    color:
        var(--text-muted);

    font-size: 10px;

    margin-top: 2px;
}


.avatar {

    width: 42px;
    height: 42px;

    flex-shrink: 0;

    display: grid;

    place-items: center;

    border-radius: 13px;

    color: #17120b;

    background:
        var(--gradient-primary);

    font-size: 13px;

    font-weight: 900;

    box-shadow:
        0 5px 18px
        rgba(185,154,98,.15);
}


/* =========================================================
   EMPTY STATES
   ========================================================= */

.empty {

    min-height: 230px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    text-align: center;

    padding: 25px;

    color:
        var(--text-muted);
}


.empty-icon {

    width: 55px;
    height: 55px;

    display: grid;

    place-items: center;

    margin-bottom: 13px;

    border-radius: 17px;

    color:
        var(--primary-light);

    background:
        rgba(185,154,98,.08);
}


.empty h3 {

    color:
        var(--text);

    font-size: 15px;

    margin-bottom: 6px;
}


.empty p {

    max-width: 450px;

    font-size: 12px;

    line-height: 1.9;
}


/* =========================================================
   CHAT
   ========================================================= */

.chat-card {

    min-height: 620px;

    display: flex;

    flex-direction: column;

    overflow: hidden;
}


.chat-log {

    flex: 1;

    min-height: 450px;

    overflow-y: auto;

    padding: 20px;

    display: flex;

    flex-direction: column;

    gap: 14px;
}


.chat-bubble-row {

    display: flex;

    gap: 9px;

    align-items: flex-end;
}


.chat-bubble-row.user {
    justify-content: flex-start;
}


.chat-bubble-row.assistant {
    justify-content: flex-end;
}


.chat-bubble {

    max-width:
        min(720px, 80%);

    padding:
        11px 14px;

    border-radius: 15px;

    font-size: 13px;

    line-height: 1.9;
}


.chat-bubble.user {

    color:
        var(--text);

    background:
        rgba(255,255,255,.05);

    border:
        1px solid var(--border);
}


.chat-bubble.assistant {

    color:
        var(--text);

    background:
        rgba(185,154,98,.09);

    border:
        1px solid
        rgba(185,154,98,.12);
}


.chat-input-row {

    display: flex;

    gap: 9px;

    padding: 14px;

    border-top:
        1px solid var(--border);

    background:
        rgba(255,255,255,.015);
}


.chat-input-row input {
    flex: 1;
}


/* =========================================================
   TEAM CARDS
   ========================================================= */

.team-card {

    position: relative;

    overflow: hidden;
}


.team-card::after {

    content: "";

    position: absolute;

    width: 150px;
    height: 150px;

    border-radius: 50%;

    top: -90px;
    left: -80px;

    background:
        var(--primary);

    opacity: .045;

    filter: blur(10px);
}


.team-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    margin-bottom: 18px;
}


.team-name {

    font-size: 17px;

    font-weight: 900;
}


.team-admin {

    color:
        var(--text-muted);

    font-size: 11px;
}


/* =========================================================
   MODAL
   ========================================================= */

.modal-backdrop {

    position: fixed;

    inset: 0;

    z-index: 100;

    display: grid;

    place-items: center;

    padding: 20px;

    background:
        rgba(0,0,0,.66);

    backdrop-filter:
        blur(10px);

    animation:
        fadeIn 180ms ease both;
}


.modal {

    width:
        min(550px, 100%);

    max-height: 90vh;

    overflow-y: auto;

    padding: 25px;

    border-radius:
        var(--radius-xl);

    border:
        1px solid
        var(--border-strong);

    background:
        var(--surface-solid);

    box-shadow:
        var(--shadow-lg),
        var(--glow-primary);

    animation:
        modalEnter 260ms ease both;
}


.modal-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 15px;

    margin-bottom: 22px;
}


.modal-header h3 {
    font-size: 19px;
}


.modal-close {

    width: 38px;
    height: 38px;

    display: grid;

    place-items: center;

    border-radius: 10px;

    color:
        var(--text-muted);

    background:
        var(--surface-light);
}


.modal-close:hover {

    color:
        var(--text);

    background:
        rgba(255,255,255,.08);
}


/* =========================================================
   TOAST
   ========================================================= */

.toast-container {

    position: fixed;

    left: 25px;
    bottom: 25px;

    z-index: 200;

    display: flex;

    flex-direction: column;

    gap: 10px;
}


.toast {

    min-width: 260px;

    max-width: 380px;

    padding:
        13px 15px;

    border-radius: 13px;

    background:
        rgba(18,24,38,.92);

    border:
        1px solid var(--border);

    box-shadow:
        var(--shadow-lg);

    backdrop-filter:
        blur(20px);

    animation:
        toastEnter 300ms ease both;
}


.toast-title {

    font-size: 12px;

    font-weight: 900;
}


.toast-text {

    color:
        var(--text-muted);

    font-size: 11px;

    margin-top: 3px;
}


/* =========================================================
   LOADING
   ========================================================= */

.loading {

    min-height: 250px;

    display: grid;

    place-items: center;
}


.loader {

    width: 38px;
    height: 38px;

    border-radius: 50%;

    border:
        3px solid var(--border);

    border-top-color:
        var(--primary);

    animation:
        spin .8s linear infinite;
}


.skeleton {

    position: relative;

    overflow: hidden;

    background:
        rgba(255,255,255,.055);

    border-radius: 8px;
}


.skeleton::after {

    content: "";

    position: absolute;

    inset: 0;

    transform:
        translateX(-100%);

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(255,255,255,.07),
            transparent
        );

    animation:
        skeleton 1.5s infinite;
}


/* =========================================================
   ICON
   ========================================================= */

.icon {

    width: 18px;
    height: 18px;

    display: inline-block;

    flex-shrink: 0;
}


.icon svg {

    width: 100%;
    height: 100%;
}



/* =========================================================
   NAV BADGE
   عداد الطلبات الجديدة جنب تاب "الطلبات"
   ========================================================= */

.nav-badge {

    margin-inline-start: auto;

    min-width: 22px;

    height: 22px;

    padding: 0 7px;

    display: inline-flex;

    align-items: center;

    justify-content: center;

    border-radius: 999px;

    background: var(--danger);

    color: #fff;

    font-size: .72rem;

    font-weight: 700;

    line-height: 1;

    box-shadow:
        0 0 0 3px rgba(239, 68, 68, .15);
}


.nav-btn.active .nav-badge {

    background: #fff;

    color: var(--danger);

    box-shadow: none;
}


/* =========================================================
   REQUEST CARD
   كارت طلب الانضمام عند الأدمن
   ========================================================= */

.request-card {

    border-inline-start:
        3px solid var(--accent);
}


.request-card .team-admin {

    margin-top: 4px;

    font-size: .85rem;
}


.request-card .row {

    flex-wrap: wrap;
}

/* NANES: improvisation scores stay readable and scroll horizontally */
.improvisation-horizontal-scroll {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.improvisation-wide-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}
.improvisation-wide-table th:first-child,
.improvisation-wide-table td:first-child { width: 190px; min-width: 190px; }
.improvisation-wide-table th:nth-child(2),
.improvisation-wide-table td:nth-child(2) { width: 145px; min-width: 145px; }
.improvisation-wide-table .improv-session-column,
.improvisation-wide-table .improv-session-cell { width: 150px; min-width: 150px; }
.improvisation-wide-table .improv-score-input { width: 100%; min-width: 110px; box-sizing: border-box; }
.improv-session-cell { vertical-align: top; }
.improv-skip-label { display: flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 11px; white-space: nowrap; cursor: pointer; }
.improv-session-cell.is-skipped { background: rgba(245, 158, 11, .08); }
.improv-skipped-tag { display: inline-block; margin-top: 8px; font-size: 12px; opacity: .75; }
