/* K8 Cost Cutter - Custom Styles */

/* These styles supplement Tailwind CSS */

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Sidebar navigation active state */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.7rem;
    font-size: 1rem;
    line-height: 1.35rem;
}

.sidebar-link svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.sidebar-group-items .sidebar-link {
    min-height: 2.45rem;
    font-size: 0.96rem;
}

.sidebar-link.active {
    background-color: #ecf8f6;
    color: #1f6159;
}

.sidebar-link.active svg {
    color: #1f6159;
}

/* Sidebar collapsible groups */
.sidebar-group-header {
    gap: 0.5rem;
    min-height: 2.25rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    border-radius: 0.375rem;
    transition: color 0.15s, background-color 0.15s;
}

.sidebar-group-header:hover {
    color: #374151;
    background-color: #f3f4f6;
}

.sidebar-group-chevron {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    display: none;
}

.sidebar-group-items {
    padding-left: 0.25rem;
    display: block;
}

.sidebar-group {
    margin-top: 0.25rem;
    padding-top: 0.25rem;
}

.sidebar-group-header.has-active {
    color: #1f6159;
}

/* Card hover effects */
.card-hover {
    transition: box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.card-hover:hover {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    transform: translateY(-2px);
}

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

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

/* HTMX loading indicator */
.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.status-healthy {
    background-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.status-warning {
    background-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.status-error {
    background-color: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

/* Table styles */
.table-row-hover:hover {
    background-color: rgb(249 250 251);
}

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

/* Tooltip styles */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background-color: #1f2937;
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 50;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Chart container */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Cost trend colors */
.cost-up {
    color: #ef4444;
}

.cost-down {
    color: #22c55e;
}

/* Resource utilization bars */
.utilization-bar {
    height: 8px;
    border-radius: 4px;
    background-color: #e5e7eb;
    overflow: hidden;
}

.utilization-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-in-out;
}

.utilization-low {
    background-color: #22c55e;
}

.utilization-medium {
    background-color: #f59e0b;
}

.utilization-high {
    background-color: #ef4444;
}

/* Skeleton loading animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 20px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-card {
    height: 160px;
    border-radius: 12px;
}

/* Empty state container */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.empty-state-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: #f3f4f6;
    margin-bottom: 1rem;
}

.empty-state-icon svg {
    width: 32px;
    height: 32px;
    color: #9ca3af;
}

.empty-state-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.25rem;
}

.empty-state-description {
    font-size: 0.8125rem;
    color: #6b7280;
    max-width: 24rem;
    margin-bottom: 1rem;
}

/* Pulsing dot for auto-refresh */
@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #22c55e;
    display: inline-block;
    animation: pulse-dot 2s ease-in-out infinite;
}

/* Responsive table wrapper */
.responsive-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
}

/* Button loading state */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.75;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    top: 50%;
    left: 50%;
    margin-top: -7px;
    margin-left: -7px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Unsaved changes indicator */
.unsaved-badge {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #f59e0b;
    display: inline-block;
    margin-left: 4px;
    vertical-align: middle;
}

/* Filter active indicator */
.filter-active {
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.3);
    border-color: #6366f1;
}

/* Toast stacking */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
    pointer-events: none;
}

.toast-container > * {
    pointer-events: auto;
}

/* Namespace table row layout */
.ns-table-row {
    display: grid;
    grid-template-columns: 1.4fr 44px 72px 72px 52px 84px 96px;
    gap: 0.5rem;
    align-items: center;
    padding-left: 1rem;
    padding-right: 1rem;
    min-width: 700px;
}

.ns-row {
    transition: background-color 0.15s ease;
}

.ns-row:hover {
    background-color: #f7fdfb;
}

/* Namespace utilization bar animation */
@keyframes ns-bar-grow {
    from { width: 0; }
}

.ns-bar-animate {
    animation: ns-bar-grow 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Legacy mini utilization bars (used on other pages) */
.mini-bar {
    height: 4px;
    border-radius: 2px;
    background-color: #e5e7eb;
    overflow: hidden;
    margin-top: 4px;
}

.mini-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease-in-out;
}

/* Inventory row health borders */
.row-healthy {
    border-left: 3px solid #22c55e;
}

.row-warning {
    border-left: 3px solid #f59e0b;
}

.row-error {
    border-left: 3px solid #ef4444;
}

.row-unknown {
    border-left: 3px solid #d1d5db;
}

.inventory-row-clickable {
    cursor: pointer !important;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.inventory-row-clickable td {
    cursor: pointer !important;
}

.inventory-row-clickable a,
.inventory-row-clickable span,
.inventory-row-clickable div {
    cursor: pointer;
}

.inventory-row-clickable:hover td {
    background-color: #f8fafc;
}

.inventory-row-clickable:hover {
    box-shadow: inset 0 0 0 1px #dbeafe;
}

.inventory-row-clickable:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
}

/* Inline validation */
.field-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 1px #ef4444;
}

.field-error-message {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.field-success {
    border-color: #22c55e !important;
}

/* SSE connection status indicator */
.sse-status {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    z-index: 9998;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    pointer-events: auto;
    cursor: help;
}

.sse-status-connected {
    background-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.sse-status-connecting {
    background-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.sse-status-disconnected {
    background-color: #9ca3af;
    box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.25);
}

/* Print styles */
@media print {
    .sidebar,
    .no-print,
    .sse-status {
        display: none !important;
    }

    .pl-64 {
        padding-left: 0 !important;
    }
}
