/**
 * Player Recovery Form - Styles
 * تصميم نموذج إدخال بيانات الاستشفاء
 * 
 * @package ArcheryPlayerManagement
 * @version 1.0.0
 * @since 6.0.0
 * @location includes/training/recovery-form.css
 * 
 * Design Approach:
 * - Mobile-First Responsive Design
 * - RTL Auto-Support (WordPress native)
 * - WCAG 2.1 AA Accessibility
 * - Clean & Professional UI
 */

/* ========================================
   Container & Layout
   ======================================== */

.apm-recovery-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 1.5rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.apm-recovery-container * {
    box-sizing: border-box;
}

/* ========================================
   Window Info Section
   ======================================== */

.apm-window-info {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e8e8e8;
}

.apm-window-info h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 0.5rem 0;
}

.apm-window-info .training-date {
    font-size: 1rem;
    color: #666;
    margin: 0;
}

/* ========================================
   Timer Display
   ======================================== */

.apm-timer-display {
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.apm-timer-display .timer-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.apm-timer-display .timer-value {
    font-size: 2.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.1em;
    margin: 0.5rem 0;
}

.apm-timer-display .timer-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin: 0.5rem 0 0 0;
}

/* Timer Warning States */
.apm-timer-display.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.apm-timer-display.critical {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* ========================================
   Form Structure
   ======================================== */

.apm-recovery-form {
    margin-top: 2rem;
}

.apm-recovery-form fieldset {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: #fafafa;
}

.apm-recovery-form fieldset[disabled] {
    background: #f5f5f5;
    opacity: 0.8;
}

.apm-recovery-form legend {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    padding: 0 0.5rem;
    margin-bottom: 1rem;
}

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

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

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

.form-group label .required {
    color: #d32f2f;
    font-weight: 700;
}

.form-group small {
    display: block;
    color: #777;
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

/* ========================================
   Input Fields
   ======================================== */

.apm-recovery-form input[type="number"],
.apm-recovery-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.apm-recovery-form input[type="number"]:focus,
.apm-recovery-form textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.apm-recovery-form input[type="number"].error,
.apm-recovery-form textarea.error {
    border-color: #d32f2f;
}

.apm-recovery-form textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

/* ========================================
   Range Sliders
   ======================================== */

.apm-recovery-form input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(to right, #667eea 0%, #764ba2 100%);
    outline: none;
    -webkit-appearance: none;
    margin: 1rem 0;
}

.apm-recovery-form input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.apm-recovery-form input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.apm-recovery-form input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.apm-recovery-form output {
    display: inline-block;
    font-weight: 700;
    font-size: 1.2rem;
    color: #667eea;
    margin-left: 0.5rem;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #777;
    margin-top: -0.5rem;
}

/* ========================================
   Star Rating
   ======================================== */

.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 0.5rem;
}

.star-rating input[type="radio"] {
    display: none;
}

.star-rating label.star {
    font-size: 2rem;
    color: #ddd;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}

.star-rating label.star:hover,
.star-rating label.star.hover {
    color: #ffc107;
    transform: scale(1.15);
}

.star-rating input[type="radio"]:checked ~ label.star,
.star-rating label.star.active {
    color: #ffc107;
}

/* Read-only Stars */
.stars-display {
    display: flex;
    gap: 0.3rem;
}

.stars-display .star {
    font-size: 1.5rem;
    color: #ddd;
}

.stars-display .star.filled {
    color: #ffc107;
}

/* ========================================
   Submit Button
   ======================================== */

.form-actions {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.apm-submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.apm-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.apm-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.apm-submit-btn:disabled,
.apm-submit-btn.disabled {
    background: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
}

.apm-submit-btn .btn-loading {
    display: inline-block;
}

.apm-submit-btn .btn-loading::after {
    content: '';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 0.5rem;
}

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

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

.apm-messages {
    margin-top: 1.5rem;
}

.apm-message {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    animation: slideIn 0.3s ease-out;
}

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

.apm-message-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.apm-message-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.apm-message-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* ========================================
   Success State (Submitted)
   ======================================== */

.apm-recovery-container.submitted-state {
    background: linear-gradient(to bottom right, #f8f9fa, #e9ecef);
}

.apm-success-message {
    text-align: center;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #ffffff;
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
}

.apm-success-message .dashicons {
    font-size: 3rem;
    width: 3rem;
    height: 3rem;
    display: inline-block;
    margin-bottom: 1rem;
}

.apm-success-message h3 {
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
}

.apm-success-message p {
    margin: 0;
    opacity: 0.95;
}

.apm-recovery-form-wrapper.readonly {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.apm-recovery-form-wrapper.readonly h4 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.apm-recovery-form-wrapper.readonly .value-display {
    display: block;
    font-weight: 600;
    color: #667eea;
    margin-top: 0.5rem;
    font-size: 1.1rem;
}

/* ========================================
   Expired Overlay
   ======================================== */

.apm-expired-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

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

.expired-message {
    background: #ffffff;
    padding: 3rem 2rem;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.expired-message .dashicons {
    font-size: 4rem;
    width: 4rem;
    height: 4rem;
    color: #f5576c;
    display: inline-block;
    margin-bottom: 1rem;
}

.expired-message h3 {
    color: #333;
    margin: 0 0 1rem 0;
}

.expired-message p {
    color: #666;
    margin: 0;
}

/* ========================================
   Error States
   ======================================== */

.apm-recovery-error,
.apm-recovery-info {
    text-align: center;
    padding: 3rem 2rem;
    background: #f8f9fa;
    border-radius: 10px;
    margin: 2rem auto;
    max-width: 600px;
}

.apm-recovery-error h3,
.apm-recovery-info h3 {
    color: #333;
    margin-bottom: 1rem;
}

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

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

/* ========================================
   RTL Support (WordPress Auto-Detection)
   ======================================== */

[dir="rtl"] .star-rating {
    flex-direction: row;
}

[dir="rtl"] .range-labels {
    direction: rtl;
}

[dir="rtl"] .apm-submit-btn .btn-loading::after {
    margin-right: 0.5rem;
    margin-left: 0;
}

/* ========================================
   Responsive Design - Tablet
   ======================================== */

@media (min-width: 768px) {
    .apm-recovery-container {
        padding: 2.5rem;
    }
    
    .apm-timer-display .timer-value {
        font-size: 3rem;
    }
    
    .form-group {
        margin-bottom: 2rem;
    }
}

/* ========================================
   Responsive Design - Desktop
   ======================================== */

@media (min-width: 1024px) {
    .apm-recovery-container {
        padding: 3rem;
    }
    
    .apm-window-info h3 {
        font-size: 1.75rem;
    }
    
    .apm-timer-display {
        padding: 2rem;
    }
}

/* ========================================
   Print Styles (للطباعة)
   ======================================== */

@media print {
    .apm-timer-display,
    .form-actions,
    .apm-submit-btn {
        display: none !important;
    }
    
    .apm-recovery-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ========================================
   Accessibility Enhancements
   ======================================== */

.apm-recovery-form :focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .apm-recovery-form input,
    .apm-recovery-form textarea {
        border-width: 2px;
    }
    
    .apm-submit-btn {
        border: 2px solid #000000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}