/**
 * DRTPC Experts Directory — Submission Form Styles
 * 4-step wizard with cascading dropdowns, PDF upload, and premium design.
 * Uses design tokens from directory.css
 *
 * @package DRTPC_Experts_Directory
 */

/* ===== Form Wrapper ===== */
.drtpc-form-wrapper {
    max-width: 780px;
    margin: 0 auto;
    padding: 32px 24px;
    font-family: var(--drtpc-font-family);
    color: var(--drtpc-text-dark);
    -webkit-font-smoothing: antialiased;
}

/* ===== Progress Bar ===== */
.drtpc-form-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 40px;
    padding: 0 10px;
    position: relative;
}

.drtpc-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    z-index: 1;
}

/* Connector line between steps */
.drtpc-progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 18px;
    left: calc(50% + 20px);
    width: calc(100% - 40px);
    height: 3px;
    background: var(--drtpc-border);
    transition: background var(--drtpc-transition-slow);
}

.drtpc-progress-step.completed:not(:last-child)::after {
    background: var(--drtpc-primary);
}

.drtpc-step-number {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--drtpc-bg-light);
    border: 3px solid var(--drtpc-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--drtpc-text-light);
    transition: all var(--drtpc-transition);
    position: relative;
    z-index: 2;
}

.drtpc-progress-step.active .drtpc-step-number {
    background: var(--drtpc-primary);
    border-color: var(--drtpc-primary);
    color: var(--drtpc-text-on-primary);
    box-shadow: 0 0 0 6px rgba(var(--drtpc-primary-rgb), 0.15);
}

.drtpc-progress-step.completed .drtpc-step-number {
    background: var(--drtpc-primary);
    border-color: var(--drtpc-primary);
    color: var(--drtpc-text-on-primary);
}

.drtpc-step-label {
    margin-top: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--drtpc-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color var(--drtpc-transition);
}

.drtpc-progress-step.active .drtpc-step-label {
    color: var(--drtpc-primary);
}

.drtpc-progress-step.completed .drtpc-step-label {
    color: var(--drtpc-primary);
}

/* ===== Steps ===== */
.drtpc-form-step {
    display: none;
    animation: drtpc-fadeInUp 0.35s ease-out;
}

.drtpc-form-step.active {
    display: block;
}

@keyframes drtpc-fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Step Header ===== */
.drtpc-step-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--drtpc-primary-light);
}

.drtpc-step-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--drtpc-text-dark);
    margin: 0 0 6px;
}

.drtpc-step-subtitle {
    font-size: 14px;
    color: var(--drtpc-text-light);
    margin: 0;
    font-weight: 400;
    line-height: 1.5;
}

/* ===== Form Layout ===== */
.drtpc-form-row {
    display: grid;
    gap: 16px;
    margin-bottom: 0;
}

.drtpc-form-row-2col {
    grid-template-columns: 1fr 1fr;
}

/* ===== Form Groups ===== */
.drtpc-form-group {
    margin-bottom: 22px;
}

.drtpc-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--drtpc-text-dark);
    margin-bottom: 8px;
}

.drtpc-required {
    color: #DC3545;
    font-weight: 400;
}

.drtpc-field-hint {
    display: block;
    font-size: 12px;
    color: var(--drtpc-text-light);
    margin-top: 6px;
}

/* ===== Input / Textarea / Select ===== */
.drtpc-input,
.drtpc-textarea,
.drtpc-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--drtpc-border);
    border-radius: 10px;
    font-size: 15px;
    font-family: var(--drtpc-font-family);
    color: var(--drtpc-text-dark);
    background: var(--drtpc-bg-white);
    transition: all var(--drtpc-transition);
    box-sizing: border-box;
}

.drtpc-input::placeholder,
.drtpc-textarea::placeholder {
    color: var(--drtpc-text-light);
}

.drtpc-input:focus,
.drtpc-textarea:focus,
.drtpc-select:focus {
    border-color: var(--drtpc-primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(var(--drtpc-primary-rgb), 0.08);
}

.drtpc-select {
    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='%238A8A9A' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.drtpc-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--drtpc-bg-light);
}

.drtpc-input-small {
    max-width: 160px;
}

.drtpc-input-error {
    border-color: #DC3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

.drtpc-error-message {
    display: block;
    color: #DC3545;
    font-size: 12px;
    margin-top: 6px;
    font-weight: 500;
}

/* ===== Photo Upload ===== */
.drtpc-file-upload {
    position: relative;
    cursor: pointer;
}

.drtpc-file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    top: 0;
    left: 0;
}

.drtpc-file-preview {
    padding: 32px 20px;
    border: 2px dashed var(--drtpc-border);
    border-radius: 12px;
    text-align: center;
    background: var(--drtpc-bg-light);
    transition: all var(--drtpc-transition);
}

.drtpc-file-upload:hover .drtpc-file-preview,
.drtpc-document-upload:hover .drtpc-document-preview {
    border-color: var(--drtpc-primary);
    background: var(--drtpc-primary-light);
}

.drtpc-upload-icon {
    color: var(--drtpc-primary);
    opacity: 0.5;
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    transition: opacity var(--drtpc-transition);
}

.drtpc-file-upload:hover .drtpc-upload-icon,
.drtpc-document-upload:hover .drtpc-upload-icon {
    opacity: 0.85;
}

.drtpc-upload-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--drtpc-text-dark);
    margin: 0 0 4px;
}

