/* Enhanced UX Styles for Suapon */
/* Complements client-side caching functionality */

/* Loading States */
.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 8px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Form Validation Styles */
.input-field input.valid,
.input-field select.valid,
.input-field textarea.valid {
    border-color: #4CAF50 !important;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2) !important;
}

.input-field input.invalid,
.input-field select.invalid,
.input-field textarea.invalid {
    border-color: #f44336 !important;
    box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.2) !important;
}

/* Enhanced Card Hover Effects */
.card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Scroll to Top Button */
.scroll-to-top-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #2196F3;
    color: white;
    border: none;
    cursor: pointer;
    display: none;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.scroll-to-top-btn:hover {
    background: #1976D2;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* Enhanced Search Input */
.hero-search-field:focus {
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
    border-color: #2196F3;
}

/* Form Auto-save Indicator */
.form-auto-save {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #4CAF50;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.form-auto-save.show {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced Button States */
.btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

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

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Enhanced Modal */
.modal {
    transition: all 0.3s ease;
}

.modal.open {
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Enhanced Dropdown */
.dropdown__content {
    transition: all 0.3s ease;
    transform-origin: top;
}

.account__dropdown.active .dropdown__content {
    animation: dropdownSlideIn 0.3s ease-out;
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: scaleY(0);
    }
    to {
        opacity: 1;
        transform: scaleY(1);
    }
}

/* Enhanced Navigation */
.__nav_container {
    transition: all 0.3s ease;
}

.__nav_container.scrolled {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

/* Enhanced Search Bar */
.__nav-search {
    transition: all 0.3s ease;
}

.__nav-search.activeSearch {
    animation: searchSlideDown 0.3s ease-out;
}

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

/* Enhanced Form Fields */
input, select, textarea {
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Enhanced Links */
a {
    transition: all 0.3s ease;
}

a:hover {
    transform: translateY(-1px);
}

/* Enhanced Tables */
table {
    transition: all 0.3s ease;
}

table tbody tr {
    transition: all 0.3s ease;
}

table tbody tr:hover {
    background-color: rgba(33, 150, 243, 0.05);
    transform: scale(1.01);
}

/* Enhanced Pagination */
.pagination li {
    transition: all 0.3s ease;
}

.pagination li:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Enhanced Alerts */
.alert {
    animation: alertSlideIn 0.5s ease-out;
}

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

/* Enhanced Tooltips */
.tooltip {
    transition: all 0.3s ease;
}

.tooltip:hover {
    transform: scale(1.05);
}

/* Enhanced Progress Bars */
.progress {
    overflow: hidden;
}

.progress .determinate {
    transition: width 0.6s ease;
}

/* Enhanced Tabs */
.tabs {
    transition: all 0.3s ease;
}

.tabs .tab a {
    transition: all 0.3s ease;
}

.tabs .tab a:hover {
    transform: translateY(-2px);
}

/* Enhanced Collapsible */
.collapsible-header {
    transition: all 0.3s ease;
}

.collapsible-header:hover {
    background-color: rgba(33, 150, 243, 0.05);
}

/* Enhanced Chips */
.chip {
    transition: all 0.3s ease;
}

.chip:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Enhanced Badges */
.badge {
    transition: all 0.3s ease;
}

.badge:hover {
    transform: scale(1.1);
}

/* Enhanced Icons */
.material-icons {
    transition: all 0.3s ease;
}

.material-icons:hover {
    transform: scale(1.1);
}

/* Enhanced Images */
img {
    transition: all 0.3s ease;
}

img:hover {
    transform: scale(1.02);
}

/* Enhanced Buttons with Icons */
.btn i {
    transition: all 0.3s ease;
}

.btn:hover i {
    transform: translateX(2px);
}

/* Enhanced Form Groups */
.input-field {
    transition: all 0.3s ease;
}

.input-field:focus-within {
    transform: translateY(-2px);
}

/* Enhanced Select Dropdowns */
.select-wrapper input.select-dropdown {
    transition: all 0.3s ease;
}

.select-wrapper input.select-dropdown:focus {
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}

/* Enhanced Checkboxes and Radio Buttons */
[type="checkbox"]:checked + span:not(.lever):before {
    animation: checkboxPop 0.3s ease-out;
}

[type="radio"]:checked + span:before {
    animation: radioPop 0.3s ease-out;
}

@keyframes checkboxPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes radioPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Enhanced Switches */
.switch label input[type=checkbox]:checked + .lever {
    animation: switchToggle 0.3s ease-out;
}

@keyframes switchToggle {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Enhanced Range Sliders */
.range-field input[type=range] {
    transition: all 0.3s ease;
}

.range-field input[type=range]:focus {
    transform: scale(1.02);
}

/* Enhanced File Input */
.file-field {
    transition: all 0.3s ease;
}

.file-field:hover {
    transform: translateY(-2px);
}

/* Enhanced Autocomplete */
.autocomplete-content {
    animation: autocompleteSlideIn 0.3s ease-out;
}

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

/* Enhanced Datepicker */
.datepicker-date-display {
    transition: all 0.3s ease;
}

.datepicker-date-display:hover {
    background-color: rgba(33, 150, 243, 0.1);
}

/* Enhanced Timepicker */
.timepicker-digital-display {
    transition: all 0.3s ease;
}

.timepicker-digital-display:hover {
    background-color: rgba(33, 150, 243, 0.1);
}

/* Enhanced Character Counter */
.character-counter {
    transition: all 0.3s ease;
}

.character-counter.warning {
    color: #ff9800;
    animation: pulse 1s ease-in-out;
}

.character-counter.error {
    color: #f44336;
    animation: shake 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

/* Enhanced Loading States for Forms */
.form-loading {
    position: relative;
    pointer-events: none;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.form-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1001;
    transform: translate(-50%, -50%);
}

/* Enhanced Success States */
.success-state {
    animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Enhanced Error States */
.error-state {
    animation: errorShake 0.6s ease-out;
}

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

/* Responsive Enhancements */
@media (max-width: 768px) {
    .scroll-to-top-btn {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
    
    .form-auto-save {
        bottom: 15px;
        left: 15px;
        font-size: 11px;
        padding: 6px 12px;
    }
    
    .loading-indicator {
        padding: 15px;
        font-size: 14px;
    }
}

/* Print Styles */
@media print {
    .scroll-to-top-btn,
    .form-auto-save,
    .loading-indicator {
        display: none !important;
    }
    
    .card:hover {
        transform: none;
        box-shadow: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn:hover {
        border: 2px solid currentColor;
    }
    
    .card:hover {
        border: 2px solid currentColor;
    }
}

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