/* ==========================================================================
   Upload widget — shared styling for the online-lesson video submission and
   the "play feedback" pages. Scope everything under `.uw-scope` so it never
   leaks into unrelated file inputs / progress bars on the same page.

   Elements it styles (existing markup) + adds (via upload-widget.js):
     - .uw-scope input[type=file]   → "Choose File" control
     - .uw-scope .progress / bar    → rounded blue progress bar
     - .uw-scope .upload-status     → success / error banner
     - .uw-card                     → uploaded-file card (icon + name + size + trash)
   ========================================================================== */

/* ---- "Choose File" control ------------------------------------------------ */
.uw-scope input[type="file"] {
    width: 100%;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    background: #fff;
    padding: 10px 14px;
    font-size: 14px;
    color: #475467;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.uw-scope input[type="file"]:hover {
    border-color: #b6d4f2;
}
.uw-scope input[type="file"]:focus {
    outline: none;
    border-color: #0071ce;
    box-shadow: 0 0 0 3px rgba(0, 113, 206, .12);
}
.uw-scope input[type="file"]::file-selector-button,
.uw-scope input[type="file"]::-webkit-file-upload-button {
    margin-right: 14px;
    padding: 8px 16px;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    background: #f9fafb;
    color: #344054;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.uw-scope input[type="file"]:hover::file-selector-button {
    background: #f2f4f7;
    border-color: #d0d5dd;
}

/* ---- Uploaded-file card --------------------------------------------------- */
.uw-card {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 12px;
    padding: 14px 16px;
    border: 1px solid #eaecf0;
    border-radius: 12px;
    background: #fff;
}
.uw-card-icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #f2f4f7;
    color: #475467;
}
.uw-card-icon svg { width: 22px; height: 22px; }
.uw-card-body { flex: 1 1 auto; min-width: 0; }
.uw-card-name {
    font-weight: 700;
    color: #101828;
    font-size: 14px;
    word-break: break-word;
}
.uw-card-size {
    margin-top: 2px;
    font-size: 12px;
    color: #667085;
}
.uw-card-remove {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #eaecf0;
    border-radius: 10px;
    background: #fff;
    color: #667085;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.uw-card-remove:hover {
    background: #fef3f2;
    border-color: #fecdca;
    color: #d92d20;
}
.uw-card-remove svg { width: 18px; height: 18px; }

/* ---- Progress bar --------------------------------------------------------- */
.uw-scope .progress {
    display: none;                 /* JS shows it while uploading */
    height: 30px;
    margin-top: 14px;
    margin-bottom: 4px;
    background-color: #eef1f4;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: none;
}
.uw-scope .progress-bar {
    height: 100%;
    width: 0%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background-color: #1a73e8;
    border-radius: 8px;
    transition: width .3s ease;
}

/* ---- Success / error banner ---------------------------------------------- */
.uw-scope .upload-status {
    display: none;                 /* JS shows it when there's a message */
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
}
.uw-scope .upload-status.upload-success {
    display: flex !important;      /* beat the pages' inline display:block */
    background: #ecfdf3 !important;
    color: #067647 !important;
}
.uw-scope .upload-status.upload-error {
    display: flex !important;
    background: #fef3f2 !important;
    color: #b42318 !important;
}
/* leading status icon */
.uw-scope .upload-status::before {
    content: "";
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 22px 22px;
}
.uw-scope .upload-status.upload-success::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2312b76a'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm-1.2 14.3-3.5-3.5 1.4-1.4 2.1 2.1 4.9-4.9 1.4 1.4-6.3 6.3Z'/%3E%3C/svg%3E");
}
.uw-scope .upload-status.upload-error::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f04438'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm1 15h-2v-2h2v2Zm0-4h-2V7h2v6Z'/%3E%3C/svg%3E");
}

/* The "Upload Another File" drop zone was removed by request — the file card's
   trash button is the only way to replace a file. */

