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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 32px;
    border-radius: 16px;
    margin-bottom: 32px;
    box-shadow: 0 8px 24px var(--shadow);
    backdrop-filter: blur(10px);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-info {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.header-info span {
    background: rgba(255, 255, 255, 0.15);
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.9em;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.namespace-selector {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.9em;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.2s;
    min-width: 200px;
}

.namespace-selector:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}

.namespace-selector:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.namespace-selector option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-refresh {
    background: white;
    color: var(--primary);
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 0.95em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-refresh:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.btn-refresh:active {
    transform: translateY(0);
}

/* Health Summary */
.health-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.summary-card {
    background: var(--bg-secondary);
    padding: 28px;
    border-radius: 16px;
    box-shadow: 0 4px 12px var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-lg);
    border-color: var(--primary-light);
}

.summary-card:hover::before {
    width: 100%;
    opacity: 0.1;
}

.summary-card.healthy::before {
    background: var(--success);
}

.summary-card.error::before {
    background: var(--error);
}

.summary-icon {
    font-size: 3em;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    z-index: 1;
}

.summary-content {
    flex: 1;
    z-index: 1;
}

.summary-label {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.summary-value {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

/* Error Section */
.error-section {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.05) 100%);
    border: 2px solid rgba(239, 68, 68, 0.3);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
    backdrop-filter: blur(10px);
}

.error-section h2 {
    color: var(--error);
    margin-bottom: 20px;
    font-size: 1.5em;
    font-weight: 700;
}

.error-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.error-item {
    background: var(--bg-secondary);
    padding: 18px;
    border-radius: 12px;
    border-left: 4px solid var(--error);
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.error-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
}

.error-item-name {
    font-weight: 600;
    color: var(--error);
    margin-bottom: 6px;
    font-size: 1.05em;
}

.error-item-reason {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* Pods Section */
.pods-section {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 12px var(--shadow);
    border: 1px solid var(--border);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header h2 {
    color: var(--text-primary);
    font-size: 1.75em;
    font-weight: 700;
}

.filter-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-input {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9em;
    min-width: 240px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9em;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9em;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.filter-checkbox:hover {
    background: var(--bg-tertiary);
}

.filter-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.pods-table {
    width: 100%;
    border-collapse: collapse;
}

.pods-table thead {
    background: var(--bg-tertiary);
}

.pods-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 0.05em;
}

/* Sortable table headers */
.pods-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, color 0.2s;
}

.pods-table th.sortable:hover {
    background: var(--bg-secondary);
    color: var(--accent);
}

.pods-table th.sortable.sorted {
    color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.pods-table th .sort-icon {
    margin-left: 6px;
    font-size: 0.9em;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.pods-table th.sortable:hover .sort-icon,
.pods-table th.sortable.sorted .sort-icon {
    opacity: 1;
}

.pods-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.pods-table tbody tr {
    transition: all 0.2s;
}

.pods-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.pods-table tbody tr.loading {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-running {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-error,
.status-crashloopbackoff,
.status-oomkilled,
.status-evicted {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-imagepullbackoff,
.status-errimagepull {
    background: rgba(236, 72, 153, 0.2);
    color: #ec4899;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.restart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    min-width: 40px;
}

.restart-none {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.restart-low {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.restart-high {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.image-tag {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.85em;
    color: var(--text-secondary);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-action {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-action:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-action:active {
    transform: translateY(0);
}

.btn-action.btn-logs {
    background: var(--success);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-action.btn-logs:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-action.btn-events {
    background: var(--warning);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-action.btn-events:hover {
    background: #d97706;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    overflow: auto;
    animation: fadeIn 0.2s ease;
}

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

.modal-content {
    background: var(--bg-secondary);
    margin: 40px auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px var(--shadow-lg);
    border: 1px solid var(--border);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5em;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.modal-body {
    padding: 24px 32px;
    overflow: auto;
    flex: 1;
}

.logs-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.logs-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 100px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-small {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-small:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.logs-content {
    background: #1a1a1a;
    color: #e0e0e0;
    padding: 20px;
    border-radius: 12px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.6;
    overflow-x: auto;
    max-height: 60vh;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid var(--border);
}

.events-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-item {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.event-item:hover {
    transform: translateX(4px);
    border-left-width: 6px;
}

.event-item.warning {
    border-left-color: var(--warning);
}

.event-item.error {
    border-left-color: var(--error);
}

.event-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.event-message {
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.5;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    header {
        padding: 20px;
        margin-bottom: 20px;
    }

    header h1 {
        font-size: 1.5em;
        margin-bottom: 12px;
    }

    .header-info {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .header-info span {
        text-align: center;
        padding: 8px 12px;
        font-size: 0.85em;
    }

    .namespace-selector {
        width: 100%;
        min-width: auto;
        padding: 12px 16px;
    }

    .btn-refresh {
        width: 100%;
        padding: 12px;
    }

    .health-summary {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }

    .summary-card {
        padding: 20px;
    }

    .summary-icon {
        font-size: 2em;
    }

    .summary-value {
        font-size: 2em;
    }

    .pods-section {
        padding: 20px;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
    }

    .section-header h2 {
        font-size: 1.4em;
    }

    .filter-controls {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .search-input {
        width: 100%;
        min-width: auto;
    }

    .filter-select {
        width: 100%;
    }

    .filter-checkbox {
        width: 100%;
        justify-content: space-between;
        padding: 10px;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .pods-table {
        font-size: 0.8em;
        min-width: 800px;
    }

    .pods-table th,
    .pods-table td {
        padding: 10px 6px;
        white-space: nowrap;
    }

    .pods-table th:nth-child(3),
    .pods-table td:nth-child(3),
    .pods-table th:nth-child(4),
    .pods-table td:nth-child(4) {
        display: none;
    }

    .pods-table th:nth-child(1)::before {
        content: 'Pod ';
    }

    .pods-table th:nth-child(2)::before {
        content: 'Status ';
    }

    .pods-table th:nth-child(5)::before {
        content: 'Node ';
    }

    .pods-table th:nth-child(6)::before {
        content: 'Age ';
    }

    .pods-table th:nth-child(7)::before {
        content: 'Actions ';
    }

    .action-buttons {
        flex-direction: column;
        gap: 6px;
    }

    .btn-action {
        width: 100%;
        padding: 10px;
        font-size: 0.8em;
    }

    .image-tag {
        max-width: 150px;
        font-size: 0.75em;
    }

    .modal-content {
        width: 95%;
        margin: 10px auto;
        max-height: 95vh;
    }

    .modal-header,
    .modal-body {
        padding: 16px;
    }

    .modal-header h3 {
        font-size: 1.2em;
    }

    .logs-controls {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .logs-input {
        width: 100%;
    }

    .btn-small {
        width: 100%;
        padding: 10px;
    }

    .logs-content {
        font-size: 0.8em;
        padding: 12px;
        max-height: 50vh;
    }

    .error-section {
        padding: 16px;
    }

    .error-section h2 {
        font-size: 1.2em;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.3em;
    }

    .summary-value {
        font-size: 1.8em;
    }

    .pods-table th:nth-child(5),
    .pods-table td:nth-child(5) {
        display: none;
    }
}

/* Install Prompt Styles */
.install-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 10000;
    animation: slideUp 0.3s ease;
}

.install-prompt-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 24px var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.install-prompt-icon {
    font-size: 2.5em;
    flex-shrink: 0;
}

.install-prompt-text {
    flex: 1;
    min-width: 200px;
}

.install-prompt-text h3 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
    font-size: 1.1em;
    font-weight: 600;
}

.install-prompt-text p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.4;
}

.install-prompt-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.install-prompt-button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9em;
}

.install-prompt-button.install {
    background: var(--primary);
    color: white;
}

.install-prompt-button.install:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.install-prompt-button.dismiss {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.install-prompt-button.dismiss:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

@media (max-width: 640px) {
    .install-prompt {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .install-prompt-content {
        flex-direction: column;
        text-align: center;
    }

    .install-prompt-actions {
        width: 100%;
        flex-direction: column;
    }

    .install-prompt-button {
        width: 100%;
    }
}

/* Tabs */
.tabs-container {
    margin-bottom: 32px;
}

.tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.tab-button {
    background: transparent;
    border: none;
    padding: 16px 24px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    bottom: -2px;
}

.tab-button:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-icon {
    font-size: 1.2em;
}

.tab-label {
    font-size: 0.95em;
}

.tab-content {
    display: none;
}

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

/* Backups Section */
.backups-section {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 12px var(--shadow);
    border: 1px solid var(--border);
}

.backup-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.backups-list-container {
    margin-top: 24px;
}

/* Metrics Section */
.metrics-section {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 12px var(--shadow);
    border: 1px solid var(--border);
}

.metrics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.metrics-list-container {
    margin-top: 24px;
}
