/* Shared upload form tokens: parent/guest #uploadForm + tutor Books modal (.ap-upload-form) */
.ap-upload-form .form-field,
.ap-upload-form .tu-form-field {
    margin-bottom: 20px;
    text-align: left;
}

.ap-upload-form .form-field label,
.ap-upload-form .tu-form-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ap-upload-form .form-field input[type="text"],
.ap-upload-form .tu-form-field input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    min-height: 48px;
    padding: 0 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.3;
    color: #1e293b;
    background: #fff;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ap-upload-form select,
.ap-upload-form .tu-form-field select {
    width: 100%;
    box-sizing: border-box;
    min-height: 48px;
    padding: 0 12px;
    padding-right: 2rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.3;
    color: #1e293b;
    background-color: #fff;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.ap-upload-form .form-field input[type="text"]::placeholder,
.ap-upload-form .tu-form-field input[type="text"]::placeholder {
    color: #94a3b8;
}

.ap-upload-form .form-field input[type="text"]:focus,
.ap-upload-form .tu-form-field input[type="text"]:focus,
.ap-upload-form select:focus,
.ap-upload-form .tu-form-field select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12);
}

.ap-upload-form select:disabled,
.ap-upload-form #academicYearSelect:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 1;
}

.ap-upload-form #childClassDisplay[readonly] {
    background: #f8fafc;
    color: #334155;
}

.ap-upload-form #customSubjectInput {
    margin-top: 8px;
}

.ap-upload-form .csd-selected,
.ap-upload-form .tu-csd-sel {
    box-sizing: border-box;
    width: 100%;
    min-height: 48px;
    padding: 0 12px;
    padding-right: 2rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    line-height: 1.3;
    color: #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ap-upload-form .csd-selected:not(.has-value) {
    color: #94a3b8;
}

.ap-upload-form .csd-selected.has-value {
    color: #1e293b;
}

.ap-upload-form .tu-csd-sel.placeholder {
    color: #94a3b8;
}

.ap-upload-form .tu-csd-sel:not(.placeholder) {
    color: #1e293b;
}

.ap-upload-form .csd-selected:hover,
.ap-upload-form .tu-csd-sel:hover {
    border-color: #cbd5e1;
}

.ap-upload-form .csd-selected:focus-visible,
.ap-upload-form .tu-csd-sel:focus-visible,
.ap-upload-form .custom-subject-dropdown.open .csd-selected,
.ap-upload-form .tu-csd.open .tu-csd-sel {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12);
}

.ap-upload-form .csd-selected::after,
.ap-upload-form .tu-csd-sel::after {
    content: '\25BC';
    font-size: 0.65rem;
    color: #94a3b8;
    margin-left: 0.5rem;
}

.ap-upload-form .custom-subject-dropdown,
.ap-upload-form .tu-csd {
    position: relative;
    width: 100%;
}

.ap-upload-form .csd-menu,
.ap-upload-form .tu-csd-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    max-height: 320px;
    overflow-y: auto;
}

.ap-upload-form .custom-subject-dropdown.open .csd-menu,
.ap-upload-form .tu-csd.open .tu-csd-menu {
    display: block;
}

.ap-upload-form .csd-submenu,
.ap-upload-form .tu-csd-sub {
    display: none;
    position: absolute;
    left: 100%;
    top: -1px;
    min-width: 170px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 101;
    max-height: 300px;
    overflow-y: auto;
}

.ap-upload-form .csd-has-sub:hover > .csd-submenu,
.ap-upload-form .tu-csd-hassub:hover > .tu-csd-sub {
    display: block;
}

.ap-upload-form .csd-item,
.ap-upload-form .tu-csd-item {
    padding: 0.55rem 12px;
    cursor: pointer;
    font-size: 16px;
    color: #334155;
    white-space: nowrap;
}

.ap-upload-form .csd-item:hover,
.ap-upload-form .tu-csd-item:hover {
    background: #f1f5f9;
}

.ap-upload-form .csd-item.selected,
.ap-upload-form .tu-csd-item.selected {
    background: #e0e7ff;
    color: #3730a3;
    font-weight: 500;
}

.ap-upload-form .csd-has-sub {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 12px;
    cursor: pointer;
    font-size: 16px;
    color: #334155;
}

.ap-upload-form .csd-has-sub:hover {
    background: #f1f5f9;
}

.ap-upload-form .csd-arrow,
.ap-upload-form .tu-csd-arrow {
    font-size: 0.7rem;
    color: #94a3b8;
}

