/**
 * HTBOT Pro Dashboard - Custom CSS
 * Stili aggiuntivi per migliorare UI
 */

/* ============================================
   GLOBAL STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow-x: hidden;
}

/* ============================================
   SCROLLBAR CUSTOM
   ============================================ */

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #4b5563 #1f2937;
}

/* Chrome, Edge, Safari */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

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

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

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

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

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

.slide-in-up {
    animation: slideInUp 0.4s ease-out;
}

.slide-in-down {
    animation: slideInDown 0.4s ease-out;
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading-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;
}

.skeleton {
    background: linear-gradient(
        90deg,
        #374151 25%,
        #4b5563 50%,
        #374151 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

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

/* ============================================
   TABLE ENHANCEMENTS
   ============================================ */

table {
    border-collapse: separate;
    border-spacing: 0;
}

tbody tr {
    transition: all 0.2s ease;
}

tbody tr:hover {
    background-color: rgba(55, 65, 81, 0.5);
    transform: scale(1.01);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Alternating row colors */
tbody tr:nth-child(even) {
    background-color: rgba(31, 41, 55, 0.3);
}

/* ============================================
   CARDS & CONTAINERS
   ============================================ */

.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* Gradient overlays */
.gradient-overlay {
    position: relative;
    overflow: hidden;
}

.gradient-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: left 0.5s ease;
}

.gradient-overlay:hover::before {
    left: 100%;
}

/* ============================================
   BADGES & INDICATORS
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.badge-success {
    background-color: rgba(34, 197, 94, 0.2);
    color: rgb(34, 197, 94);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.2);
    color: rgb(239, 68, 68);
}

.badge-warning {
    background-color: rgba(251, 191, 36, 0.2);
    color: rgb(251, 191, 36);
}

.badge-info {
    background-color: rgba(59, 130, 246, 0.2);
    color: rgb(59, 130, 246);
}

/* ============================================
   BUTTONS
   ============================================ */

button {
    transition: all 0.2s ease;
}

button:active {
    transform: scale(0.95);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   TOOLTIPS (TODO)
   ============================================ */

.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.5rem 1rem;
    background-color: rgba(17, 24, 39, 0.95);
    color: white;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
}

.tooltip:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Stack cards vertically */
    .grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Smaller font sizes */
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    /* Horizontal scroll for table */
    .overflow-x-auto {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Hide less important columns on mobile */
    table th:nth-child(n+9),
    table td:nth-child(n+9) {
        display: none;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    header,
    footer,
    button,
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    table {
        border: 1px solid #000;
    }
    
    th, td {
        border: 1px solid #000;
    }
}

/* ============================================
   CUSTOM UTILITIES
   ============================================ */

.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.glow {
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
}

.glow-red {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

.backdrop-blur {
    backdrop-filter: blur(10px);
}

/* Status indicators */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-online {
    background-color: rgb(34, 197, 94);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
}

.status-offline {
    background-color: rgb(239, 68, 68);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
}

/* ============================================
   CHART CONTAINER
   ============================================ */

canvas {
    max-width: 100%;
    height: auto !important;
}

/* ============================================
   SELECTION
   ============================================ */

::selection {
    background-color: rgba(59, 130, 246, 0.3);
    color: white;
}

::-moz-selection {
    background-color: rgba(59, 130, 246, 0.3);
    color: white;
}

/* ============================================
   FOCUS STATES
   ============================================ */

input:focus,
select:focus,
button:focus {
    outline: 2px solid rgb(59, 130, 246);
    outline-offset: 2px;
}

/* ============================================
   DARK MODE SPECIFIC
   ============================================ */

.dark-mode-toggle {
    /* TODO: Implementare toggle dark/light mode */
}

/* ============================================
   PERFORMANCE OPTIMIZATION
   ============================================ */

.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* Force GPU acceleration for animations */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}
