/**
 * WPCrypto Login Form - Minimal & Responsive
 * WordPress theme compatible design with MFA support
 */

/* Base Container - Single layer structure */
.wpcrypto-login-form {
    width: 99%;
    max-width: 420px;
    margin: 20px auto;
    padding: 0 3px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    box-sizing: border-box;
}

.wpcrypto-login-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 12px 12px 0 0;
}

/* Header Section */
.login-header {
    text-align: center;
    padding: 24px 16px 20px;
}

.login-header .brand-logo img {
    max-height: 48px;
    width: auto;
    margin-bottom: 16px;
}

.login-header .brand-text {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 16px 0;
    line-height: 1.2;
}

.login-header .main-title {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.login-header .subtitle {
    font-size: 16px;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* Messages */
.login-messages {
    margin: 0 16px 20px;
}

.message-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid;
    margin-bottom: 12px;
    animation: slideIn 0.3s ease-out;
}

.error-container {
    background: #fef2f2;
    border-color: #ef4444;
    color: #dc2626;
}

.success-container {
    background: #f0fdf4;
    border-color: #22c55e;
    color: #16a34a;
}

.message-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
}

.message-text {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    margin: 0;
}

/* Form Steps */
.form-step {
    animation: fadeIn 0.3s ease-out;
}

.form-step[style*="display: none"] {
    display: none !important;
}

/* Form Fields */
.login-fields {
    padding: 0 16px;
}

.field-group {
    margin-bottom: 24px;
}

.field-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.label-required {
    color: #ef4444;
}

/* Input Styling */
.input-wrapper {
    position: relative;
    width: 100%;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    z-index: 2;
    pointer-events: none;
}

.form-input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    font-size: 16px;
    color: #1f2937;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
    margin: 0;
}

.form-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input:hover:not(:focus) {
    border-color: #d1d5db;
}

.form-input::placeholder {
    color: #9ca3af;
}

.form-input.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Password Toggle */
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: #6b7280;
}

.password-toggle:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Checkbox Styles */
.checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.custom-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    user-select: none;
}

.checkbox-box {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 2px;
}

.checkbox-icon {
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
    color: #ffffff;
    width: 12px;
    height: 12px;
}

.custom-checkbox:checked + .checkbox-label .checkbox-box {
    background: #667eea;
    border-color: #667eea;
}

.custom-checkbox:checked + .checkbox-label .checkbox-box .checkbox-icon {
    opacity: 1;
    transform: scale(1);
}

.custom-checkbox:focus + .checkbox-label .checkbox-box {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkbox-text {
    color: #4b5563;
}

.error-message {
    font-size: 12px;
    color: #ef4444;
    margin-top: 6px;
}

/* Captcha Section */
.captcha-section {
    margin: 24px 16px;
}

.captcha-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

.slider-captcha {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}

.slider-track {
    position: relative;
    height: 48px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 24px;
    overflow: hidden;
    cursor: pointer;
}

.slider-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #22c55e, #3b82f6);
    transition: width 0.3s ease;
    border-radius: 24px;
}

.slider-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    user-select: none;
    pointer-events: none;
    z-index: 1;
}

.slider-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 40px;
    height: 40px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
    z-index: 2;
}

.slider-thumb:hover {
    transform: scale(1.05);
}

.slider-thumb:active {
    cursor: grabbing;
}

.slider-icon {
    color: #9ca3af;
    width: 20px;
    height: 20px;
}

.slider-captcha.verified .slider-text {
    color: #ffffff;
}

.slider-captcha.verified .slider-thumb {
    background: #22c55e;
}

.slider-captcha.verified .slider-icon {
    color: #ffffff;
}

/* MFA Progress Section */
.mfa-progress {
    background: #dbeafe;
    border: 2px solid #3b82f6;
    border-radius: 8px;
    padding: 16px;
    margin: 0 16px 20px;
}

.progress-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.progress-icon {
    width: 32px;
    height: 32px;
    color: #3b82f6;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 4px 0;
}

.progress-content p {
    font-size: 14px;
    color: #4b5563;
    margin: 0;
}