.ap-upload-form .tu-csd-hassub {
    position: relative;
    padding: 0.55rem 12px;
    cursor: pointer;
    font-size: 16px;
    color: #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ap-upload-form .tu-csd-hassub:hover {
    background: #f1f5f9;
}

.ap-upload-form .csd-submenu .csd-item {
    padding: 0.5rem 12px;
}

.ap-upload-form .file-upload-area,
.ap-upload-form .tu-file-area {
    position: relative;
    border: 1px dashed #e2e8f0;
    border-radius: 8px;
    min-height: 140px;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    box-sizing: border-box;
}

.ap-upload-form .file-upload-area:hover,
.ap-upload-form .file-upload-area.dragover,
.ap-upload-form .tu-file-area:hover,
.ap-upload-form .tu-file-area.dragover {
    border-color: #4f46e5;
    background: #f5f3ff;
}

.ap-upload-form .file-upload-area.has-file,
.ap-upload-form .tu-file-area.has-file {
    border-color: #22c55e;
    background: #f0fdf4;
}

.ap-upload-form .file-upload-text,
.ap-upload-form .tu-file-text {
    font-size: 16px;
    color: #64748b;
    margin: 0;
}

.ap-upload-form .tips-callout {
    margin-top: 20px;
}

.ap-upload-form .image-preview-container,
.ap-upload-form .tu-img-preview {
    margin-top: 20px;
}

.ap-upload-form .preflight-check,
.ap-upload-form .tu-preflight {
    margin-top: 20px;
    margin-bottom: 0;
}

.ap-upload-form .preflight-label,
.ap-upload-form .tu-preflight-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    font-size: 16px;
    line-height: 1.3;
    box-sizing: border-box;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.ap-upload-form .preflight-label:hover,
.ap-upload-form .tu-preflight-label:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.ap-upload-form .tu-preflight-label input[type="checkbox"] {
    accent-color: #4f46e5;
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.ap-upload-form .tu-preflight-label input[type="checkbox"]:checked ~ span {
    color: #334155;
}

.ap-upload-form .tu-preflight-icon {
    flex-shrink: 0;
    color: #cbd5e1;
    transition: color 0.2s;
}

.ap-upload-form .tu-preflight-label input[type="checkbox"]:checked ~ .tu-preflight-icon {
    color: #22c55e;
}

.ap-upload-form button.btn-submit,
.ap-upload-form .tu-btn-submit {
    min-height: 48px;
    margin-top: 20px;
    box-sizing: border-box;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
    background: #4f46e5;
    color: #fff;
}

.ap-upload-form button.btn-submit:hover,
.ap-upload-form .tu-btn-submit:hover {
    background: #4338ca;
}

.ap-upload-form .tu-btn-submit:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
}

.ap-upload-form .tu-btn-submit:disabled:hover {
    background: #cbd5e1;
}

@media (max-width: 640px) {
    .ap-upload-form .form-field label,
    .ap-upload-form .tu-form-field label {
        font-size: 12px;
    }

    .ap-upload-form .form-field input[type="text"],
    .ap-upload-form .tu-form-field input[type="text"] {
        min-height: 48px;
        padding: 0 12px;
        font-size: 16px;
    }

    .ap-upload-form select,
    .ap-upload-form .tu-form-field select {
        min-height: 48px;
        padding: 0 12px;
        padding-right: 2rem;
        font-size: 16px;
    }

    .ap-upload-form .csd-selected,
    .ap-upload-form .tu-csd-sel {
        min-height: 48px;
        font-size: 16px;
        padding: 0 12px;
        padding-right: 2rem;
    }

    .ap-upload-form .file-upload-area,
    .ap-upload-form .tu-file-area {
        min-height: 120px;
        padding: 1.25rem 1rem;
    }

    .ap-upload-form .file-upload-text,
    .ap-upload-form .tu-file-text {
        font-size: 16px;
    }

    .ap-upload-form .preflight-label,
    .ap-upload-form .tu-preflight-label {
        font-size: 16px;
        min-height: 48px;
    }
}

@supports (-webkit-touch-callout: none) {
    .ap-upload-form input[type="text"],
    .ap-upload-form select,
    .ap-upload-form .tu-form-field input[type="text"],
    .ap-upload-form .tu-form-field select {
        font-size: 16px !important;
        border-radius: 8px;
    }

    .ap-upload-form select,
    .ap-upload-form .tu-form-field select {
        -webkit-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 2rem;
    }
}
