/**
 * SES Module UI Polish
 * Final styling touches for consistent and polished UI
 */

/* Loading States */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #6576ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

.skeleton-loader {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Smooth Transitions */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

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

/* 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;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

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

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.btn.loading {
    pointer-events: none;
}

/* Card Hover Effects */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
    animation: pulse 2s infinite;
}

.status-indicator.online {
    background: #1ee0ac;
}

.status-indicator.offline {
    background: #e85347;
}

.status-indicator.pending {
    background: #f4bd0e;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(30, 224, 172, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(30, 224, 172, 0); }
    100% { box-shadow: 0 0 0 0 rgba(30, 224, 172, 0); }
}

/* Form Validation Feedback */
.form-control.is-valid {
    border-color: #1ee0ac;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%231ee0ac' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid {
    border-color: #e85347;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23e85347' viewBox='-2 -2 7 7'%3e%3cpath stroke='%23e85347' d='M0 0l3 3m0-3L0 3'/%3e%3ccircle r='.5'/%3e%3ccircle cx='3' r='.5'/%3e%3ccircle cy='3' r='.5'/%3e%3ccircle cx='3' cy='3' r='.5'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Tooltips Enhancement */
.tooltip {
    font-size: 0.875rem;
}

.tooltip-inner {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    background-color: #364a63;
}

/* Progress Indicators */
.progress {
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background-color: #f5f6fa;
}

.progress-bar {
    background: linear-gradient(90deg, #6576ff 0%, #8094ff 100%);
    animation: progress-animation 2s ease-in-out infinite;
}

@keyframes progress-animation {
    0% { background-position: 0 0; }
    100% { background-position: 40px 0; }
}

/* Modal Enhancements */
.modal {
    backdrop-filter: blur(5px);
}

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

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

/* Alert Animations */
.alert {
    animation: alertSlideIn 0.3s ease-out;
    position: relative;
}

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

.alert.alert-dismissible .btn-close {
    transition: transform 0.2s ease;
}

.alert.alert-dismissible .btn-close:hover {
    transform: rotate(90deg);
}

/* Table Enhancements */
.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: #f5f6fa;
}

.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

/* Badge Animations */
.badge {
    animation: badgePop 0.3s ease-out;
}

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

/* Dropdown Enhancements */
.dropdown-menu {
    animation: dropdownSlide 0.2s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 8px;
}

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

/* Icon Animations */
.icon-hover {
    transition: transform 0.2s ease;
}

.icon-hover:hover {
    transform: scale(1.2);
}

.icon-rotate {
    animation: iconRotate 2s linear infinite;
}

@keyframes iconRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Success/Error States */
.success-animation {
    animation: successPulse 0.5s ease;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); box-shadow: 0 0 20px rgba(30, 224, 172, 0.4); }
    100% { transform: scale(1); }
}

.error-shake {
    animation: errorShake 0.5s ease;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #8094ae;
}

.empty-state .icon {
    font-size: 4rem;
    color: #c4cefe;
    margin-bottom: 1rem;
}

/* Accessibility Improvements */
.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;
}

/* Focus States */
.btn:focus,
.form-control:focus,
.custom-control-input:focus ~ .custom-control-label::before {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(101, 118, 255, 0.25);
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

/* Dark Mode Support (if implemented) */
@media (prefers-color-scheme: dark) {
    .dark-mode-support {
        filter: invert(1) hue-rotate(180deg);
    }
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 1rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .btn-block {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Performance Optimizations */
.will-change-transform {
    will-change: transform;
}

.hardware-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f5f6fa;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c4cefe;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6576ff;
}