/* Legacy CSS file - Most styling now handled by Tailwind CSS */
/* Only keeping essential custom animations and utilities */

/* ============================= */
/* MOBILE RESPONSIVE UTILITIES */
/* ============================= */

/* Ensure touch-friendly minimum sizes on mobile */
@media (max-width: 768px) {
    button, a.button, input[type="submit"], input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Make tables horizontally scrollable on mobile */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Compact padding for mobile */
    .mobile-compact {
        padding: 0.5rem !important;
    }
    
    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }
    
    /* Filters collapsed by default on mobile */
    #filters-content {
        display: none;
    }
    
    #filters-content.show {
        display: block;
    }
}

/* Desktop-specific styles */
@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
    
    /* Filters always visible on desktop */
    #filters-content {
        display: block !important;
    }
}

/* Better touch scrolling */
* {
    -webkit-overflow-scrolling: touch;
}

/* Prevent text selection on buttons for better mobile UX */
button {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Ensure inputs are not zoomed on mobile */
@media (max-width: 768px) {
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

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

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

.animate-fadeIn {
    animation: fadeIn 0.3s ease-in;
}

.animate-slideDown {
    animation: slideDown 0.3s ease-out;
}

/* Hover effects for table rows */
tbody tr:hover {
    background-color: rgba(239, 246, 255, 0.5);
}

/* Custom scrollbar for modals, result sections, and tables */
.result::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
.overflow-y-auto::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.result::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track,
.overflow-y-auto::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.result::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb,
.overflow-y-auto::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.result::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover,
.overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Tab button active state border fix */
.tab-btn.active {
    border-bottom: 3px solid #667eea !important;
    background-color: rgba(102, 126, 234, 0.1);
}

/* Tab content visibility */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Power Menu Dropdown Styles */
.power-menu-dropdown {
    animation: slideDown 0.2s ease-out;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.power-menu-dropdown button {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.power-menu-dropdown button:hover {
    transform: translateX(2px);
}

/* Power indicator animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Activity Feed Styles - Compact & Informative */
.activity-item {
    border-left: 2px solid #667eea;
    padding: 8px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.15s ease;
    cursor: pointer;
    animation: slideInRight 0.3s ease-out;
}

.activity-item:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transform: translateX(-2px);
    background: #fafafa;
}

/* Status-specific border colors */
.activity-item.status-completed {
    border-left-color: #10b981;
}

.activity-item.status-failed {
    border-left-color: #ef4444;
}

.activity-item.status-running {
    border-left-color: #3b82f6;
}

.activity-item.status-pending {
    border-left-color: #9ca3af;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Activity Filter Buttons */
.activity-filter-btn.active {
    background-color: rgba(102, 126, 234, 0.2) !important;
    color: #667eea !important;
    font-weight: 600;
}

/* Compact Activity Icon Styles */
.activity-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.activity-icon.power {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.activity-icon.test {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.activity-icon.workflow {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.activity-icon.check {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

/* Smoother Scrollbar for Narrow Feed */
#activity-feed-list::-webkit-scrollbar {
    width: 4px;
}

#activity-feed-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#activity-feed-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 2px;
}

#activity-feed-list::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ============================= */
/* NEWS-FEED ACTIVITY ITEMS */
/* ============================= */

.activity-item-news {
    background: white;
    border-radius: 8px;
    padding: 12px;
    border-left: 3px solid #667eea;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    cursor: pointer;
    animation: slideInRight 0.3s ease-out;
}

.activity-item-news:hover {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    transform: translateX(-2px);
    background: #fafbfc;
}

/* Status border colors */
.activity-item-news.status-completed {
    border-left-color: #10b981;
}

.activity-item-news.status-failed {
    border-left-color: #ef4444;
}

.activity-item-news.status-running {
    border-left-color: #3b82f6;
}

.activity-item-news.status-pending {
    border-left-color: #9ca3af;
}

/* Larger, more prominent icons */
.activity-icon-large {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.activity-icon-large.power {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.activity-icon-large.test {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.activity-icon-large.workflow {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.activity-icon-large.check {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

/* Multi-Select & Bulk Actions Styles */
#bulk-actions-bar {
    animation: slideDown 0.3s ease-out;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#bulk-actions-bar button {
    transition: all 0.2s ease;
}

#bulk-actions-bar button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#bulk-actions-bar button:active {
    transform: translateY(0);
}

/* Checkbox styling */
.unit-checkbox {
    transition: all 0.2s ease;
}

.unit-checkbox:hover {
    transform: scale(1.1);
}

/* Indeterminate state for select-all checkbox */
#select-all-units:indeterminate {
    opacity: 0.6;
}

/* Selected row styling */
tr[data-unit-id].bg-blue-50 {
    background-color: rgba(239, 246, 255, 0.7) !important;
    border-left: 4px solid #3b82f6 !important;
    transition: all 0.2s ease;
}

tr[data-unit-id].bg-blue-50:hover {
    background-color: rgba(219, 234, 254, 0.9) !important;
}

/* ============================= */
/* SORTABLE TABLE HEADERS */
/* ============================= */

/* Sortable header styling */
.sortable-header {
    user-select: none;
    transition: all 0.2s ease;
    position: relative;
}

.sortable-header:hover {
    background-color: rgba(102, 126, 234, 0.8) !important;
}

.sortable-header:active {
    transform: scale(0.98);
}

/* Sort indicator styling */
.sort-indicator {
    display: inline-block;
    font-size: 10px;
    margin-left: 4px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: bold;
}

/* ============================= */
/* GLASSMORPHISM MODAL STYLES */
/* ============================= */

/* Modal backdrop animations */
.modal-backdrop {
    animation: modalBackdropFadeIn 0.3s ease-out;
}

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

/* Modal content slide-in animation */
.modal-content-slide {
    animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Custom scrollbar for modal content */
.custom-scrollbar::-webkit-scrollbar {
    width: 10px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    margin: 8px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #764ba2 0%, #667eea 100%);
}

/* Glassmorphism effect for modal cards inside */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

/* Smooth modal close animation */
.modal-backdrop.modal-closing {
    animation: modalBackdropFadeOut 0.3s ease-out forwards;
}

.modal-closing .modal-content-slide {
    animation: modalSlideOut 0.3s ease-out forwards;
}

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

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

/* ============================= */
/* CUSTOM DIALOG SYSTEM */
/* ============================= */

/* Dialog backdrop animation */
.dialog-backdrop {
    animation: dialogBackdropFadeIn 0.2s ease-out;
}

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

/* Dialog panel animation */
.dialog-panel {
    animation: dialogPanelSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Dialog closing animation */
#custom-dialog-container.dialog-closing .dialog-backdrop {
    animation: dialogBackdropFadeOut 0.2s ease-out forwards;
}

#custom-dialog-container.dialog-closing .dialog-panel {
    animation: dialogPanelSlideOut 0.2s ease-out forwards;
}

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

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

/* Dialog type-specific styles */
.dialog-success {
    border-top: 4px solid #10b981;
}

.dialog-error {
    border-top: 4px solid #ef4444;
}

.dialog-warning {
    border-top: 4px solid #f59e0b;
}

.dialog-danger {
    border-top: 4px solid #dc2626;
}

.dialog-info {
    border-top: 4px solid #3b82f6;
}

/* Dialog icon styles */
.dialog-icon-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.dialog-icon-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.dialog-icon-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.dialog-icon-danger {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.dialog-icon-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* ============================= */
/* TOAST NOTIFICATION SYSTEM */
/* ============================= */

/* Toast slide-in animation */
.toast-enter {
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Toast slide-out animation */
.toast-exit {
    animation: toastSlideOut 0.2s ease-out forwards;
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
}

/* Toast hover pause */
.toast:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

/* Toast progress bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0.8) 100%);
    border-radius: 0 0 0 12px;
    animation: toastProgressBar linear;
}

@keyframes toastProgressBar {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Toast type-specific colors */
.toast-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95) 0%, rgba(5, 150, 105, 0.95) 100%);
    border-left: 4px solid #059669;
}

.toast-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95) 0%, rgba(220, 38, 38, 0.95) 100%);
    border-left: 4px solid #dc2626;
}

.toast-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.95) 0%, rgba(217, 119, 6, 0.95) 100%);
    border-left: 4px solid #d97706;
}

.toast-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95) 0%, rgba(37, 99, 235, 0.95) 100%);
    border-left: 4px solid #2563eb;
}

/* Toast pointer events - only on toast, not container */
.toast {
    pointer-events: auto;
    cursor: pointer;
}

/* Pulse animation for important toasts */
.toast-pulse {
    animation: toastPulse 2s ease-in-out infinite;
}

@keyframes toastPulse {
    0%, 100% {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.2);
    }
}