.drtpc-upload-hint {
    font-size: 12px;
    color: var(--drtpc-text-light);
    margin: 0;
}

.drtpc-file-preview img {
    border-radius: 50%;
    border: 3px solid var(--drtpc-primary-light);
    max-width: 100px;
}

/* ===== Document (PDF) Upload ===== */
.drtpc-document-upload {
    position: relative;
    cursor: pointer;
}

.drtpc-document-preview {
    padding: 28px 20px;
    border: 2px dashed var(--drtpc-border);
    border-radius: 12px;
    text-align: center;
    background: var(--drtpc-bg-light);
    transition: all var(--drtpc-transition);
}

.drtpc-upload-icon-pdf {
    color: #DC3545;
}

.drtpc-document-upload:hover .drtpc-upload-icon-pdf {
    color: #C82333;
}

/* Uploaded file list */
.drtpc-uploaded-files {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drtpc-uploaded-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--drtpc-bg-light);
    border: 1px solid var(--drtpc-border);
    border-radius: 8px;
    font-size: 13px;
    animation: drtpc-fadeInUp 0.25s ease-out;
}

.drtpc-uploaded-file-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: #FEE2E2;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drtpc-uploaded-file-icon svg {
    width: 16px;
    height: 16px;
    stroke: #DC3545;
}

.drtpc-uploaded-file-name {
    flex: 1;
    font-weight: 500;
    color: var(--drtpc-text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drtpc-uploaded-file-size {
    color: var(--drtpc-text-light);
    font-size: 12px;
    flex-shrink: 0;
}

.drtpc-uploaded-file-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #DC3545;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
    font-weight: 700;
    transition: color var(--drtpc-transition);
}

.drtpc-uploaded-file-remove:hover {
    color: #A71D2A;
}

/* Upload success state */
.drtpc-document-upload.drtpc-upload-success .drtpc-document-preview {
    border-color: #28A745;
    background: #F0FFF4;
}

.drtpc-document-upload.drtpc-upload-success .drtpc-upload-icon-pdf {
    color: #28A745;
}

/* Upload loading state */
.drtpc-document-upload.drtpc-uploading .drtpc-document-preview {
    opacity: 0.6;
    pointer-events: none;
}

.drtpc-upload-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--drtpc-border);
    border-top-color: var(--drtpc-primary);
    border-radius: 50%;
    animation: drtpc-spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes drtpc-spin {
    to { transform: rotate(360deg); }
}

/* ===== Buttons ===== */
.drtpc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--drtpc-btn-radius);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--drtpc-font-family);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--drtpc-transition);
    text-decoration: none;
    line-height: 1.4;
    letter-spacing: 0.2px;
}

.drtpc-btn-next,
.drtpc-btn-submit {
    background: var(--drtpc-primary);
    color: var(--drtpc-text-on-primary);
    border-color: var(--drtpc-primary);
}

.drtpc-btn-next:hover,
.drtpc-btn-submit:hover {
    background: var(--drtpc-primary-hover);
    border-color: var(--drtpc-primary-hover);
    box-shadow: var(--drtpc-shadow-md);
    transform: translateY(-1px);
}

.drtpc-btn-prev {
    background: transparent;
    color: var(--drtpc-text-medium);
    border-color: var(--drtpc-border);
}

.drtpc-btn-prev:hover {
    border-color: var(--drtpc-primary);
    color: var(--drtpc-primary);
}

.drtpc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== Form Actions ===== */
.drtpc-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--drtpc-border-light);
}

/* ===== Form Message ===== */
.drtpc-form-message {
    padding: 16px 20px;
    border-radius: 10px;
    margin-top: 20px;
    font-size: 14px;
    font-weight: 500;
    animation: drtpc-fadeInUp 0.3s ease-out;
}

.drtpc-message-success {
    background: #D4EDDA;
    color: #155724;
    border: 1px solid #C3E6CB;
}

.drtpc-message-error {
    background: #F8D7DA;
    color: #721C24;
    border: 1px solid #F5C6CB;
}

/* ===== Notice (already-registered redirect) ===== */
.drtpc-notice {
    padding: 16px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
}

.drtpc-notice-info {
    background: var(--drtpc-primary-light);
    color: var(--drtpc-primary);
    border: 1px solid rgba(var(--drtpc-primary-rgb), 0.15);
}

.drtpc-notice a {
    font-weight: 600;
    text-decoration: underline;
    color: var(--drtpc-primary);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .drtpc-form-row-2col {
        grid-template-columns: 1fr;
    }

    .drtpc-form-actions {
        flex-direction: column;
        gap: 12px;
    }

    .drtpc-form-actions .drtpc-btn {
        width: 100%;
    }

    .drtpc-progress-step .drtpc-step-label {
        font-size: 10px;
    }

    .drtpc-form-wrapper {
        padding: 20px 16px;
    }
}

/* ===== RTL ===== */
[dir="rtl"] .drtpc-form-wrapper {
    font-family: 'Cairo', 'Euclid Circular B', -apple-system, BlinkMacSystemFont, sans-serif;
}

[dir="rtl"] .drtpc-form-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .drtpc-progress-step:not(:last-child)::after {
    left: auto;
    right: calc(50% + 20px);
}

[dir="rtl"] .drtpc-select {
    background-position: left 14px center;
    padding-right: 16px;
    padding-left: 36px;
}

[dir="rtl"] .drtpc-uploaded-file {
    flex-direction: row-reverse;
}