/**
 * Signup Wizard Styles
 * Modern, friction-reduced multi-step registration UI
 */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --success-color: #10b981;
    --error-color: #ef4444;
    --border-color: #e5e7eb;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ===== MAIN CONTAINER ===== */

.signup-wizard-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px;
    direction: rtl;
}

@media (max-width: 640px) {
    .signup-wizard-container {
        padding: 20px 16px;
    }
}

/* ===== PROGRESS INDICATOR ===== */

.wizard-progress {
    margin-bottom: 50px;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 8px;
}

.progress-steps .step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.progress-steps .step.active,
.progress-steps .step:not(:nth-child(n+2)) {
    opacity: 1;
}

.progress-steps .step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.progress-steps .step.active .step-number {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.progress-steps .step-title {
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
    line-height: 1.2;
}

.progress-steps .step.active .step-title {
    color: var(--text-dark);
    font-weight: 500;
}

@media (max-width: 640px) {
    .progress-steps .step-title {
        font-size: 10px;
    }
    
    .progress-steps .step-number {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
}

.progress-bar {
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== WIZARD FORM ===== */

.wizard-form {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-md);
}

@media (max-width: 640px) {
    .wizard-form {
        padding: 24px;
    }
}

.wizard-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.wizard-step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 12px;
}

.step-description {
    color: var(--text-light);
    margin: 0 0 32px;
    font-size: 14px;
}

/* ===== FORM ELEMENTS ===== */

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-control,
.otp-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    color: var(--text-dark);
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-control:focus,
.otp-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder {
    color: var(--text-light);
}

.helper-text {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    margin-top: 6px;
}

.divider {
    text-align: center;
    margin: 24px 0 16px;
    color: var(--text-light);
    font-size: 14px;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    height: 1px;
    background: var(--border-color);
    transform: translateY(-50%);
}

.divider {
    background: white;
    padding: 0 12px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

/* ===== PASSWORD FIELD ===== */

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .form-control {
    padding-left: 44px;
}

.btn-toggle-password {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: color 0.2s ease;
}

.btn-toggle-password:hover {
    color: var(--text-dark);
}

.password-toggle-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.password-toggle-icon svg {
    width: 20px;
    height: 20px;
    display: block;
    fill: currentColor;
}

/* ===== PASSWORD REQUIREMENTS ===== */

.password-requirements {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.requirement {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-light);
    transition: color 0.2s ease;
}

.requirement .icon-check {
    color: var(--error-color);
    opacity: 0.3;
}

.requirement.met {
    color: var(--success-color);
}

.requirement.met .icon-check {
    color: var(--success-color);
    opacity: 1;
}

/* ===== CHECKBOX ===== */

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 400;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* ===== OTP INPUT ===== */

.otp-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.otp-input {
    flex: 1;
    font-size: 32px;
    text-align: center;
    font-weight: 700;
    letter-spacing: 8px;
    padding: 16px 12px;
}

.btn-verify-otp {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-verify-otp:hover {
    background: var(--primary-dark);
}

.btn-verify-otp:active {
    transform: scale(0.98);
}

.otp-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.timer {
    color: var(--text-light);
}

.btn-resend {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 500;
    transition: color 0.2s ease;
}

.btn-resend:hover:not(:disabled) {
    color: var(--primary-dark);
}

.btn-resend:disabled {
    color: var(--text-light);
    cursor: not-allowed;
}

/* ===== PROFILE PICTURE UPLOAD ===== */

.profile-picture-upload {
    margin: 24px 0;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--text-light);
}

.upload-area p {
    margin: 0;
    color: var(--text-dark);
}

.upload-area small {
    color: var(--text-light);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 500;
    text-decoration: underline;
    padding: 0;
}

.btn-link:hover {
    color: var(--primary-dark);
}

.image-preview {
    position: relative;
    margin-top: 20px;
}

.image-preview img {
    width: 100%;
    max-width: 300px;
    height: 300px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    display: block;
    margin: 0 auto;
}

.btn-remove {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s ease;
}

.btn-remove:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* ===== USERNAME INPUT ===== */

.username-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.username-prefix {
    position: absolute;
    right: 16px;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 16px;
}

.username-input-wrapper .form-control {
    padding-right: 32px;
    padding-left: 44px;
}

.username-status {
    position: absolute;
    left: 12px;
    font-size: 20px;
    display: none;
    animation: fadeIn 0.3s ease;
}

.username-status.valid {
    display: block;
    color: var(--success-color);
}

.username-status.invalid {
    display: block;
    color: var(--error-color);
}

.username-status.loading {
    display: block;
    color: var(--primary-color);
}

.username-status.error {
    display: block;
    color: var(--error-color);
}

/* Spinner animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* ===== SUGGESTED USERNAMES ===== */

.suggested-usernames {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

.suggested-usernames p {
    margin: 0 0 12px;
    font-weight: 500;
    font-size: 14px;
}

.suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-item {
    background: white;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.suggestion-item:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

/* ===== FOLLOW SUGGESTIONS ===== */

.suggestions-container {
    margin: 24px 0;
}

.suggestion-card {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.suggestion-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.user-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: flex-start;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--border-color);
}

.user-info h4 {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.user-info p {
    margin: 0;
    font-size: 13px;
    color: var(--text-light);
}

.user-bio {
    font-size: 13px;
    color: var(--text-light);
    margin: 0 0 12px;
    line-height: 1.4;
}

.user-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.followers {
    font-size: 12px;
    color: var(--text-light);
}

.btn-follow {
    padding: 6px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-follow:hover {
    background: var(--primary-dark);
}

.btn-follow.btn-success {
    background: var(--success-color);
    border-color: var(--success-color);
}

/* ===== CROPPER MODAL ===== */

.cropper-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.cropper-modal__backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(15, 23, 42, 0.56);
    backdrop-filter: blur(4px);
}

.cropper-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(720px, 96vw);
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 18px;
}

.cropper-modal__header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-dark);
}

.cropper-modal__header p {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--text-light);
}

