/* ===============================================
   Mobile Dashboard Styles
   Responsywny dashboard z kafelkami dla XAF Blazor
   =============================================== */

/* Kontener główny dashboardu */
.mobile-dashboard {
    width: 100%;
    min-height: 100%;
    padding: 1rem;
}

/* DxFormLayout dla dashboardu */
.mobile-dashboard-layout {
    width: 100%;
}

/* Item w FormLayout - spacing między kafelkami */
.dashboard-tile-item {
    padding: 0.5rem;
}

/* Mobile - mniejszy padding i niższe kafelki */
@media (max-width: 576px) {
    /* KRYTYCZNE: Wymuś ciemny kolor TYLKO dla tytułu na mobile */
    .dashboard-tile .tile-title {
        color: #424242 !important;
        -webkit-text-fill-color: #424242 !important; /* Webkit override */
    }
    
    /* Nuklearna opcja dla tile-title - wszystkie możliwe selektory */
    div[class*="tile-title"],
    .tile-title,
    div.tile-title {
        color: #424242 !important;
        -webkit-text-fill-color: #424242 !important; /* Webkit override */
    }

    .mobile-dashboard {
        padding: 0.75rem;
    }
    
    .dashboard-tile-item {
        padding: 0.375rem;
    }

    .dashboard-tile {
        height: 140px;
        min-height: 140px;
        max-height: 140px;
        padding: 1rem 0.75rem;
    }

    .tile-icon {
        font-size: 2rem;
    }
    
    .tile-icon-img {
        width: 2rem;
        height: 2rem;
    }

    .tile-value {
        font-size: 2rem;
    }
}

/* ===============================================
   Standardowy kafelek
   =============================================== */

.dashboard-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    border-radius: 12px;
    border: 3px solid;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    height: 160px;
    min-height: 160px;
    max-height: 160px;
    position: relative;
    overflow: hidden;
    width: 100%;
    text-align: center;
}

/* DxButton jako kafelek - reset stylów buttona */
.dashboard-tile.dx-button {
    border-style: solid !important;
    border-width: 3px !important;
    font-family: inherit;
}

.dashboard-tile .tile-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    pointer-events: none;
}

/* Efekt hover dla klikalnych kafelków */
.dashboard-tile.clickable {
    cursor: pointer;
}

.dashboard-tile.clickable:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.dashboard-tile.clickable:active {
    transform: translateY(-2px) scale(1.01);
}

/* ===============================================
   NIEKLIKALNE kafelki - uniwersalne dla wszystkich kolorów
   =============================================== */

/* Nieklikalne: cursor domyślny, brak pointer */
.dashboard-tile:not(.clickable) {
    cursor: default !important;
    opacity: 0.90; /* Subtelnie przyciemnione */
}

/* Nieklikalne: wyłączenie WSZYSTKICH efektów hover */
.dashboard-tile:not(.clickable):hover {
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    opacity: 0.90 !important;
}

/* Nieklikalne DxButton: wyłączenie hover dla wszystkich kolorów */
.dashboard-tile.dx-button:not(.clickable):hover {
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

/* Ikona kafelka */
.tile-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.tile-icon span {
    display: inline-block;
}

/* Ikona jako obrazek (ImageLoader) */
.tile-icon-img {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: contain;
    display: block;
}

/* Wartość licznika */
.tile-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
}

/* Tytuł kafelka */
.tile-title {
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
    color: #424242 !important; /* Ciemny szary - zawsze widoczny na mobile */
    opacity: 0.85;
    /* Ellipsis dla długiego tekstu - max 2 linie */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    word-wrap: break-word;
}

/* ===============================================
   Kolory kafelków
   =============================================== */

/* Pomarańczowy - Moje zlecenia bieżące */
.tile-orange {
    border-color: #ff9800;
    background: linear-gradient(135deg, #ffffff 0%, #fff3e0 100%) !important;
}

.tile-orange .tile-icon {
    color: #ff9800;
}

.tile-orange .tile-value {
    color: #e65100;
}

.tile-orange.clickable:hover {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%) !important;
    border-color: #f57c00 !important;
}

.tile-orange.dx-button.clickable:hover {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%) !important;
    border-color: #f57c00 !important;
}