/* ---- "Take Recording" / "Upload File" choice (UploadWidget.captureChoice) -- */
.uw-native-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    border: 0 !important;
    opacity: 0 !important;
}
.uw-choice {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
    gap: 14px;
}
.uw-choice-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 78px;
    padding: 14px 16px;
    text-align: left;
    border-radius: 12px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.uw-choice-record {
    background: #f3f7fe;
    border: 1px solid #d3e2fb;
}
.uw-choice-record:hover { background: #eaf2fe; border-color: #b6cff7; }
.uw-choice-upload {
    background: #fff;
    border: 1.5px dashed #d0d5dd;
}
.uw-choice-upload:hover { background: #f9fafb; border-color: #98a2b3; }
.uw-choice-tile:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, .18);
}
.uw-choice-icon {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e3ecfb;
    color: #1849a9;
}
.uw-choice-upload .uw-choice-icon { background: #eef2f8; }
.uw-choice-icon svg { width: 22px; height: 22px; }
.uw-choice-text { display: flex; flex-direction: column; min-width: 0; }
.uw-choice-title {
    font-size: 14px;
    font-weight: 700;
    color: #1849a9;
}
.uw-choice-sub {
    margin-top: 2px;
    font-size: 12.5px;
    line-height: 1.35;
    color: #667085;
}
.uw-choice-or {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    color: #667085;
}
.uw-choice-or::before,
.uw-choice-or::after {
    content: "";
    flex: 1 1 auto;
    width: 1px;
    max-height: 18px;
    background: #d0d5dd;
}
@media (max-width: 575.98px) {
    .uw-choice { grid-template-columns: 1fr; gap: 10px; }
    .uw-choice-or { flex-direction: row; }
    .uw-choice-or::before,
    .uw-choice-or::after { width: auto; max-width: 48px; height: 1px; max-height: none; }
}

/* ---- Desktop webcam recorder modal ---------------------------------------- */
body.uw-rec-lock { overflow: hidden; }
.uw-rec-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(16, 24, 40, .6);
}
.uw-rec-backdrop.is-open { display: flex; }
.uw-rec {
    width: 100%;
    max-width: 720px;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 48px rgba(16, 24, 40, .25);
}
.uw-rec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #eaecf0;
}
.uw-rec-title { font-size: 16px; font-weight: 700; color: #101828; }
.uw-rec-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    color: #667085;
    cursor: pointer;
}
.uw-rec-close:hover { background: #f2f4f7; color: #101828; }
.uw-rec-stage {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #0c111d;
}
.uw-rec-video { width: 100%; height: 100%; object-fit: contain; display: block; }
.uw-rec-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.uw-rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f04438;
    animation: uw-rec-blink 1s infinite;
}
@keyframes uw-rec-blink { 50% { opacity: .3; } }
.uw-rec-msg {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    color: #fff;
    font-size: 14px;
}
.uw-rec-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 18px;
}
.uw-rec-btn {
    display: none;
    padding: 10px 18px;
    border: 1px solid #1a73e8;
    border-radius: 10px;
    background: #1a73e8;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.uw-rec-btn:hover { filter: brightness(.95); }
.uw-rec-stop { background: #d92d20; border-color: #d92d20; }
.uw-rec-ghost { background: #fff; color: #344054; border-color: #d0d5dd; }

/* which controls show in each state */
.uw-rec-backdrop[data-state="loading"] .uw-rec-msg,
.uw-rec-backdrop[data-state="error"] .uw-rec-msg,
.uw-rec-backdrop[data-state="recording"] .uw-rec-badge { display: flex; }
.uw-rec-backdrop[data-state="ready"] .uw-rec-start,
.uw-rec-backdrop[data-state="recording"] .uw-rec-stop,
.uw-rec-backdrop[data-state="review"] .uw-rec-retake,
.uw-rec-backdrop[data-state="review"] .uw-rec-use,
.uw-rec-backdrop[data-state="error"] .uw-rec-fallback { display: inline-flex; }