.progress-bar {
    height: 6px;
    background: #ffffff;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #667eea);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

/* MFA Content */
.mfa-content {
    padding: 0 16px;
    margin-bottom: 20px;
}

.wpcrypto-mfa-step {
    animation: fadeIn 0.3s ease-out;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    color: #1f2937;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

.form-group input[type="text"]:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.help-text {
    font-size: 12px;
    color: #6b7280;
    margin-top: 6px;
    line-height: 1.4;
}

/* Image Grid for Security Image Selection */
.image-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.image-option {
    position: relative;
}

.image-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.image-option label {
    display: block;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    background: #ffffff;
    box-sizing: border-box;
}

.image-option label img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
}

.image-option input[type="radio"]:checked + label,
.image-option.selected label {
    border-color: #667eea;
    background-color: #f0f4ff;
    transform: scale(1.05);
}

.image-option label:hover {
    border-color: #cbd5e1;
    transform: scale(1.02);
}

.image-option input[type="radio"]:focus + label {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Submit Section */
.submit-section {
    margin: 24px 16px;
}

.submit-btn {
    width: 100%;
    min-height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.submit-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
}

.btn-icon {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.submit-btn:hover:not(:disabled) .btn-icon {
    transform: translateX(2px);
}

.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

/* MFA Actions */
.mfa-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 24px 16px;
}

.link-btn {
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    color: #6b7280;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-sizing: border-box;
}

.link-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #374151;
}

.link-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.link-btn svg {
    width: 16px;
    height: 16px;
}

/* Footer */
.login-footer {
    padding: 20px 16px 24px;
    border-top: 1px solid #f3f4f6;
    text-align: center;
}

.auth-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
    font-size: 14px;
    flex-wrap: wrap;
}

.link-primary,
.link-secondary {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 6px 8px;
    border-radius: 4px;
}

.link-primary {
    color: #667eea;
}

.link-primary:hover {
    color: #5a6fd8;
    background: #f0f4ff;
}

.link-secondary {
    color: #6b7280;
}

.link-secondary:hover {
    color: #374151;
    background: #f9fafb;
}

.link-primary:focus,
.link-secondary:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.link-primary svg,
.link-secondary svg {
    width: 14px;
    height: 14px;
}

.separator {
    color: #d1d5db;
    font-weight: 300;
}

/* Security Features */
.security-features {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.feature-item:hover {
    background: #f3f4f6;
}

.feature-icon {
    width: 32px;
    height: 32px;
    color: #667eea;
    background: #ffffff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.feature-content h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 2px 0;
}

.feature-content p {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}

/* Logged In State */
.wpcrypto-logged-in-wrapper {
    width: 99%;
    max-width: 420px;
    margin: 40px auto;
    padding: 0 3px;
    box-sizing: border-box;
}

.wpcrypto-logged-in-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 32px 24px;
    text-align: center;
}

.logged-in-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    color: #22c55e;
    background: #f0fdf4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wpcrypto-logged-in-container h2 {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 12px 0;
}

