/* Auth Pages - Clean, Sophisticated Style
 * Matching User Profile Page Design
 */

.auth-page-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Wider variant used for registration pages where forms are long
 * Adds a two-column layout on medium+ screens and keeps login unchanged
 */
.auth-page-container.auth-page-wide {
    max-width: 920px;
}

.auth-page-container.auth-page-wide .auth-card form.auth-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 720px) {
    .auth-page-container.auth-page-wide .auth-card form.auth-form {
        grid-template-columns: 1fr 1fr;
    }

    /* Elements that should span both columns */
    .auth-page-container.auth-page-wide .auth-card form.auth-form .form-group.full-width,
    .auth-page-container.auth-page-wide .auth-card form.auth-form textarea,
    .auth-page-container.auth-page-wide .auth-card form.auth-form input[type="file"],
    .auth-page-container.auth-page-wide .auth-card form.auth-form .form-actions,
    .auth-page-container.auth-page-wide .auth-card form.auth-form .btn-block,
    .auth-page-container.auth-page-wide .auth-card form.auth-form .auth-footer,
    .auth-page-container.auth-page-wide .auth-card form.auth-form .section-title {
        grid-column: 1 / -1;
    }

    /* Ensure radio groups are horizontal on wider registration layout */
    .auth-page-container.auth-page-wide .radio-group {
        flex-direction: row;
        align-items: center;
    }

    /* Allow grouping two related form-groups into a single logical row
     * Use <div class="form-row"> with two .form-group children in views
     * so they appear side-by-side and maintain responsive stacking.
     */
    .auth-page-container.auth-page-wide .auth-card form.auth-form .form-row {
        display: contents;
    }

    /* Agreement column: right-side column in factory photos row */
    .auth-page-container.auth-page-wide .auth-card .agreement-column {
        display: block;
        padding-left: 1rem;
    }

    .auth-page-container.auth-page-wide .auth-card .agreement-column .checkbox-label {
        align-items: flex-start;
    }

    /* Ensure section titles and pending notices take full width even when outside
     * the form-grid flow. Pending notice is often placed before the form; make
     * it display full-width in the auth card for consistent alignment.
     */
    .auth-page-container.auth-page-wide .auth-card .section-title {
        display: block;
        width: 100%;
        box-sizing: border-box;
        margin-top: 1.5rem;
        margin-bottom: 0.75rem;
    }

    .auth-page-container.auth-page-wide .auth-card .pending-notice {
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 1rem;
    }
}

/* Agreement / checkbox styling */
.auth-card .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: #0f172a;
}
.auth-card .checkbox-label input[type="checkbox"] {
    margin-top: 4px;
}
.auth-card .agreement-text {
    margin-top: 0.5rem;
    color: #475569;
    font-size: 0.95rem;
}
.auth-card .agreement-text a {
    color: #10b981 !important;
    font-weight: 600;
    text-decoration: none !important;
    display: inline !important;
    float: none !important;
}
.auth-card .agreement-text a:hover {
    text-decoration: underline !important;
}

/* Page Header - Gray Gradient */
.auth-page-header {
    background: linear-gradient(135deg, #5a6c7d 0%, #475569 100%);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* Role selection cards (register_select) */
.role-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.role-card {
    display: block;
    padding: 1.5rem 1.25rem;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    background: #4c5b6e;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    position: relative;
    overflow: hidden;
}

.role-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 36px rgba(0,0,0,0.18);
}

.role-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 24px;
    margin: 0 auto 0.75rem auto;
    box-shadow: 0 6px 14px rgba(16,185,129,0.18);
}

.role-title {
    text-align: center;
    color: #10b981;
    font-weight: 700;
    margin: 0.5rem 0 0.25rem 0;
}

.role-desc {
    text-align: center;
    color: rgba(255,255,255,0.9);
    margin-bottom: 0.75rem;
}

.role-features {
    list-style: disc;
    margin: 0.5rem 0 0.75rem 1rem;
    color: rgba(255,255,255,0.9);
}

.role-features li {
    margin-bottom: 0.35rem;
}

.role-cta { margin-top: 0.75rem; }

@media (max-width: 640px) {
    .role-card { padding: 1rem; }
    .role-title { font-size: 1.05rem; }
}

.auth-page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.5rem 0;
}

.auth-page-header p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* Auth Card - White Background */
.auth-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Alert Messages */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.938rem;
    font-weight: 500;
}

.alert-success {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Form Styles */
.auth-form {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    color: #1e293b;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #64748b;
    box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.1);
}

.form-control.error {
    border-color: #ef4444;
}

.form-control::placeholder {
    color: #94a3b8;
}

.form-error {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.875rem;
    color: #ef4444;
    font-weight: 500;
}

/* Form Actions */
.form-actions {
    margin-top: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(71, 85, 105, 0.2);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(71, 85, 105, 0.3);
}

.btn-block {
    width: 100%;
}

/* Auth Divider */
.auth-divider {
    position: relative;
    text-align: center;
    margin: 1.5rem 0;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e2e8f0;
}

.auth-divider span {
    position: relative;
    display: inline-block;
    padding: 0 1rem;
    background: #ffffff;
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

/* Auth Footer */
.auth-footer {
    text-align: center;
}

.auth-footer p {
    font-size: 0.938rem;
    color: #64748b;
    margin: 0 0 1rem 0;
}

.auth-footer a {
    color: #10b981;
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Registration Specific Styles */
.registration-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
}

.step-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #94a3b8;
    font-weight: 500;
}

.step-indicator.active {
    color: #10b981;
    font-weight: 600;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.875rem;
}

.step-indicator.active .step-number {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
}

.step-indicator.completed .step-number {
    background: #dcfce7;
    color: #15803d;
}

/* Section titles used inside auth cards (Company Information, Location, etc.) */
.section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin: 1.5rem 0 0.75rem 0;
}

/* Pending / notice box for manufacturer registration */
.pending-notice {
    background: #fff9ed;
    border: 1px solid #ffecb5;
    color: #856404;
    padding: 1rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.pending-notice h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 1rem;
}

.radio-option {
    flex: 1;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-option label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #475569;
}

.radio-option input[type="radio"]:checked + label {
    border-color: #10b981;
    background: #dcfce7;
    color: #15803d;
}

/* Form Navigation */
.form-navigation {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-back {
    background: transparent;
    border: 2px solid #e2e8f0;
    color: #475569;
}

.btn-back:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* Checkbox Group */
.checkbox-group {
    margin-top: 1rem;
}

.checkbox-option {
    margin-bottom: 0.75rem;
}

.checkbox-option label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.938rem;
    color: #475569;
    cursor: pointer;
}

.checkbox-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
}

/* Strong overrides for auth card inputs to prevent global rules from constraining width */
.auth-card .form-group {
    width: 100%;
}

.auth-card .form-control {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Responsive Design */
@media (max-width: 640px) {
    .auth-page-container {
        margin: 1rem auto;
    }
    
    .auth-page-header {
        padding: 1.5rem;
    }
    
    .auth-page-header h1 {
        font-size: 1.5rem;
    }
    
    .auth-card {
        padding: 1.5rem;
    }
    
    .radio-group {
        flex-direction: column;
    }
    
    .registration-steps {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}