.cropper-viewport {
    position: relative;
    margin-top: 14px;
    width: min(420px, 100%);
    aspect-ratio: 1 / 1;
    height: auto;
    min-height: 280px;
    border-radius: var(--radius-md);
    background: #0f172a;
    overflow: hidden;
    margin-left: auto;
    margin-right: auto;
    cursor: grab;
    touch-action: none;
}

.cropper-viewport.is-dragging {
    cursor: grabbing;
}

.cropper-viewport img {
    position: absolute;
    z-index: 1;
    max-width: 100%;
    display: block;
    pointer-events: auto;
    user-select: none;
    -webkit-user-drag: none;
}

.cropper-viewport cropper-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #0f172a;
}

.cropper-viewport cropper-selection {
    outline: 2px solid rgba(59, 130, 246, 0.95);
    outline-offset: -1px;
}

.cropper-viewport cropper-grid {
    border-color: rgba(255, 255, 255, 0.45);
}

.cropper-viewport cropper-handle {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #2563eb;
}

.cropper-viewport cropper-handle[action="move"] {
    opacity: 0.2;
}

.cropper-toolbar {
    position: relative;
    z-index: 3;
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cropper-zoom-wrap {
    position: relative;
    z-index: 3;
    margin-top: 12px;
}

.cropper-zoom-wrap label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-light);
}

.cropper-zoom-wrap input[type="range"] {
    width: 100%;
}

.cropper-container img {
    max-width: none !important;
    display: block !important;
}

.cropper-actions {
    position: relative;
    z-index: 3;
    margin-top: 16px;
}

/* ===== BUTTONS ===== */

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

.btn-default {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-default:hover:not(:disabled) {
    background: var(--primary-light);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

/* ===== ALERTS ===== */

.alert {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-danger {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-success {
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert .close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 20px;
    padding: 0 4px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.alert .close:hover {
    opacity: 1;
}

/* ===== LOADING STATE ===== */

.btn-loader {
    width: 20px;
    height: 20px;
}

.loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 640px) {
    .form-actions {
        flex-direction: column-reverse;
    }
    
    .btn {
        width: 100%;
    }
    
    .password-requirements {
        grid-template-columns: 1fr;
    }
    
    .otp-input-group {
        flex-direction: column;
    }
    
    .btn-verify-otp {
        width: 100%;
    }
}

/* ===== RTL SUPPORT ===== */

*[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

*[dir="rtl"] .password-input-wrapper .form-control {
    padding-right: 44px;
    padding-left: 16px;
}

*[dir="rtl"] .btn-toggle-password {
    left: auto;
    right: 12px;
}

*[dir="rtl"] .username-input-wrapper .form-control {
    padding-left: 44px;
    padding-right: 32px;
}

*[dir="rtl"] .username-prefix {
    left: auto;
    right: 16px;
}

*[dir="rtl"] .username-status {
    left: auto;
    right: 12px;
}

*[dir="rtl"] .btn-remove {
    left: auto;
    right: 12px;
}

*[dir="rtl"] .user-header {
    flex-direction: row-reverse;
}

*[dir="rtl"] .user-footer {
    flex-direction: row-reverse;
}
