/* NetBox Maintenance Device Plugin Styles */

/* Enhanced overdue maintenance styling - Works in both light and dark mode */
.table-danger {
    background-color: rgba(220, 53, 69, 0.15) !important;
    border-left: 4px solid #ae0011 !important;
    animation: pulse-danger 2s infinite;
}

.table-warning {
    background-color: rgba(255, 193, 7, 0.15) !important;
    border-left: 4px solid #ffc107 !important;
}

/* Dark mode specific overrides - Force override NetBox variables */
[data-bs-theme="dark"] .table-danger,
.dark .table-danger {
    --tblr-table-bg: rgb(92, 0, 8) !important;
    background-color: rgb(92, 0, 8) !important;
    --tblr-table-hover-bg: rgb(115, 0, 10) !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .table-warning,
.dark .table-warning {
    --tblr-table-bg: #e5a700 !important;
    --tblr-table-hover-bg: #e49400 !important;
    background-color: #e5a700 !important;
    color: #ffffff !important;
}


/* Ensure text is always readable */
.table-danger td,
.table-danger th {
    color: inherit !important;
}

.table-warning td,
.table-warning th {
    color: inherit !important;
}

/* Force dark mode table cells */
[data-bs-theme="dark"] .table-danger td,
[data-bs-theme="dark"] .table-danger th,
.dark .table-danger td,
.dark .table-danger th {
    --tblr-table-bg: rgb(92, 0, 8) !important;
    background-color: rgb(92, 0, 8) !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .table-warning td,
[data-bs-theme="dark"] .table-warning th,
.dark .table-warning td,
.dark .table-warning th {
    --tblr-table-bg: rgb(161, 123, 10) !important;
    background-color: rgb(161, 123, 10) !important;
    color: #ffffff !important;
}

/* Dark mode hover for table cells */
[data-bs-theme="dark"] .table-danger:hover td,
[data-bs-theme="dark"] .table-danger:hover th,
.dark .table-danger:hover td,
.dark .table-danger:hover th {
    --tblr-table-bg: rgb(115, 0, 10) !important;
    background-color: rgb(115, 0, 10) !important;
}

[data-bs-theme="dark"] .table-warning:hover td,
[data-bs-theme="dark"] .table-warning:hover th,
.dark .table-warning:hover td,
.dark .table-warning:hover th {
    --tblr-table-bg: rgb(185, 140, 12) !important;
    background-color: rgb(185, 140, 12) !important;
}

@keyframes pulse-danger {
    0% {
        background-color: rgba(220, 53, 69, 0.15);
        border-left-color: #dc3545;
    }
    50% {
        background-color: rgba(220, 53, 69, 0.25);
        border-left-color: #c82333;
    }
    100% {
        background-color: rgba(220, 53, 69, 0.15);
        border-left-color: #dc3545;
    }
}

/* Dark mode pulse animation */
@keyframes pulse-danger-dark {
    0% {
        background-color: rgb(92, 0, 8);
        --tblr-table-bg: rgb(92, 0, 8) !important;
    }
    50% {
        background-color: rgb(115, 0, 10);
        --tblr-table-bg: rgb(115, 0, 10) !important;
    }
    100% {
        background-color: rgb(92, 0, 8);
        --tblr-table-bg: rgb(92, 0, 8) !important;
    }
}

/* Apply dark mode animation */
[data-bs-theme="dark"] .table-danger,
.dark .table-danger {
    animation: pulse-danger-dark 2s infinite;
}

/* Alert enhancements */
.alert-danger {
    border-left: 4px solid #dc3545;
}

.alert-warning {
    border-left: 4px solid #ffc107;
}

.alert-info {
    border-left: 4px solid #17a2b8;
}

/* Badge enhancements - Better contrast for dark mode */
.badge-danger {
    background-color: #dc3545 !important;
    color: #fff !important;
    animation: blink-danger 1.5s infinite;
}

.badge-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
}

.badge-success {
    background-color: #28a745 !important;
    color: #fff !important;
}

.badge-info {
    background-color: #17a2b8 !important;
    color: #fff !important;
}

.badge-secondary {
    background-color: #6c757d !important;
    color: #fff !important;
}

/* Dark mode badge adjustments */
[data-bs-theme="dark"] .badge-warning,
.dark .badge-warning {
    background-color: #e0a800 !important;
    color: #fff !important;
}

@keyframes blink-danger {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0.7;
    }
}

