/* Dark UI modal – pop-up overlay and centered box
 * Overlay covers full viewport (including sidebar), blocks clicks, centers the modal.
 * Uses design tokens from css/new_cms/css.css when loaded.
 */

/* Overlay: full viewport, blocks clicks, flexbox centers the modal */
#x9se {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow-x: hidden;
    overflow-y: auto;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    box-sizing: border-box;
    pointer-events: auto;
    -webkit-overflow-scrolling: touch;
}

/* Modal box: centered, max height with internal scroll, border-radius */
.x9d0 {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    margin: auto;
    box-sizing: border-box;
    border-radius: 16px;
    background: var(--bg-secondary, #1a1a1f);
    border: 1px solid var(--border, #3a3a45);
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(124, 92, 255, 0.15);
    padding: 28px 24px 24px;
    color: var(--text-primary, #fff);
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbars (keep scroll) for overlay + modal box */
#x9se,
.x9d0 {
    -ms-overflow-style: none; /* IE/Edge */
    scrollbar-width: none; /* Firefox */
}
#x9se::-webkit-scrollbar,
.x9d0::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* Close button (top-right icon injected by Modal.js) */
#x9i {
    width: 24px;
    height: 24px;
    cursor: pointer;
    position: absolute;
    top: 18px;
    right: 18px;
    opacity: 0.7;
    transition: opacity 0.15s ease, transform 0.15s ease;
    filter: drop-shadow(0 0 4px rgba(0,0,0,0.6));
}

#x9i:hover {
    opacity: 1;
    transform: scale(1.05);
}

/* Container for modal body (#x9d) inherits padding via .x9d0 */
#x9d {
    margin-top: 8px;
}

/* Legacy modal form wrapper – restyled for dark cards */
.x9d0 .x3se2 {
    background: transparent;
    box-shadow: none;
    border-radius: 16px;
    padding: 8px 0 0;
    margin: 0;
}

/* Section headers inside modal (x3d2 rows) */
.x9d0 .x3d2 {
    background: rgba(35, 35, 43, 0.98);
    border-radius: 12px;
    padding: 14px 20px;
    margin: 0 0 4px;
}

.x9d0 .x3d2:nth-child(2n) {
    background: rgba(29, 29, 37, 0.98);
}

.x9d0 .x3h12,
.x9d0 .x3h22,
.x9d0 h1 {
    color: var(--text-primary, #fff) !important;
    margin-bottom: 16px;
}

/* Section headers (e.g. "English Information") – dark theme + accent line */
.x9d0 h3 {
    margin: 24px 0 12px 0 !important;
    color: var(--text-secondary, #a0a0b0) !important;
    border-bottom: 2px solid var(--accent, #7c5cff) !important;
    padding-bottom: 8px !important;
    font-size: 14px;
    font-weight: 600;
}
.x9d0 h3:first-of-type {
    margin-top: 0 !important;
}

/* Required asterisk */
.x9d0 label span[style*="red"],
.x9d0 .x3lb2 span {
    color: var(--danger, #f87171) !important;
}

/* Field containers & labels */
.x9d0 .x3d3,
.x9d0 .x3d4 {
    width: 100%;
}

.x9d0 .x3lb1,
.x9d0 .x3lb2 {
    color: var(--text-primary, #fff) !important;
}
.x9d0 small {
    color: var(--text-muted, #6b6b7a) !important;
}

/* Inputs, selects, textareas inside modal */
.x9d0 .x3in1,
.x9d0 .x3in2,
.x9d0 .x3sl1,
.x9d0 .x3s2,
.x9d0 textarea,
.x9d0 input[type="text"],
.x9d0 input[type="email"],
.x9d0 input[type="number"],
.x9d0 input[type="password"] {
    background: var(--bg-card, #23232b);
    border-radius: 10px;
    border: 1px solid var(--border, #3a3a45);
    color: var(--text-primary, #ffffff);
    padding: 10px 12px;
    font-size: 14px;
}

/* Password field + visibility toggle (tutor create/update, etc.) */
.x9d0 .x3pw-wrap {
    position: relative;
    width: 100%;
    margin: 5px;
    box-sizing: border-box;
}
.x9d0 .x3pw-wrap .x3in2 {
    padding-right: 44px;
    width: 100%;
}
.x9d0 .x3pw-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 6px;
    line-height: 0;
    color: var(--text-secondary, #a0a0b0);
    border-radius: 6px;
}
.x9d0 .x3pw-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #fff);
}
.x9d0 .x3pw-toggle:focus-visible {
    outline: 2px solid var(--accent, #7c5cff);
    outline-offset: 2px;
}
.x9d0 .x3pw-toggle svg {
    width: 20px;
    height: 20px;
    display: block;
}

.x9d0 .x3in1::placeholder,
.x9d0 textarea::placeholder {
    color: var(--text-muted, #6b6b7a);
}

.x9d0 .x3sl1 option {
    background: #121218;
    color: var(--text-primary, #ffffff);
}

/* File input in modal */
.x9d0 input[type="file"] {
    background: var(--bg-card, #23232b) !important;
    border: 1px solid var(--border, #3a3a45) !important;
    border-radius: 8px;
    color: var(--text-secondary, #a0a0b0);
    padding: 8px 12px;
}

/* View (read) modal – dark table and content */
.x9d0 .x3se2 table,
.x9d0 section table,
.x9d0 table {
    width: 100% !important;
    border-collapse: collapse;
    background: var(--bg-card, #23232b) !important;
    border-radius: 12px;
    overflow: hidden;
}
.x9d0 table td {
    padding: 14px 16px !important;
    border-bottom: 1px solid var(--border, #3a3a45) !important;
    background: var(--bg-card, #23232b) !important;
    color: var(--text-primary, #fff) !important;
}
.x9d0 table tr:last-child td {
    border-bottom: none !important;
}
.x9d0 table tr td:first-child {
    background: var(--bg-hover, #2d2d35) !important;
    font-weight: 600;
    color: var(--text-secondary, #a0a0b0) !important;
    width: 20%;
}
.x9d0 .status-active,
.x9d0 span[style*="d4edda"] {
    background: rgba(52, 211, 153, 0.2) !important;
    color: var(--success, #34d399) !important;
}
.x9d0 .status-inactive,
.x9d0 span[style*="f8d7da"] {
    background: rgba(248, 113, 113, 0.2) !important;
    color: var(--danger, #f87171) !important;
}
.x9d0 .e1 {
    color: var(--text-muted, #6b6b7a) !important;
}
.x9d0 .ok.e1 {
    color: var(--success, #34d399) !important;
}
.x9d0 p {
    color: var(--text-primary, #fff) !important;
}

/* Primary/secondary buttons inside modal */
.x9d0 .x3bt1,
.x9d0 .x3bt2 {
    background: var(--accent, #7c5cff);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.x9d0 .x3bt1:hover,
.x9d0 .x3bt2:hover {
    background: var(--accent-hover, #8f72ff);
    box-shadow: 0 0 0 1px rgba(124, 92, 255, 0.5);
}

.x9d0 .x3bt1:active,
.x9d0 .x3bt2:active {
    transform: translateY(1px);
}

/* Secondary / cancel style if used with .a0 wrapper */
.x9d0 .a0 .x3bt1 {
    background: var(--bg-card, #23232b);
    border: 1px solid var(--border, #3a3a45);
    color: var(--text-secondary, #a0a0b0);
}

.x9d0 .a0 .x3bt1:hover {
    background: var(--bg-hover, #2d2d35);
}

/* Small helper for compact checkbox rows in modals */
.x9d0 .module-checkbox-item,
.x9d0 .session-checkbox-item {
    background: var(--bg-card, #23232b);
    border: 1px solid var(--border, #3a3a45);
}

.x9d0 .module-checkbox-item:hover,
.x9d0 .session-checkbox-item:hover {
    background: var(--bg-hover, #2d2d35);
}

/* Spacing helper used in some modals */
.x9e { 
    margin-top: 20px;
}

@media screen and (max-width: 900px) {
    #x9se {
        align-items: stretch;
        padding: 24px 10px;
    }

    .x9d0 {
        max-width: 100%;
        padding: 20px 18px 18px;
    }
}

