/**
 * UX Enhancement Styles
 * Modern, accessible, and beautiful UI improvements
 */

/* ============================================
   1. IMPROVED INPUT STYLES
   ============================================ */

.input-focused {
    position: relative;
}

.input-focused::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

input.invalid,
textarea.invalid,
select.invalid {
    border-color: #dc3545 !important;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
    animation: fadeInDown 0.3s ease;
}

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

.char-counter {
    font-size: 0.75rem;
    color: #6c757d;
    text-align: right;
    margin-top: 0.25rem;
    transition: color 0.3s ease;
}

.char-counter-warning {
    color: #ffc107;
    font-weight: 600;
}

/* ============================================
   2. LOADING STATES
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-message {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
}

/* Button loading state */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-spinner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-text {
    visibility: hidden;
}

/* ============================================
   3. TOOLTIPS
   ============================================ */

.tooltip-container {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10000;
    pointer-events: none;
}

.tooltip-box {
    position: absolute;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: nowrap;
    transform: translate(-50%, -100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tooltip-box::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #333;
}

.tooltip-box.visible {
    opacity: 1;
}

/* ============================================
   4. KEYBOARD NAVIGATION
   ============================================ */

.keyboard-navigation *:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #667eea;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 10001;
}

.skip-link:focus {
    top: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   5. NOTIFICATIONS
   ============================================ */

.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9998;
    max-width: 400px;
}

.notification {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
}

.notification.visible {
    transform: translateX(0);
    opacity: 1;
}

.notification i {
    font-size: 1.5rem;
}

.notification-success {
    border-left: 4px solid #28a745;
}

.notification-success i {
    color: #28a745;
}

.notification-error {
    border-left: 4px solid #dc3545;
}

.notification-error i {
    color: #dc3545;
}

.notification-warning {
    border-left: 4px solid #ffc107;
}

.notification-warning i {
    color: #ffc107;
}

.notification-info {
    border-left: 4px solid #17a2b8;
}

.notification-info i {
    color: #17a2b8;
}

.notification-message {
    flex: 1;
    font-size: 0.9rem;
    color: #333;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.notification-close:hover {
    color: #333;
}

/* ============================================
   6. HELP SYSTEM
   ============================================ */

.help-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.help-button:hover {
    background: #764ba2;
    transform: scale(1.1);
}

.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.help-modal.visible {
    opacity: 1;
}

.help-modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.help-modal.visible .help-modal-content {
    transform: scale(1);
}

.help-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.help-modal-close:hover {
    color: #333;
}

.help-modal h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.5rem;
}

.help-modal-body {
    color: #666;
    line-height: 1.6;
}

/* ============================================
   7. MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    .notification-container {
        left: 10px;
        right: 10px;
        max-width: none;
    }

    .notification {
        font-size: 0.875rem;
    }

    .touch-target-optimized {
        min-width: 44px;
        min-height: 44px;
        padding: 12px !important;
    }

    .help-modal-content {
        margin: 20px;
        max-width: calc(100% - 40px);
    }
}

/* ============================================
   8. ACCESSIBILITY
   ============================================ */

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    .notification {
        border: 2px solid currentColor;
    }

    .button,
    .btn {
        border: 2px solid currentColor;
    }
}

/* Dark mode support (for future implementation) */
@media (prefers-color-scheme: dark) {
    .help-modal-content {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .help-modal h3 {
        color: #ffffff;
    }

    .help-modal-body {
        color: #b0b0b0;
    }
}

/* ============================================
   9. IMPROVED BUTTONS
   ============================================ */

.button,
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.button::before,
.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.button:active::before,
.btn:active::before {
    width: 300px;
    height: 300px;
}

.button:focus-visible,
.btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.4);
}

/* ============================================
   10. SMOOTH ANIMATIONS
   ============================================ */

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

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

.scale-in {
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Pause animations when tab is hidden */
.animations-paused * {
    animation-play-state: paused !important;
}

/* ============================================
   11. PROGRESS INDICATORS
   ============================================ */

.progress-bar {
    height: 6px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

/* ============================================
   12. ENHANCED FOCUS STATES
   ============================================ */

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ============================================
   13. UTILITY CLASSES
   ============================================ */

.text-gradient {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-soft {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.shadow-medium {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.shadow-large {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.rounded-soft {
    border-radius: 8px;
}

.rounded-medium {
    border-radius: 12px;
}

.rounded-large {
    border-radius: 16px;
}

/* ============================================
   14. PRINT STYLES
   ============================================ */

@media print {
    .loading-overlay,
    .notification-container,
    .help-button,
    .tooltip-box {
        display: none !important;
    }
}

