/**
 * FZTM Platform - Ultra Clear UX Enhancement
 * Maximum clarity, accessibility, and user guidance
 * Developed by Andrea Zedda, PhD (Bioengineering)
 * andrea.zedda@outlook.it
 * Date: December 4, 2025
 */

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================
   1. ENHANCED TOOLTIPS & HELP BADGES
   ============================================ */

/* Tooltip with arrow and shadow */
.tooltip-enhanced {
    position: relative;
    cursor: help;
}

.tooltip-enhanced::after {
    content: '?';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    background: #007bff;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
}

.tooltip-enhanced:hover::after {
    transform: scale(1.2) rotate(15deg);
    background: #0056b3;
}

/* Help badge (inline explanations) */
.help-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background: #e7f3ff;
    border: 1px solid #b3d7ff;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #004085;
    margin-left: 8px;
    cursor: help;
    transition: all 0.2s ease;
}

.help-badge:hover {
    background: #cce5ff;
    border-color: #66afe9;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.help-badge i {
    margin-right: 4px;
}

/* ============================================
   2. DESCRIPTIVE LABELS & FIELD HINTS
   ============================================ */

/* Enhanced form labels with icon */
.form-label-enhanced {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #000000;
    margin-bottom: 0.5rem;
}

.form-label-enhanced i {
    margin-right: 8px;
    color: #007bff;
    font-size: 1.1em;
}

/* Field hint text below inputs */
.field-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #495057;
    font-weight: 500;
}

.field-hint i {
    margin-right: 4px;
    color: #ffc107;
}

.field-hint strong {
    font-weight: 700;
    color: #000000;
}

/* Example text in light box */
.field-example {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border-left: 3px solid #28a745;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #000000;
}

.field-example::before {
    content: '💡 Esempio: ';
    font-weight: 700;
}

/* ============================================
   3. VISUAL INDICATORS & STATUS BADGES
   ============================================ */

/* Status badge with icon */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-badge i {
    margin-right: 6px;
    font-size: 1.1em;
}

.status-badge.status-success {
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.status-badge.status-warning {
    background: #fff3cd;
    color: #856404;
    border: 2px solid #ffc107;
}

.status-badge.status-danger {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
}

.status-badge.status-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 2px solid #17a2b8;
}

/* ============================================
   4. STEP-BY-STEP GUIDANCE
   ============================================ */

/* Step indicator */
.step-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
}

.step-item {
    display: flex;
    align-items: center;
    flex: 1;
    position: relative;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #e9ecef;
    color: #6c757d;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.1rem;
    border: 3px solid #dee2e6;
    transition: all 0.3s ease;
    z-index: 2;
}

.step-item.active .step-number {
    background: #007bff;
    color: white;
    border-color: #0056b3;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.2);
}

.step-item.completed .step-number {
    background: #28a745;
    color: white;
    border-color: #1e7e34;
}

.step-item.completed .step-number::before {
    content: '✓';
    font-size: 1.2rem;
}

.step-label {
    margin-left: 12px;
    font-weight: 600;
    color: #6c757d;
}

.step-item.active .step-label {
    color: #007bff;
    font-weight: 700;
}

.step-item.completed .step-label {
    color: #28a745;
}

/* Connection line */
.step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: calc(50% + 20px);
    right: calc(-50% + 20px);
    height: 3px;
    background: #dee2e6;
    z-index: 1;
}

.step-item.completed:not(:last-child)::after {
    background: #28a745;
}

/* ============================================
   5. CONTEXTUAL HELP PANELS
   ============================================ */

/* Info panel with icon */
.info-panel {
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.info-panel-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.info-panel-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-right: 1rem;
    font-size: 1.5rem;
}

.info-panel.panel-info {
    background: #e7f3ff;
    border: 2px solid #007bff;
}

.info-panel.panel-info .info-panel-icon {
    background: #007bff;
    color: white;
}

.info-panel.panel-success {
    background: #d4edda;
    border: 2px solid #28a745;
}

.info-panel.panel-success .info-panel-icon {
    background: #28a745;
    color: white;
}

.info-panel.panel-warning {
    background: #fff3cd;
    border: 2px solid #ffc107;
}

.info-panel.panel-warning .info-panel-icon {
    background: #ffc107;
    color: #000000;
}

.info-panel-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #000000;
    margin: 0;
}

.info-panel-body {
    color: #000000;
    font-size: 1rem;
    line-height: 1.6;
}

.info-panel-body ul {
    margin-bottom: 0;
    padding-left: 1.5rem;
}

