/* ================================================================
   StudentOS — patches18.css
   1.  Task drag-and-drop row styling
   2.  Attendance dashboard widget
   3.  Quick attendance log modal
   4.  Routine mark-done today
   5.  Worksheet improvements
   6.  Settings avatar large preview
   7.  Sidebar FA icon sizes
   ================================================================ */

/* === 1. Task drag-and-drop ===================================== */
#full-task-list .task-row[data-dragstate="src"]  { opacity: .38; }
#full-task-list .task-row[data-dragstate="over"] {
    background: color-mix(in srgb, var(--accent) 8%, transparent) !important;
    border-radius: 12px;
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
}
#full-task-list .task-row { cursor: default; user-select: text; }
.task-drag-handle { cursor: grab !important; }
.task-drag-handle:active { cursor: grabbing !important; }

/* === 2. Attendance dashboard widget =========================== */
#widget-attendance .p18-att-course-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .78rem;
    padding: 4px 0;
}
#widget-attendance .p18-att-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
#widget-attendance .p18-att-name {
    flex: 1;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#widget-attendance .p18-att-pct {
    font-size: .7rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--text-muted);
}
#widget-attendance .p18-att-bar-bg {
    height: 3px;
    border-radius: 99px;
    background: var(--glass-hover);
    overflow: hidden;
    margin-top: 2px;
}
#widget-attendance .p18-att-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width .4s;
}
#widget-attendance .p18-att-overall {
    font-size: 2rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
    line-height: 1;
}
#widget-attendance .p18-att-overall-lbl {
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin-top: 1px;
}

/* === 3. Quick attendance log modal ============================ */
#modal-p18-quick-att {
    width: 440px;
}
.p18-qatt-course-card {
    background: var(--glass-panel);
    border: 1.5px solid var(--glass-border);
    border-radius: 12px;
    padding: 11px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: border-color .15s;
}
.p18-qatt-course-card:hover {
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.p18-qatt-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.p18-qatt-name {
    flex: 1;
    font-size: .85rem;
    font-weight: 600;
}
.p18-qatt-btns {
    display: flex;
    gap: 5px;
}
.p18-qatt-btn {
    padding: 5px 10px;
    border-radius: 8px;
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all .13s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.p18-qatt-btn.attend {
    background: rgba(34,197,94,.09);
    border-color: rgba(34,197,94,.2);
    color: #22c55e;
}
.p18-qatt-btn.attend:hover,
.p18-qatt-btn.attend.active {
    background: #22c55e;
    color: #fff;
    border-color: #22c55e;
}
.p18-qatt-btn.miss {
    background: rgba(239,68,68,.09);
    border-color: rgba(239,68,68,.2);
    color: #ef4444;
}
.p18-qatt-btn.miss:hover,
.p18-qatt-btn.miss.active {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

/* === 4. Routine mark-done ===================================== */
.p18-rb-done-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.25);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .6rem;
    color: transparent;
    transition: all .15s;
}
.p16-routine-block { position: relative; }
.p18-rb-done-btn:hover {
    border-color: #22c55e;
    color: #22c55e;
}
.p18-rb-done-btn.done {
    background: #22c55e;
    border-color: #22c55e;
    color: #fff;
}
.p16-routine-block.p18-done-today {
    opacity: .6;
}
.p16-routine-block.p18-done-today .p16-rb-label {
    text-decoration: line-through;
}

/* Routine daily progress bar */
.p18-routine-progress {
    background: var(--glass-panel);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 8px 14px;
    margin-bottom: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.p18-routine-progress-bar {
    flex: 1;
    height: 5px;
    border-radius: 99px;
    background: var(--glass-hover);
    overflow: hidden;
}
.p18-routine-progress-fill {
    height: 100%;
    border-radius: 99px;
    background: var(--accent);
    transition: width .5s;
}
.p18-routine-progress-lbl {
    font-size: .72rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

/* === 5. Worksheet improvements ================================ */
.p18-ws-step-title-edit {
    background: transparent;
    border: none;
    border-bottom: 1.5px solid transparent;
    color: var(--text-main);
    font-size: .88rem;
    font-weight: 700;
    flex: 1;
    outline: none;
    transition: border-color .15s;
    padding: 0 2px;
    min-width: 0;
}
.p18-ws-step-title-edit:focus {
    border-bottom-color: var(--accent);
}
.p18-ws-chain-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: .62rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    cursor: pointer;
    transition: all .13s;
}
.p18-ws-chain-badge:hover {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
}
/* Note block editable area */
.p16-ws-step[data-wstype="note"] textarea {
    width: 100%;
    background: transparent;
    border: none;
    resize: none;
    color: var(--text-main);
    font-size: .82rem;
    outline: none;
    min-height: 60px;
    font-family: inherit;
    line-height: 1.5;
}
/* Worksheet clear + collapse toolbar */
.p18-ws-toolbar {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}
.p18-ws-tb-btn {
    padding: 6px 12px;
    border-radius: 9px;
    font-size: .76rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid var(--glass-border);
    background: var(--glass-panel);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all .13s;
}
.p18-ws-tb-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
/* Collapse individual ws steps */
.p18-ws-step-body {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height .25s ease;
}
.p18-ws-step.collapsed .p18-ws-step-body {
    max-height: 0;
    overflow: hidden;
}
.p18-ws-collapse-btn {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    transition: all .15s;
    flex-shrink: 0;
}
.p18-ws-collapse-btn:hover { background: var(--glass-hover); color: var(--text-main); }

/* Auto-chain suggestion row */
.p18-ws-chain-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .7rem;
    color: var(--text-muted);
    margin-top: 6px;
    padding: 5px 8px;
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    border-radius: 8px;
    border: 1px dashed color-mix(in srgb, var(--accent) 20%, transparent);
}

/* === 6. Settings avatar large preview ========================= */
#p16-settings-avatar,
#p18-settings-avatar {
    width: 72px !important;
    height: 72px !important;
    border-radius: 18px !important;
    font-size: 2rem !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--accent);
    box-shadow: 0 4px 20px rgba(0,0,0,.22);
}
#p16-settings-avatar img,
#p18-settings-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 18px !important;
}

/* === 7. Sidebar icon sizing =================================== */
nav .nav-btn i.fa-solid,
nav .nav-btn i.fa-regular,
nav .nav-btn i.fa-brands {
    font-size: 1.2rem;
    width: 1.25rem;
    text-align: center;
}

/* Responsive quick-att modal */
@media (max-width: 560px) {
    #modal-p18-quick-att { width: calc(100vw - 32px); }
}