/* Quick action button styling */
.quick-complete-btn, .complete-execution {
    transition: all 0.3s ease;
}

.quick-complete-btn:hover, .complete-execution:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Modal enhancements */
.modal-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

.modal-header .close {
    color: white;
    opacity: 0.8;
}

/* Icon animations */
.mdi-alert-circle, .mdi-clock-alert {
    animation: shake 1s infinite;
}

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

/* Card header icons */
.card-header i {
    margin-right: 8px;
}

/* Enhanced button states */
.btn-success.quick-complete {
    background: linear-gradient(135deg, #28a745, #20c997);
    border: none;
}

.btn-success.quick-complete:hover {
    background: linear-gradient(135deg, #20c997, #17a2b8);
}

/* Loading spinner animation */
.mdi-spin {
    animation: spin 1s linear infinite;
}

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

/* Additional dark mode improvements */
[data-bs-theme="dark"] .card,
.dark .card {
    border-color: rgba(255, 255, 255, 0.125);
}

[data-bs-theme="dark"] .table,
.dark .table {
    color: inherit;
}

[data-bs-theme="dark"] .table th,
.dark .table th {
    border-color: rgba(255, 255, 255, 0.125);
    color: inherit;
}

[data-bs-theme="dark"] .table td,
.dark .table td {
    border-color: rgba(255, 255, 255, 0.125);
    color: inherit;
}

/* Better text contrast in maintenance cards */
.maintenance-card-danger {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(220, 53, 69, 0.05));
    border-left: 4px solid #dc3545;
}

.maintenance-card-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 193, 7, 0.05));
    border-left: 4px solid #ffc107;
}

/* Maintenance Status Badge Styling */
.maintenance-status-badge {
    cursor: default !important;
    margin-right: 8px;
    font-weight: 600;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.maintenance-status-badge:hover {
    transform: none !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.maintenance-status-badge.btn-danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    animation: pulse-danger-badge 2s infinite;
}

.maintenance-status-badge.btn-warning {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #000 !important;
}

.maintenance-status-badge.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

@keyframes pulse-danger-badge {
    0% {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
    }
    100% {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
}

/* Icon spacing in badge */
.maintenance-status-badge .mdi {
    margin-right: 4px;
}

/* Statistics Cards Styling */
.card.border-danger {
    border-width: 2px !important;
    transition: all 0.3s ease;
}

.card.border-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.card.border-warning {
    border-width: 2px !important;
    transition: all 0.3s ease;
}

.card.border-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.card.border-info {
    border-width: 2px !important;
    transition: all 0.3s ease;
}

.card.border-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

.card.border-success {
    border-width: 2px !important;
    transition: all 0.3s ease;
}

.card.border-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Statistics Card Content */
.card-body h3 {
    font-weight: 700;
    font-size: 2rem;
    margin: 0;
}

.card-body small {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Dark mode adjustments for stats cards */
[data-bs-theme="dark"] .card.border-danger,
.dark .card.border-danger {
    background-color: rgba(220, 53, 69, 0.05);
}

[data-bs-theme="dark"] .card.border-warning,
.dark .card.border-warning {
    background-color: rgba(255, 193, 7, 0.05);
}

[data-bs-theme="dark"] .card.border-info,
.dark .card.border-info {
    background-color: rgba(23, 162, 184, 0.05);
}

[data-bs-theme="dark"] .card.border-success,
.dark .card.border-success {
    background-color: rgba(40, 167, 69, 0.05);
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .card-body h3 {
        font-size: 1.5rem;
    }
    
    .card-body small {
        font-size: 0.7rem;
    }
}