:root {
    --bg-body: #0f172a;
    /* Slate 900 */
    --bg-card: #1e293b;
    /* Slate 800 */
    --bg-header: #334155;
    /* Slate 700 */
    --text-main: #f8fafc;
    /* Slate 50 */
    --text-muted: #94a3b8;
    /* Slate 400 */

    --color-success: #22c55e;
    /* Green 500 */
    --color-danger: #ef4444;
    /* Red 500 */
    --color-warning: #f59e0b;
    /* Amber 500 */
    --color-blue: #3b82f6;
    /* Blue 500 */

    --env-prd: #ef4444;
    --env-hml: #22c55e;
    /* User preference: HML is Green */
    --env-sandbox: #f59e0b;

    --radius: 6px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font);
    margin: 0;
    padding: 0;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

/* LAYOUT */
.container {
    max-width: 1600px;
    /* Wide */
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #334155;
}

h1 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

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

.profile {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.profile img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #475569;
}

.btn-settings {
    color: var(--text-muted);
    transition: color 0.2s;
}

.btn-settings:hover {
    color: var(--text-main);
}


/* FILTERS */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.filters {
    display: flex;
    gap: 8px;
}

.filter-btn {
    background: var(--bg-card);
    border: 1px solid #334155;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.1s;
}

.filter-btn:hover {
    background: #334155;
    color: var(--text-main);
}

.filter-btn.active {
    background: var(--color-blue);
    border-color: var(--color-blue);
    color: white;
}

.timer {
    font-family: monospace;
    color: var(--text-muted);
    background: #1e293b;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #334155;
}

/* GRID */
.grid {
    display: grid;
    /* Flexible grid: fit as many as possible, min 180px */
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
}

/* CARD DESIGN */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    border: 1px solid #334155;
    display: flex;
    flex-direction: column;
    transition: transform 0.1s, box-shadow 0.1s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: #475569;
}

/* CARD HEADER */
.card-header {
    height: 32px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #334155;
    /* Default */
    color: white;
}

.env-tag {
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* CARD BODY */
.card-body {
    padding: 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.service-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.service-version {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-muted);
}

/* CARD FOOTER */
.card-footer {
    padding: 8px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.latency {
    font-family: monospace;
    font-size: 11px;
    color: var(--text-muted);
}

.card-link {
    position: absolute;
    inset: 0;
}

/* GROUPING SECTIONS */
.env-section {
    margin-bottom: 2rem;
}

.env-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    padding-left: 4px;
    border-left: 3px solid #475569;
    line-height: 1;
}

/* ENVIRONMENT COLORS - Labels Only now */
/* We remove the background color from header based on env */

/* STATUS STYLES - Dominant Header Color */
.card.status-UP .card-header {
    background-color: var(--color-success);
    /* Green for UP */
}

.card.status-DOWN .card-header {
    background-color: var(--color-danger);
    /* Red for DOWN */
}

.card.status-PENDING .card-header {
    background-color: #64748b;
    /* Slate for Pending */
}

/* Override Env specific overrides if we want Env to dictate color? 
   User said "PRD ta checked (UP) e deveria ta verde". 
   So Status > Env.  */

/* STATUS STYLES Body */
/* If DOWN, we might want a red border too, as before */
.card.status-DOWN {
    border-color: var(--color-danger);
}

/* Refresh Button Styles */
.refresh-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-refresh {
    background: #334155;
    border: 1px solid #475569;
    color: var(--text-main);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-refresh:hover {
    background: #475569;
}

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

/* Config Pages */
.config-layout {
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    background: var(--bg-body);
    border: 1px solid #475569;
    color: white;
    padding: 8px;
    border-radius: 4px;
}

.btn {
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    font-weight: 600;
}

.btn-primary {
    background: var(--color-blue);
    color: white;
}

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

.table th {
    text-align: left;
    color: var(--text-muted);
    padding: 8px;
    border-bottom: 1px solid #334155;
}

.table td {
    padding: 8px;
    border-bottom: 1px solid #334155;
}

/* Loader */
.loader-overlay {
    grid-column: 1/-1;
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}
/* LOGIN PAGE */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, #1e293b, #0f172a);
    padding: 20px;
}

.login-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.login-logo {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    letter-spacing: -0.05em;
    display: inline-block;
}

.login-card h2 {
    margin: 0 0 12px;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
}

.login-card p {
    margin: 0 0 32px;
    color: var(--text-muted);
    line-height: 1.5;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    background: white;
    color: #1f2937;
    font-weight: 500;
    padding: 12px 20px;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 15px;
    border: 1px solid transparent;
}

.btn-google:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    background: #f8fafc;
}

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

.login-error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}
