/**
 * Merchant Authentication Page Styling
 * Login, Register, 2FA pages
 * Redesigned for improved UX, accessibility, and responsiveness
 */

body.merchant-auth-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1f2937;
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

.auth-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    max-width: 100vw;
}

.auth-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: white;
    z-index: 10;
    overflow-y: auto;
    min-height: 100vh;
}

.auth-header {
    text-align: center;
    margin-bottom: 3rem;
    width: 100%;
    max-width: 600px;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.brand-logo i {
    font-size: 3rem;
    color: #667eea;
}

.brand-logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    color: #1f2937;
}

.brand-tagline {
    color: #6b7280;
    font-size: 1rem;
    margin: 1rem 0 0;
}

.auth-form-wrapper {
    width: 100%;
    max-width: 600px;
}

/* Registration Container - Enhanced */
.registration-container {
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
}

.registration-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 2.5rem;
}

.registration-header {
    text-align: center;
    margin-bottom: 2rem;
}

.registration-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.registration-subtitle {
    font-size: 1rem;
    color: #6b7280;
    margin: 0;
}

/* Form Sections */
.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e5e7eb;
}

.form-section:last-of-type {
    border-bottom: none;
    padding-bottom: 1rem;
}

.form-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-section-title i {
    color: #667eea;
    font-size: 1.25rem;
}

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.95rem;
}

.form-label.required::after {
    content: ' *';
    color: #ef4444;
    font-weight: 600;
}

/* Input Wrapper with Icons */
.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
}

.input-wrapper .form-control {
    padding-left: 2.75rem;
}

/* Form Controls */
.form-control,
.auth-form-wrapper input,
.auth-form-wrapper select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: white;
}

.form-control:focus,
.auth-form-wrapper input:focus,
.auth-form-wrapper select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-control.is-invalid {
    border-color: #ef4444;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23ef4444' viewBox='0 0 16 16'%3E%3Cpath d='M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z'/%3E%3Cpath d='M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.5rem) center;
    background-size: calc(0.75em + 0.5rem) calc(0.75em + 0.5rem);
    padding-right: calc(1.5em + 1rem);
}

.form-control.is-invalid:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

/* Form Text (Help Text) */
.form-text {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.4;
}

/* Invalid Feedback */
.invalid-feedback {
    display: none;
    margin-top: 0.375rem;
    font-size: 0.875rem;
    color: #ef4444;
    font-weight: 500;
}

.form-control.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Password Toggle Button */
.toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s ease;
    z-index: 2;
}

.toggle-password:hover {
    color: #667eea;
}

.toggle-password:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Password Strength Indicator */
.password-strength-indicator {
    margin-top: 0.75rem;
}

.strength-bars {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}

.strength-bar {
    flex: 1;
    height: 5px;
    background-color: #e5e7eb;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

.strength-bar.weak {
    background-color: #ef4444;
}

.strength-bar.fair {
    background-color: #f59e0b;
}

.strength-bar.good {
    background-color: #10b981;
}

.strength-bar.strong {
    background-color: #3b82f6;
}

.strength-text {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
}

.strength-text.text-danger {
    color: #ef4444;
}

.strength-text.text-warning {
    color: #f59e0b;
}

.strength-text.text-success {
    color: #10b981;
}

.strength-text.text-strong {
    color: #3b82f6;
}

/* Buttons */
.btn-register,
.auth-form-wrapper button[type="submit"],
.auth-form-wrapper button.btn-primary {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.0625rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(102, 126, 234, 0.3);
}

.btn-register:hover,
.auth-form-wrapper button[type="submit"]:hover,
.auth-form-wrapper button.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a4190 100%);
    box-shadow: 0 6px 12px -2px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.btn-register:active,
.auth-form-wrapper button[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px -1px rgba(102, 126, 234, 0.3);
}

.btn-register:disabled,
.auth-form-wrapper button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-register:focus,
.auth-form-wrapper button[type="submit"]:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.btn-icon {
    font-size: 1.125rem;
}

/* Links */
.auth-form-wrapper a,
.link-primary {
    color: #667eea;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 600;
}

.auth-form-wrapper a:hover,
.link-primary:hover {
    color: #5568d3;
    text-decoration: underline;
}

/* Form Footer */
.form-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

/* Alert Boxes - Enhanced */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    position: relative;
    border: 2px solid transparent;
}

.alert .alert-content {
    flex: 1;
}

.alert .btn-close {
    position: absolute;
    right: 0.75rem;
    top: 0.75rem;
    width: 1.5rem;
    height: 1.5rem;
    opacity: 0.5;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    transition: opacity 0.2s ease;
}