.info-panel-body li {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* ============================================
   6. ENHANCED BUTTONS WITH DESCRIPTIONS
   ============================================ */

/* Button with subtitle */
.btn-with-description {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.5rem;
    text-align: left;
    min-height: 80px;
}

.btn-title {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.btn-title i {
    margin-right: 8px;
    font-size: 1.3rem;
}

.btn-subtitle {
    font-size: 0.875rem;
    font-weight: 400;
    opacity: 0.9;
}

/* ============================================
   7. KEYBOARD SHORTCUT INDICATORS
   ============================================ */

/* Enhanced kbd styling */
kbd {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1;
    color: #000000;
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
    border: 2px solid #adb5bd;
    border-radius: 6px;
    box-shadow: 0 3px 0 #adb5bd, 0 3px 6px rgba(0, 0, 0, 0.1);
    font-family: 'Courier New', monospace;
    white-space: nowrap;
}

kbd:active {
    box-shadow: 0 1px 0 #adb5bd;
    transform: translateY(2px);
}

/* Shortcut hint */
.shortcut-hint {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 0.25rem 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #6c757d;
}

.shortcut-hint kbd {
    margin-left: 4px;
    padding: 2px 6px;
    font-size: 0.75rem;
}

/* ============================================
   8. LOADING STATES WITH MESSAGES
   ============================================ */

/* Loading spinner with text */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e9ecef;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-message {
    margin-top: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #000000;
}

.loading-hint {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6c757d;
    text-align: center;
}

/* ============================================
   9. PROGRESS INDICATORS
   ============================================ */

/* Progress bar with label */
.progress-enhanced {
    position: relative;
    height: 32px;
    border-radius: 16px;
    overflow: visible;
    background: #e9ecef;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar-enhanced {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 16px;
    font-weight: 700;
    color: white;
    font-size: 0.875rem;
    transition: width 0.6s ease;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.progress-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    color: #000000;
    font-size: 0.875rem;
    text-shadow: 0 0 3px white;
    z-index: 2;
}

/* ============================================
   10. EMPTY STATES WITH GUIDANCE
   ============================================ */

/* Empty state container */
.empty-state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state-icon {
    font-size: 6rem;
    color: #dee2e6;
    margin-bottom: 1.5rem;
    opacity: 0.6;
}

.empty-state-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #000000;
    margin-bottom: 0.75rem;
}

.empty-state-description {
    font-size: 1.1rem;
    color: #495057;
    margin-bottom: 2rem;
    max-width: 600px;
}

.empty-state-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.empty-state-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    min-width: 200px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.empty-state-action:hover {
    border-color: #007bff;
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 123, 255, 0.2);
    text-decoration: none;
}

.empty-state-action-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.empty-state-action-title {
    font-weight: 700;
    color: #000000;
    margin-bottom: 0.25rem;
}

.empty-state-action-description {
    font-size: 0.875rem;
    color: #6c757d;
}

/* ============================================
   11. HIGHLIGHT & FOCUS UTILITIES
   ============================================ */

/* Highlight important information */
.highlight-box {
    padding: 1rem 1.5rem;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    margin: 1rem 0;
}

.highlight-box-title {
    font-weight: 700;
    color: #000000;
    margin-bottom: 0.5rem;
}

.highlight-box-content {
    color: #000000;
    font-weight: 500;
}

/* Success highlight */
.highlight-box.highlight-success {
    background: #d4edda;
    border-left-color: #28a745;
}

/* Info highlight */
.highlight-box.highlight-info {
    background: #d1ecf1;
    border-left-color: #17a2b8;
}

/* Danger highlight */
.highlight-box.highlight-danger {
    background: #f8d7da;
    border-left-color: #dc3545;
}

/* ============================================
   12. ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid #007bff;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #007bff;
    color: white;
    padding: 1rem 2rem;
    border-radius: 0 0 8px 8px;
    font-weight: 700;
    text-decoration: none;
    z-index: 10000;
    transition: top 0.3s ease;
}

.skip-to-content:focus {
    top: 0;
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn,
    .form-control,
    .card {
        border-width: 2px !important;
    }
    
    .text-muted,
    .text-secondary {
        color: #000000 !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   13. PRINT STYLES
   ============================================ */

@media print {
    /* Hide interactive elements */
    .btn-floating-help,
    .shortcut-hint,
    .tooltip-enhanced::after,
    .empty-state-actions,
    button,
    .btn {
        display: none !important;
    }
    
    /* Optimize colors for print */
    .info-panel,
    .highlight-box {
        border: 2px solid #000000 !important;
        background: white !important;
    }
    
    /* Ensure text is black */
    * {
        color: #000000 !important;
    }
    
    /* Page breaks */
    .card,
    .info-panel,
    .step-indicator {
        page-break-inside: avoid;
    }
}

/* ============================================
   14. RESPONSIVE IMPROVEMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Larger touch targets */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }
    
    /* Simplified step indicator */
    .step-indicator {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .step-item:not(:last-child)::after {
        display: none;
    }
    
    /* Stack action buttons */
    .empty-state-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .empty-state-action {
        width: 100%;
    }
    
    /* Floating help button adjustment */
    .btn-floating-help {
        width: 50px;
        height: 50px;
        bottom: 1rem;
        left: 1rem;
    }
}
