/**
 * Advanced Gift Manager - Mobile Optimization Styles
 * 
 * @package AdvancedGiftManager
 * @version 1.0.0
 */

/* Mobile-First Responsive Design */
.wcag-mobile-optimized {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Touch Targets */
.wcag-touch-target {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.wcag-touch-device .wcag-touch-target:active {
    transform: scale(0.98);
    background-color: rgba(102, 126, 234, 0.1);
}

/* Mobile Form Optimization */
.wcag-mobile-form {
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin: 15px;
}

.wcag-mobile-form .wcag-form-group {
    margin-bottom: 20px;
}

.wcag-mobile-form input,
.wcag-mobile-form textarea,
.wcag-mobile-form select {
    width: 100%;
    padding: 16px;
    font-size: 16px; /* Prevents zoom on iOS */
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.wcag-mobile-form input:focus,
.wcag-mobile-form textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.wcag-focused {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
}

/* Mobile Validation Feedback */
.wcag-mobile-feedback {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
}

.wcag-mobile-feedback.wcag-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.wcag-mobile-feedback.wcag-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    text-align: center;
    font-size: 18px;
}

/* Custom Mobile Select */
.wcag-mobile-select-wrapper {
    position: relative;
}

.wcag-custom-select {
    position: relative;
    background: #fff;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    cursor: pointer;
}

.wcag-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    font-size: 16px;
}

.wcag-select-arrow {
    transition: transform 0.3s ease;
    color: #667eea;
    font-weight: bold;
}

.wcag-select-open .wcag-select-arrow {
    transform: rotate(180deg);
}

.wcag-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid #667eea;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.wcag-select-open .wcag-select-options {
    display: block;
}

.wcag-select-option {
    padding: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f1f3f4;
}

.wcag-select-option:hover,
.wcag-select-option:active {
    background-color: #f8f9fa;
}

.wcag-select-option:last-child {
    border-bottom: none;
}

/* Mobile Navigation */
.wcag-mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

.wcag-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    background: none;
    border: none;
    color: #6c757d;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.wcag-nav-item:active {
    background-color: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.wcag-nav-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.wcag-nav-label {
    font-weight: 500;
}

/* Floating Action Button */
.wcag-fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 999;
}

.wcag-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.wcag-fab:active {
    transform: scale(0.95);
}

.wcag-fab-hidden {
    transform: translateY(100px);
    opacity: 0;
}

/* Mobile Modal Optimization */
.wcag-mobile-modal .modal-dialog {
    margin: 0;
    height: 100vh;
    max-width: 100%;
}

.wcag-mobile-modal .modal-content {
    height: 100%;
    border-radius: 0;
    border: none;
}

.wcag-mobile-modal .modal-header {
    position: relative;
    padding: 20px;
    border-bottom: 1px solid #e1e5e9;
}

.wcag-mobile-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.wcag-mobile-close:hover {
    background-color: #f8f9fa;
}

/* Swipe Actions */
.wcag-swipe-actions-visible {
    transform: translateX(-80px);
    transition: transform 0.3s ease;
}

.wcag-swipe-actions-visible::after {
    content: "Delete";
    position: absolute;
    right: -80px;
    top: 0;
    bottom: 0;
    width: 80px;
    background: #dc3545;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

/* Pull to Refresh */
.wcag-pull-refresh-indicator {
    text-align: center;
    padding: 20px;
    color: #667eea;
    font-weight: 500;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 10px;
    transition: all 0.3s ease;
}

.wcag-pull-refresh-indicator.wcag-ready {
    background: #667eea;
    color: white;
}

.wcag-pull-refresh-indicator.wcag-loading::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #667eea;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: wcag-spin 1s linear infinite;
    margin-left: 10px;
}

/* Keyboard Optimization */
.wcag-keyboard-open {
    padding-bottom: 0;
}

.wcag-keyboard-open .wcag-mobile-nav {
    display: none;
}

.wcag-keyboard-open .wcag-fab {
    bottom: 20px;
}

/* Touch Device Optimizations */
.wcag-touch-device .wcag-hover-effect:hover {
    /* Disable hover effects on touch devices */
    background-color: initial;
    transform: initial;
}

.wcag-touch-active {
    background-color: rgba(102, 126, 234, 0.1) !important;
    transform: scale(0.98);
}

/* Responsive Breakpoints */
@media (max-width: 575px) {
    .wcag-xs .wcag-gift-form {
        margin: 10px;
        padding: 15px;
    }
    
    .wcag-xs .wcag-kpi-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .wcag-xs .wcag-charts-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (min-width: 576px) and (max-width: 767px) {
    .wcag-sm .wcag-kpi-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .wcag-md .wcag-mobile-nav {
        display: none;
    }
    
    .wcag-md .wcag-fab {
        display: none;
    }
}

@media (min-width: 992px) {
    .wcag-lg .wcag-mobile-nav,
    .wcag-xl .wcag-mobile-nav {
        display: none;
    }
    
    .wcag-lg .wcag-fab,
    .wcag-xl .wcag-fab {
        display: none;
    }
    
    .wcag-lg .wcag-mobile-form,
    .wcag-xl .wcag-mobile-form {
        margin: 0;
        padding: 30px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .wcag-mobile-form {
        background: #1a1a1a;
        color: #fff;
    }
    
    .wcag-mobile-form input,
    .wcag-mobile-form textarea {
        background: #2d2d2d;
        color: #fff;
        border-color: #404040;
    }
    
    .wcag-mobile-nav {
        background: #1a1a1a;
        border-top-color: #404040;
    }
    
    .wcag-nav-item {
        color: #ccc;
    }
    
    .wcag-nav-item:active {
        background-color: rgba(102, 126, 234, 0.2);
        color: #667eea;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .wcag-touch-target,
    .wcag-fab,
    .wcag-select-arrow,
    .wcag-swipe-actions-visible {
        transition: none;
    }
    
    .wcag-pull-refresh-indicator.wcag-loading::after {
        animation: none;
    }
}

/* High Contrast Support */
@media (prefers-contrast: high) {
    .wcag-mobile-form input,
    .wcag-mobile-form textarea {
        border-width: 3px;
    }
    
    .wcag-mobile-feedback.wcag-error {
        border-width: 2px;
    }
    
    .wcag-mobile-feedback.wcag-success {
        border-width: 2px;
    }
}

/* Animation Keyframes */
@keyframes wcag-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Print Styles */
@media print {
    .wcag-mobile-nav,
    .wcag-fab,
    .wcag-pull-refresh-indicator {
        display: none !important;
    }
}