.alert .btn-close:hover {
    opacity: 1;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

.alert-success {
    background-color: #dcfce7;
    color: #15803d;
    border-color: #86efac;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border-color: #fde047;
}

.alert-info {
    background-color: #dbeafe;
    color: #0c4a6e;
    border-color: #7dd3fc;
}

.alert i {
    font-size: 1.125rem;
}

/* Auth Form Actions */
.auth-form-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.auth-form-actions a {
    color: #667eea;
}

.auth-form-toggle {
    margin-top: 1.5rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.9rem;
}

.auth-form-toggle a {
    color: #667eea;
    font-weight: 600;
}

/* 2FA Code Input */
.code-input-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 1.5rem 0;
}

.code-input {
    width: 50px !important;
    height: 50px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
}

.code-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Background Pattern */
.auth-background {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.auth-pattern {
    position: absolute;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    color: #6b7280;
    font-size: 0.85rem;
}

/* Accessibility Improvements */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Visible for Keyboard Navigation */
*:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 992px) {
    .auth-background {
        flex: 0.5;
    }

    .auth-wrapper {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .auth-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .auth-background {
        display: none;
    }

    .auth-wrapper {
        padding: 1.5rem;
        width: 100%;
        min-height: 100vh;
    }

    .registration-card {
        padding: 2rem 1.5rem;
        margin: 0;
    }

    .brand-logo {
        gap: 0.5rem;
    }

    .brand-logo h1 {
        font-size: 2rem;
    }

    .brand-logo i {
        font-size: 2.5rem;
    }

    .auth-header {
        margin-bottom: 2rem;
    }

    .registration-title {
        font-size: 1.625rem;
    }

    .form-section-title {
        font-size: 1rem;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }

    .auth-form-wrapper {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .auth-wrapper {
        padding: 1rem;
        justify-content: flex-start;
        padding-top: 2rem;
    }

    .registration-card {
        padding: 1.5rem 1rem;
        border-radius: 12px;
    }

    .auth-form-wrapper {
        max-width: 100%;
        width: 100%;
    }

    .brand-logo h1 {
        font-size: 1.75rem;
    }

    .brand-logo i {
        font-size: 2rem;
    }

    .registration-title {
        font-size: 1.375rem;
    }

    .registration-subtitle {
        font-size: 0.875rem;
    }

    .form-section {
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
    }

    .form-section-title {
        font-size: 0.95rem;
        gap: 0.5rem;
    }

    .form-section-title i {
        font-size: 1rem;
    }

    .code-input-group {
        gap: 0.25rem;
    }

    .code-input {
        width: 40px !important;
        height: 40px;
        font-size: 1.25rem;
    }

    .btn-register,
    .auth-form-wrapper button[type="submit"] {
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }

    .form-control,
    .auth-form-wrapper input,
    .auth-form-wrapper select {
        padding: 0.75rem 0.875rem;
        font-size: 0.95rem;
    }

    .input-wrapper .form-control {
        padding-left: 2.5rem;
    }

    .form-label {
        font-size: 0.9rem;
    }
}

/* Print Styles */
@media print {
    .auth-background,
    .auth-footer,
    .form-footer {
        display: none;
    }

    .auth-wrapper {
        padding: 0;
    }

    .registration-card {
        box-shadow: none;
    }
}

    color: #667eea;
}

.auth-form-toggle {
    margin-top: 1.5rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.9rem;
}

.auth-form-toggle a {
    color: #667eea;
    font-weight: 600;
}

/* Error & Success Messages */
.auth-form-wrapper .alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-success {
    background-color: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde047;
}

.alert-info {
    background-color: #dbeafe;
    color: #0c4a6e;
    border: 1px solid #7dd3fc;
}

/* Password Strength Indicator */
.password-strength {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background-color: #e5e7eb;
    border-radius: 2px;
}

.strength-bar.weak {
    background-color: #ef4444;
}

.strength-bar.fair {
    background-color: #f59e0b;
}

.strength-bar.good {
    background-color: #10b981;
}

.strength-bar.strong {
    background-color: #3b82f6;
}

.strength-text {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    color: #6b7280;
}

/* 2FA Code Input */
.code-input-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 1.5rem 0;
}

.code-input {
    width: 50px !important;
    height: 50px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.code-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Background Pattern */
.auth-background {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.auth-pattern {
    position: absolute;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    color: #6b7280;
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    .auth-container {
        flex-direction: column;
    }

    .auth-background {
        display: none;
    }

    .auth-wrapper {
        padding: 1rem;
    }

    .brand-logo {
        gap: 0.5rem;
    }

    .brand-logo h1 {
        font-size: 2rem;
    }

    .auth-header {
        margin-bottom: 2rem;
    }
}

@media (max-width: 480px) {
    .auth-form-wrapper {
        max-width: 100%;
    }

    .brand-logo h1 {
        font-size: 1.75rem;
    }

    .brand-logo i {
        font-size: 2.5rem;
    }

    .code-input-group {
        gap: 0.25rem;
    }

    .code-input {
        width: 40px !important;
        height: 40px;
        font-size: 1.25rem;
    }
}