.wpcrypto-logged-in-container p {
    font-size: 16px;
    color: #64748b;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.dashboard-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.dashboard-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (min-width: 480px) {
    .wpcrypto-login-form {
        width: 95%;
        padding: 0 8px;
    }
    
    .login-header {
        padding: 32px 24px 24px;
    }
    
    .login-fields {
        padding: 0 24px;
    }
    
    .captcha-section,
    .submit-section {
        margin-left: 24px;
        margin-right: 24px;
    }
    
    .mfa-progress {
        margin-left: 24px;
        margin-right: 24px;
    }
    
    .mfa-content {
        padding: 0 24px;
    }
    
    .mfa-actions {
        margin-left: 24px;
        margin-right: 24px;
    }
    
    .login-footer {
        padding: 24px 24px 32px;
    }
    
    .security-features {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    
    .feature-item {
        flex-direction: column;
        text-align: center;
        padding: 16px;
    }
    
    .mfa-actions {
        flex-direction: row;
        gap: 16px;
    }
    
    .auth-links {
        gap: 24px;
    }
    
    .image-grid {
        gap: 12px;
    }
    
    .image-option label img {
        width: 40px;
        height: 40px;
    }
}

@media (min-width: 768px) {
    .wpcrypto-login-form {
        width: 90%;
        max-width: 480px;
        padding: 0 12px;
    }
    
    .login-header .main-title {
        font-size: 32px;
    }
    
    .login-header .subtitle {
        font-size: 18px;
    }
}

@media (min-width: 1024px) {
    .wpcrypto-login-form {
        width: 85%;
        max-width: 520px;
        padding: 0 16px;
    }
}

/* Mobile Specific */
@media (max-width: 479px) {
    .auth-links {
        flex-direction: column;
        gap: 12px;
    }
    
    .separator {
        display: none;
    }
    
    .mfa-actions {
        flex-direction: column;
    }
    
    .image-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    
    .image-option label img {
        width: 28px;
        height: 28px;
    }
    
    .image-option label {
        padding: 8px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .wpcrypto-login-form {
        background: #1e293b;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    }
    
    .login-header .brand-text,
    .login-header .main-title {
        color: #f8fafc;
    }
    
    .login-header .subtitle {
        color: #cbd5e1;
    }
    
    .field-label {
        color: #e2e8f0;
    }
    
    .form-input,
    .form-group input[type="text"] {
        background: #334155;
        border-color: #475569;
        color: #f1f5f9;
    }
    
    .form-input:focus,
    .form-group input[type="text"]:focus {
        border-color: #667eea;
        background: #334155;
    }
    
    .form-input::placeholder {
        color: #94a3b8;
    }
    
    .slider-captcha {
        background: #334155;
        border-color: #475569;
    }
    
    .slider-track {
        background: #475569;
        border-color: #64748b;
    }
    
    .checkbox-box {
        background: #334155;
        border-color: #64748b;
    }
    
    .checkbox-text {
        color: #cbd5e1;
    }
    
    .mfa-progress {
        background: rgba(59, 130, 246, 0.1);
        border-color: #3b82f6;
    }
    
    .progress-content h3 {
        color: #f1f5f9;
    }
    
    .progress-content p {
        color: #94a3b8;
    }
    
    .image-option label {
        background: #334155;
        border-color: #64748b;
    }
    
    .image-option input[type="radio"]:checked + label,
    .image-option.selected label {
        background-color: rgba(102, 126, 234, 0.2);
    }
    
    .link-btn {
        background: #334155;
        border-color: #475569;
        color: #cbd5e1;
    }
    
    .link-btn:hover {
        background: #475569;
        border-color: #64748b;
        color: #f1f5f9;
    }
    
    .feature-item {
        background: #334155;
    }
    
    .feature-item:hover {
        background: #475569;
    }
    
    .feature-content h4 {
        color: #f1f5f9;
    }
    
    .feature-content p {
        color: #94a3b8;
    }
    
    .login-footer {
        border-top-color: #475569;
    }
    
    .link-secondary {
        color: #94a3b8;
    }
    
    .link-secondary:hover {
        color: #f1f5f9;
        background: #475569;
    }
    
    .wpcrypto-logged-in-container {
        background: #1e293b;
    }
    
    .wpcrypto-logged-in-container h2 {
        color: #f8fafc;
    }
    
    .wpcrypto-logged-in-container p {
        color: #cbd5e1;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .form-input,
    .form-group input[type="text"],
    .submit-btn {
        min-height: 44px;
    }
    
    .checkbox-box {
        width: 24px;
        height: 24px;
    }
    
    .slider-thumb {
        width: 42px;
        height: 42px;
    }
    
    .image-option label {
        min-height: 48px;
    }
    
    .submit-btn:hover {
        transform: none;
    }
    
    .feature-item:hover {
        background: #f9fafb;
    }
    
    .dashboard-btn:hover {
        transform: none;
    }
    
    .image-option label:hover {
        transform: scale(1);
    }
    
    .image-option input[type="radio"]:checked + label {
        transform: scale(1);
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .form-input,
    .form-group input[type="text"] {
        border-width: 3px;
    }
    
    .submit-btn {
        border: 2px solid transparent;
    }
    
    .checkbox-box {
        border-width: 3px;
    }
    
    .image-option label {
        border-width: 3px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
    }
}