/**
 * MK Directory User Management Styles
 * 
 * Modern, responsive styling for registration, login, and user dashboard
 * components with smooth animations and accessibility features.
 * 
 * @package MK_Directory
 * @since 1.2.0
 */

/* ==========================================================================
   Authentication Forms Base Styles
   ========================================================================== */

.mk-auth-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.mk-auth-form {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 32px;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.mk-auth-form:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.mk-auth-form h2 {
    color: #1f2937;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
}

.mk-auth-form .form-subtitle {
    color: #6b7280;
    font-size: 14px;
    text-align: center;
    margin-bottom: 24px;
}

/* ==========================================================================
   Form Fields
   ========================================================================== */

.mk-field-group {
    margin-bottom: 20px;
    position: relative;
}

.mk-field-group label {
    display: block;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    transition: color 0.2s ease;
}

.mk-field-group.has-error label {
    color: #dc2626;
}

.mk-field-group input,
.mk-field-group select,
.mk-field-group textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.mk-field-group input:focus,
.mk-field-group select:focus,
.mk-field-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.mk-field-group input.error,
.mk-field-group select.error,
.mk-field-group textarea.error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.mk-field-group.has-error input,
.mk-field-group.has-error select,
.mk-field-group.has-error textarea {
    border-color: #dc2626;
}

/* Password field with toggle */
.mk-password-field {
    position: relative;
}

.mk-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6b7280;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mk-password-toggle:hover {
    color: #374151;
    background: #f3f4f6;
}

/* ==========================================================================
   Password Strength Meter
   ========================================================================== */

.password-strength-meter {
    margin-top: 8px;
}

.strength-bar {
    height: 4px;
    border-radius: 2px;
    background: #e5e7eb;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.strength-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.strength-bar.weak::after {
    background: linear-gradient(90deg, #ef4444, #f87171);
    width: 33%;
}

.strength-bar.medium::after {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    width: 66%;
}

.strength-bar.strong::after {
    background: linear-gradient(90deg, #10b981, #34d399);
    width: 85%;
}

.strength-bar.very-strong::after {
    background: linear-gradient(90deg, #059669, #10b981);
    width: 100%;
}

.strength-text {
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}

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

.strength-bar.medium + .strength-text {
    color: #f59e0b;
}

.strength-bar.strong + .strength-text {
    color: #10b981;
}

.strength-bar.very-strong + .strength-text {
    color: #059669;
}

/* ==========================================================================
   Form Validation & Error Messages
   ========================================================================== */

.field-error {
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    animation: slideDown 0.3s ease;
}

.field-error::before {
    content: '⚠';
    margin-right: 4px;
    font-size: 10px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Messages
   ========================================================================== */

.mk-messages {
    margin-bottom: 20px;
}

.mk-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    animation: fadeInUp 0.3s ease;
}

.mk-message::before {
    margin-right: 8px;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.mk-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.mk-success::before {
    content: '✓';
    color: #10b981;
}

.mk-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.mk-error::before {
    content: '✕';
    color: #ef4444;
}

.mk-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.mk-info::before {
    content: 'ℹ';
    color: #3b82f6;
}

.mk-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fed7aa;
}

.mk-warning::before {
    content: '⚠';
    color: #f59e0b;
}

.mk-message ul {
    margin: 8px 0 0 0;
    padding-left: 16px;
}

.mk-message li {
    margin-bottom: 4px;
}

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

/* Global messages */
.mk-global-message {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 300px;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.mk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    min-height: 48px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.mk-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.mk-btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.mk-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.mk-btn-secondary {
    background: #f8fafc;
    color: #475569;
    border: 2px solid #e2e8f0;
}

.mk-btn-secondary:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.mk-btn.loading {
    color: transparent;
}

.mk-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ==========================================================================
   Checkbox & Radio Styles
   ========================================================================== */

.mk-checkbox-group,
.mk-radio-group {
    display: flex;
    align-items: flex-start;
    margin: 12px 0;
}

.mk-checkbox-group input[type="checkbox"],
.mk-radio-group input[type="radio"] {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    margin-top: 2px;
    flex-shrink: 0;
}

.mk-checkbox-group label,
.mk-radio-group label {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 0;
    cursor: pointer;
}

.mk-checkbox-group a,
.mk-radio-group a {
    color: #3b82f6;
    text-decoration: none;
}

.mk-checkbox-group a:hover,
.mk-radio-group a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Form Toggle & Social Login
   ========================================================================== */

.mk-form-toggle {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.mk-form-toggle a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.mk-form-toggle a:hover {
    text-decoration: underline;
}

.mk-social-login-section {
    margin: 24px 0;
}

.mk-social-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: #6b7280;
    font-size: 14px;
}

.mk-social-divider::before,
.mk-social-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.mk-social-divider::before {
    margin-right: 16px;
}

.mk-social-divider::after {
    margin-left: 16px;
}

.mk-social-buttons {
    display: flex;
    gap: 12px;
}

.mk-social-login {
    flex: 1;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mk-social-login:hover {
    border-color: #d1d5db;
    background: #f9fafb;
    transform: translateY(-1px);
}

.mk-social-login i {
    margin-right: 8px;
    font-size: 18px;
}

.mk-social-login.google {
    border-color: #ea4335;
    color: #ea4335;
}

.mk-social-login.facebook {
    border-color: #1877f2;
    color: #1877f2;
}

/* ==========================================================================
   Verification Instructions
   ========================================================================== */

.mk-verification-instructions {
    margin-top: 20px;
    text-align: center;
}

.mk-verification-instructions h3 {
    margin: 0 0 12px 0;
    color: #1f2937;
    font-size: 18px;
}

.mk-verification-instructions p {
    margin: 8px 0;
    color: #6b7280;
    line-height: 1.5;
}

.mk-resend-verification {
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
    padding: 0;
}

.mk-resend-verification:hover {
    color: #2563eb;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 480px) {
    .mk-auth-container {
        padding: 16px;
    }
    
    .mk-auth-form {
        padding: 24px 20px;
    }
    
    .mk-field-group input,
    .mk-field-group select,
    .mk-field-group textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .mk-social-buttons {
        flex-direction: column;
    }
    
    .mk-global-message {
        right: 16px;
        left: 16px;
        max-width: none;
    }
}

/* ==========================================================================
   User Dashboard Styles
   ========================================================================== */

.mk-user-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.mk-dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 32px;
    border-radius: 12px;
    margin-bottom: 24px;
    text-align: center;
}

.mk-dashboard-header h1 {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 600;
}

.mk-dashboard-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 16px;
}

.mk-dashboard-nav {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 16px;
}

.mk-dashboard-nav a {
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    color: #6b7280;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mk-dashboard-nav a:hover,
.mk-dashboard-nav a.active {
    color: #3b82f6;
    background: #eff6ff;
}

.mk-dashboard-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 24px;
    margin-bottom: 24px;
}

.mk-dashboard-section h2 {
    margin: 0 0 16px 0;
    color: #1f2937;
    font-size: 20px;
    font-weight: 600;
}

/* ==========================================================================
   Statistics Cards
   ========================================================================== */

.mk-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.mk-stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.mk-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mk-stat-number {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 4px;
}

.mk-stat-label {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}

/* ==========================================================================
   Accessibility Improvements
   ========================================================================== */

.mk-auth-form:focus-within {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.mk-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.mk-field-group input:focus,
.mk-field-group select:focus,
.mk-field-group textarea:focus {
    outline: none;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mk-auth-form {
        border: 2px solid #000;
    }
    
    .mk-field-group input,
    .mk-field-group select,
    .mk-field-group textarea {
        border: 2px solid #000;
    }
    
    .mk-btn-primary {
        background: #000;
        color: #fff;
    }
} 