/*
 * TW Recruitment System — Frontend Application Form Styles
 * Ultra-clean, modern, highly responsive recruitment application form
 */

/* Container & Global Base */
.tw-apply-section {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f8fafc;
    padding: 3rem 1.25rem;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.tw-apply-section *,
.tw-apply-section *::before,
.tw-apply-section *::after {
    box-sizing: border-box;
}

.tw-apply-card {
    width: 100%;
    max-width: 920px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-top: 4px solid var(--tw-form_accent_color, #2563eb);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 20px 25px -5px rgba(15, 23, 42, 0.04);
    padding: 2.75rem 3rem;
    box-sizing: border-box;
    transition: box-shadow 0.25s ease;
}

/* Header */
.tw-apply-header {
    margin-bottom: 2.25rem;
    text-align: left;
}

.tw-sub-header {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.85rem;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 9999px;
    margin-bottom: 0.85rem;
}

.tw-accent-line {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #d97706;
}

.tw-sub-header-text {
    color: #92400e;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tw-apply-title {
    color: #0f172a;
    font-size: 2.1rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
    line-height: 1.25;
    letter-spacing: -0.025em;
}

.tw-blue-accent {
    color: var(--tw-form_accent_color, #2563eb);
}

.tw-apply-subtitle {
    color: #64748b;
    font-size: 0.975rem;
    margin: 0;
    line-height: 1.6;
}

/* Stepper (Multi-step Progress) */
.tw-form-progress {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    list-style: none;
    margin: 0 0 2.25rem 0;
    padding: 0.4rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.tw-form-progress li {
    flex: 1;
    text-align: center;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tw-form-progress li[aria-current="step"],
.tw-form-progress li.is-active {
    background: #ffffff;
    color: var(--tw-form_accent_color, #2563eb);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-weight: 700;
}

.tw-form-progress li.is-complete {
    color: #059669;
}

/* Form Container */
.tw-form {
    display: flex;
    flex-direction: column;
}

.tw-form-step-panel {
    display: flex;
    flex-direction: column;
}

.tw-form-step-panel[hidden] {
    display: none !important;
}

/* Grid System */
.tw-form-row {
    display: grid;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.tw-col-1 {
    grid-template-columns: 1fr;
}

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

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

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

.tw-col-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

/* Section Header Banners */
.tw-form-section-title {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--tw-form_accent_color, #2563eb);
    border-radius: 8px;
    padding: 0.75rem 1.15rem;
    margin: 2rem 0 1.25rem 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    box-sizing: border-box;
    letter-spacing: -0.01em;
}

.tw-form-section-title span {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Field Controls & Typography */
.tw-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    position: relative;
}

.tw-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    line-height: 1.35;
}

.tw-required {
    color: #ef4444;
    font-weight: 700;
    margin-left: 0.15rem;
}

/* Inputs & Selects */
.tw-input,
.tw-select {
    width: 100% !important;
    max-width: 100% !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    padding: 0 0.9rem !important;
    height: 46px !important;
    min-height: 46px !important;
    font-family: inherit !important;
    font-size: 0.925rem !important;
    color: #0f172a !important;
    outline: none !important;
    box-sizing: border-box !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease !important;
}

.tw-input::placeholder {
    color: #94a3b8;
    font-size: 0.875rem;
}

.tw-input:hover,
.tw-select:hover {
    border-color: #94a3b8 !important;
}

.tw-input:focus,
.tw-select:focus {
    border-color: var(--tw-form_accent_color, #2563eb) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14) !important;
    background-color: #ffffff !important;
}

textarea.tw-input {
    height: auto !important;
    min-height: 95px !important;
    padding: 0.75rem 0.9rem !important;
    line-height: 1.55 !important;
    resize: vertical;
}

/* Custom Select Chevron */
.tw-select-wrapper {
    position: relative;
    width: 100%;
}

.tw-select {
    appearance: none !important;
    -webkit-appearance: none !important;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    padding-right: 42px !important;
}

.tw-select-arrow {
    display: none !important;
}

/* Field Validation Errors */
.tw-input.tw-input-error,
.tw-select.tw-input-error,
.tw-input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14) !important;
    background-color: #fffafb !important;
}

.tw-field-error {
    font-size: 0.785rem;
    font-weight: 500;
    color: #dc2626;
    min-height: 1.15em;
    line-height: 1.3;
    display: block;
}

/* Interactive Drag & Drop File Upload Zones */
.tw-file-dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 1.5rem 1.25rem;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    box-sizing: border-box;
}

.tw-file-dropzone:hover {
    border-color: var(--tw-form_accent_color, #2563eb);
    background: #f0f7ff;
}

.tw-file-dropzone.is-dragover {
    border-color: var(--tw-form_accent_color, #2563eb);
    background: #eff6ff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.tw-file-dropzone.has-file {
    border-style: solid;
    border-color: #93c5fd;
    background: #f8fafc;
}

.tw-file-drop-icon {
    color: var(--tw-form_accent_color, #2563eb);
    margin-bottom: 0.2rem;
    transition: transform 0.2s ease;
}

.tw-file-dropzone:hover .tw-file-drop-icon {
    transform: translateY(-2px);
}

.tw-file-drop-text {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tw-file-drop-main {
    font-weight: 600;
    font-size: 0.925rem;
    color: #1e293b;
}

.tw-file-drop-hint {
    font-size: 0.785rem;
    color: #64748b;
    margin-top: 0.2rem;
}

.tw-file-browse-btn {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    font-size: 0.785rem;
    font-weight: 600;
    color: #334155;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.tw-file-dropzone:hover .tw-file-browse-btn {
    border-color: var(--tw-form_accent_color, #2563eb);
    color: var(--tw-form_accent_color, #2563eb);
}

.tw-file-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* File Selected Info Badge */
.tw-file-info {
    margin-top: 0.65rem;
}

.tw-file-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    font-size: 0.85rem;
    box-sizing: border-box;
}

.tw-file-badge-icon {
    display: inline-flex;
    align-items: center;
    color: #2563eb;
    flex-shrink: 0;
}

.tw-file-badge-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    color: #1e3a8a;
}

.tw-file-remove {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.6rem;
    border: none;
    background: #fee2e2;
    color: #b91c1c;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

.tw-file-remove:hover {
    background: #fecaca;
}

/* Privacy Consent Wrap */
.tw-privacy-wrap {
    margin: 1.25rem 0 0.5rem 0;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.tw-checkbox-label {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.5;
}

.tw-checkbox-label input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    margin-top: 0.15rem;
    border-radius: 4px;
    cursor: pointer;
    accent-color: var(--tw-form_accent_color, #2563eb);
    flex-shrink: 0;
}

.tw-checkbox-label a {
    color: var(--tw-form_accent_color, #2563eb);
    text-decoration: underline;
    font-weight: 600;
}

/* Review Summary */
.tw-review-summary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.tw-review-summary h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.75rem;
}

.tw-review-summary dl {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem 1.5rem;
    margin: 0;
}

.tw-review-summary dt {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tw-review-summary dd {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1e293b;
    margin: 0 0 0.5rem 0;
    word-break: break-word;
}

/* Step Action Buttons */
.tw-form-step-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid #f1f5f9;
}

.tw-form-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0.7rem 1.4rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    font-size: 0.925rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tw-form-back:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.tw-form-next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0.7rem 1.6rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--tw-form_accent_color, #2563eb);
    color: #ffffff;
    font-size: 0.925rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
    transition: all 0.2s ease;
}

.tw-form-next:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* Submit Button */
.tw-submit-row {
    margin-top: 1.5rem;
}

.tw-btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 52px;
    padding: 0.9rem 1.75rem;
    border: none;
    border-radius: 10px;
    background: var(--tw-form_btn_color, #facc15);
    color: #000000;
    font-weight: 700;
    font-size: 1.025rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.tw-btn-submit:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.tw-btn-submit:active {
    transform: translateY(0);
}

.tw-btn-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.tw-btn-icon {
    display: inline-flex;
    align-items: center;
    animation: none !important;
    transform: none !important;
}

.tw-btn-icon svg {
    display: block;
    animation: none !important;
    transform: none !important;
}

.tw-btn-spinner {
    display: inline-flex;
    align-items: center;
}

.tw-btn-spinner[hidden],
.tw-btn-icon[hidden] {
    display: none !important;
}

.tw-spinner-circle {
    display: block;
    animation: twSpin 0.75s linear infinite;
}

@keyframes twSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Alerts */
.tw-alert {
    padding: 0.9rem 1.25rem;
    border-radius: 10px;
    font-size: 0.925rem;
    font-weight: 500;
    margin-bottom: 1.75rem;
    line-height: 1.5;
}

.tw-alert--error {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.tw-alert--success {
    background-color: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

/* Success Modal */
.tw-modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999999 !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1.5rem !important;
    box-sizing: border-box !important;
    animation: twModalFadeIn 0.25s ease-out;
}

.tw-modal-overlay.is-active,
.tw-modal-overlay.show,
.tw-modal-overlay.tw-visible {
    display: flex !important;
}

.tw-modal-card {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    padding: 2.75rem 2.25rem 2.25rem;
    max-width: 460px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.25);
    box-sizing: border-box;
    animation: twModalZoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tw-modal-success-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: #ecfdf5;
    color: #059669;
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 8px #f0fdf4;
}

.tw-modal-card h2 {
    color: #0f172a;
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 0.65rem 0;
    letter-spacing: -0.01em;
}

.tw-modal-message {
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0 0 1.25rem 0;
}

.tw-modal-ref-card {
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin: 1.25rem 0 1.5rem 0;
}

.tw-modal-ref-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.tw-modal-ref-val-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.tw-modal-ref-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--tw-form_accent_color, #1e40af);
    letter-spacing: 0.05em;
}

.tw-copy-ref-btn {
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s;
}

.tw-copy-ref-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.tw-copy-ref-btn.is-copied {
    background: #dcfce7;
    color: #15803d;
    border-color: #86efac;
}

.tw-modal-btn {
    width: 100%;
    min-height: 48px;
    border-radius: 10px;
    background: var(--tw-form_accent_color, #2563eb);
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: filter 0.2s, transform 0.2s;
}

.tw-modal-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

@keyframes twModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes twModalZoomIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   Responsive Breakpoints: Desktop -> Tablet -> Mobile
   ========================================================================== */

/* Tablet & Intermediate Screens (<= 920px) */
@media (max-width: 920px) {
    .tw-apply-card {
        padding: 2.25rem 2rem;
    }

    .tw-col-6 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Tablet Screens (<= 768px) */
@media (max-width: 768px) {
    .tw-apply-section {
        padding: 2rem 1rem;
    }

    .tw-apply-card {
        padding: 2rem 1.5rem;
        border-radius: 14px;
    }

    .tw-apply-title {
        font-size: 1.8rem;
    }

    .tw-col-2,
    .tw-col-3 {
        grid-template-columns: 1fr;
    }

    .tw-col-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tw-col-6 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .tw-form-section-title {
        margin: 1.5rem 0 1rem 0;
        font-size: 0.925rem;
        padding: 0.65rem 0.9rem;
    }

    .tw-review-summary dl {
        grid-template-columns: 1fr;
    }
}

/* Mobile Screens (<= 640px) */
@media (max-width: 640px) {
    .tw-apply-section {
        padding: 1.25rem 0.65rem;
    }

    .tw-apply-card {
        padding: 1.5rem 1rem;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }

    .tw-apply-header {
        margin-bottom: 1.5rem;
    }

    .tw-apply-title {
        font-size: 1.5rem;
    }

    .tw-apply-subtitle {
        font-size: 0.9rem;
    }

    .tw-form-progress {
        gap: 0.35rem;
        padding: 0.35rem;
    }

    .tw-form-progress li {
        font-size: 0.785rem;
        padding: 0.5rem 0.35rem;
    }

    .tw-form-row {
        gap: 0.9rem;
        margin-bottom: 0.9rem;
    }

    .tw-col-2,
    .tw-col-3 {
        grid-template-columns: 1fr;
    }

    .tw-col-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tw-col-6 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tw-input,
    .tw-select {
        height: 44px !important;
        min-height: 44px !important;
        font-size: 0.9rem !important;
    }

    .tw-file-dropzone {
        padding: 1.25rem 0.85rem;
    }

    .tw-file-drop-main {
        font-size: 0.875rem;
    }

    .tw-file-drop-hint {
        font-size: 0.75rem;
    }

    .tw-form-step-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .tw-form-back,
    .tw-form-next {
        width: 100%;
    }

    .tw-btn-submit {
        font-size: 0.95rem;
        padding: 0.85rem 1.25rem;
    }
}

/* Small Mobile (<= 400px) */
@media (max-width: 400px) {
    .tw-col-4,
    .tw-col-6 {
        grid-template-columns: 1fr;
    }

    .tw-form-progress {
        flex-direction: column;
    }
}