/* Zielony - Moje zlecenia PPM */
.tile-green {
    border-color: #4caf50;
    background: linear-gradient(135deg, #ffffff 0%, #e8f5e9 100%) !important;
}

.tile-green .tile-icon {
    color: #4caf50;
}

.tile-green .tile-value {
    color: #2e7d32;
}

.tile-green.clickable:hover {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%) !important;
    border-color: #388e3c !important;
}

.tile-green.dx-button.clickable:hover {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%) !important;
    border-color: #388e3c !important;
}

/* Czerwony - Zlecenia z zatrzymaniem produkcji */
.tile-red {
    border-color: #f44336;
    background: linear-gradient(135deg, #ffffff 0%, #ffebee 100%) !important;
}

.tile-red .tile-icon {
    color: #f44336;
}

.tile-red .tile-value {
    color: #c62828;
}

/* Szary - Wszystkie zlecenia */
.tile-gray {
    border-color: #9e9e9e;
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%) !important;
}

.tile-gray .tile-icon {
    color: #757575;
}

.tile-gray .tile-value {
    color: #424242;
}

.tile-gray.clickable:hover {
    background: linear-gradient(135deg, #f5f5f5 0%, #eeeeee 100%) !important;
    border-color: #757575 !important;
}

.tile-gray.dx-button.clickable:hover {
    background: linear-gradient(135deg, #f5f5f5 0%, #eeeeee 100%) !important;
    border-color: #757575 !important;
}

/* Żółty - Części z przekroczonym stanem minimalnym */
.tile-yellow {
    border-color: #ffc107;
    background: linear-gradient(135deg, #ffffff 0%, #fff8e1 100%) !important;
}

.tile-yellow .tile-icon {
    color: #ffa000;
}

.tile-yellow .tile-value {
    color: #f57f17;
}

/* Niebieski - dla custom kafelków */
.tile-blue {
    border-color: #2196f3;
    background: linear-gradient(135deg, #ffffff 0%, #e3f2fd 100%) !important;
}

.tile-blue .tile-icon {
    color: #2196f3;
}

.tile-blue .tile-value {
    color: #1565c0;
}

.tile-blue.clickable:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
    border-color: #1976d2 !important;
}

.tile-blue.dx-button.clickable:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
    border-color: #1976d2 !important;
}

/* ===============================================
   Custom kafelek
   =============================================== */

.dashboard-tile.custom-tile {
    padding: 0;
    grid-column: span 2; /* Zajmuje 2 kolumny */
    min-height: 250px;
    display: block;
}

@media (max-width: 768px) {
    .dashboard-tile.custom-tile {
        grid-column: span 1; /* Na mobile zajmuje 1 kolumnę */
    }
}

/* ===============================================
   Animacje
   =============================================== */

.dashboard-tile {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Opóźnienie animacji dla kolejnych kafelków */
.dashboard-tile:nth-child(1) { animation-delay: 0.05s; }
.dashboard-tile:nth-child(2) { animation-delay: 0.1s; }
.dashboard-tile:nth-child(3) { animation-delay: 0.15s; }
.dashboard-tile:nth-child(4) { animation-delay: 0.2s; }
.dashboard-tile:nth-child(5) { animation-delay: 0.25s; }
.dashboard-tile:nth-child(6) { animation-delay: 0.3s; }

/* ===============================================
   Dark mode support (opcjonalnie)
   =============================================== */

@media (prefers-color-scheme: dark) {
    .dashboard-tile {
        background: #2c2c2c;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .tile-orange {
        background: linear-gradient(135deg, #2c2c2c 0%, #3d2e1f 100%);
    }

    .tile-green {
        background: linear-gradient(135deg, #2c2c2c 0%, #1f3d2e 100%);
    }

    .tile-red {
        background: linear-gradient(135deg, #2c2c2c 0%, #3d1f1f 100%);
    }

    .tile-gray {
        background: linear-gradient(135deg, #2c2c2c 0%, #3c3c3c 100%);
    }

    .tile-yellow {
        background: linear-gradient(135deg, #2c2c2c 0%, #3d3d1f 100%);
    }

    .tile-blue {
        background: linear-gradient(135deg, #2c2c2c 0%, #1f2e3d 100%);
    }

    .tile-title {
        color: rgba(255, 255, 255, 0.85);
    }
}
