:root {
    --bg-dark: #0f0c20;
    --bg-card: rgba(30, 22, 56, 0.6);
    --bg-card-hover: rgba(45, 33, 84, 0.8);
    --primary: #8a2be2;
    --primary-light: #b066ff;
    --success: #00e676;
    --success-bg: rgba(0, 230, 118, 0.1);
    --error: #ff1744;
    --error-bg: rgba(255, 23, 68, 0.1);
    --text-main: #ffffff;
    --text-muted: #a09eb5;
    --border-color: rgba(255, 255, 255, 0.05);
    --glass-blur: blur(12px);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(138, 43, 226, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(0, 230, 118, 0.05) 0%, transparent 50%);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(15, 12, 32, 0.8);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 48px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.3);
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #b066ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 12px;
    transition: var(--transition);
    font-weight: 600;
}

.nav-item i {
    font-size: 1.5rem;
}

.nav-item:hover, .nav-item.active {
    background: var(--bg-card);
    color: var(--text-main);
}

.nav-item.active {
    border-left: 4px solid var(--primary);
    background: linear-gradient(90deg, rgba(138,43,226,0.15) 0%, transparent 100%);
}

.uptime-info-container {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.uptime-info-container h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.uptime-desc {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.4;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 3rem 4rem;
}

.top-header {
    margin-bottom: 3rem;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    padding: 2rem;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.status-icon-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
}

.status-icon-ring .bx-check-circle { color: var(--success); }
.status-icon-ring .bx-error-circle { color: var(--error); }

.status-text-content h2 {
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.status-text-content .subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Dashboard Grid & Accordion */
.services-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.accordion-aut {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-main);
    cursor: pointer;
    padding: 1.5rem 2rem;
    width: 100%;
    text-align: left;
    outline: none;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 600;
}

.accordion-aut:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.group-status-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 400;
}

.group-status-badge.ok {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(0, 230, 118, 0.2);
}

.group-status-badge.error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(255, 23, 68, 0.2);
}

.chevron-icon {
    transition: transform 0.3s ease;
}

.accordion-aut.active .chevron-icon {
    transform: rotate(90deg);
}

.panel-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
    display: none;
    animation: fadeIn 0.4s ease-out;
}

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

/* Statuspage Service Row */
.service-row {
    background: rgba(20, 15, 40, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    overflow: visible; /* Changed from hidden so tooltip can show */
}

.service-row::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 4px; height: 100%;
}
.service-row.status-ok::before { background: var(--success); }
.service-row.status-error::before { background: var(--error); }

.service-row:hover {
    background: var(--bg-card);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.service-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.service-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.service-title-link {
    color: inherit;
    text-decoration: none;
}

.service-title-link:hover {
    text-decoration: underline;
    color: var(--primary-light);
}

.service-status-text {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.service-status-text.ok { color: var(--success); }
.service-status-text.error { color: var(--error); }

.uptime-timeline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    height: 36px;
}

.uptime-bar {
    flex: 1;
    height: 100%;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    transition: opacity 0.2s;
    min-width: 4px;
    cursor: pointer;
}

.uptime-bar:hover {
    opacity: 0.7;
}

.uptime-bar.ok {
    background: var(--success);
}

.uptime-bar.error {
    background: var(--error);
}

/* Tooltip for bars */
.uptime-bar .tooltip {
    visibility: hidden;
    background-color: var(--bg-dark);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    position: absolute;
    z-index: 100;
    bottom: 130%; 
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    pointer-events: none;
}

.uptime-bar .tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--border-color) transparent transparent transparent;
}

.uptime-bar:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

.service-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.problem-description {
    color: var(--error);
    background: var(--error-bg);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid rgba(255, 23, 68, 0.2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 1024px) {
    .sidebar { width: 80px; padding: 2rem 1rem; }
    .brand-title, .nav-item span, .uptime-info-container { display: none; }
    .main-content { margin-left: 80px; padding: 2rem; }
}

@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 1rem; justify-content: space-between; }
    .nav-menu { flex-direction: row; }
    .main-content { margin-left: 0; padding: 1rem; }
    .uptime-info-container { display: none; }
}

/* --- Instances Specific Styles --- */
.summary-cards {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    flex: 1;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.summary-card h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.summary-card p {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.summary-card.error p {
    color: var(--error);
}

.tabs-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-light);
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.3);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

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

/* Sub-tests accordion inner panel */
.subtest-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border-left: 3px solid var(--primary-light);
}

.subtest-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.subtest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.subtest-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.subtest-error {
    color: var(--error);
    font-family: monospace;
    font-size: 0.85rem;
    background: rgba(255, 0, 0, 0.1);
    padding: 0.5rem;
    border-radius: 6px;
    margin-top: 0.5rem;
    display: block;
}

.subtest-trace {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--primary-light);
    text-decoration: none;
    font-size: 0.9rem;
}

.subtest-trace:hover {
    text-decoration: underline;
}

.subtest-image-container {
    margin-top: 1rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.subtest-image-container img {
    width: 100%;
    height: auto;
    display: block;
}

/* --- Error Pulse Animation --- */
@keyframes pulseRed {
    0% { box-shadow: 0 0 0 0 rgba(255, 23, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 23, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 23, 68, 0); }
}

.service-row.pulse-error {
    animation: pulseRed 2s infinite;
    border-color: rgba(255, 23, 68, 0.5);
}
