/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Navigation */
.navbar {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
}
.nav-brand a {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}
.nav-brand a:hover {
    text-decoration: none;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-sep {
    color: rgba(255, 255, 255, 0.35);
    margin: 0 0.25rem;
}

.nav-user {
    color: #b0b0b0;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}


.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Neutral, differentiated logout button */
.btn-logout {
    background: transparent;
    color: #d6d6d6;
    border: 1px solid rgba(255, 255, 255, 0.28);
}
.btn-logout:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-box {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #b0b0b0;
    font-size: 0.95rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #d0d0d0;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.08);
}

.form-text {
    display: block;
    margin-top: 0.5rem;
    color: #888;
    font-size: 0.85rem;
}
/* Improve layout for inline helper rows with badges */
.form-text > div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.5;
    margin: 0.15rem 0;
}
.form-text > div .role-badge {
    display: inline-flex;
}

/* Role badges */
.role-badge {
    border: 1px solid rgba(255,255,255,0.2);
    color: #e0e0e0;
    background: rgba(255,255,255,0.08);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.85rem;
    line-height: 1;
}
.role-badge.role-admin {
    border: 1px solid rgba(34, 197, 94, 0.5);
    color: #4ade80;
    background: rgba(34, 197, 94, 0.15);
}
.role-badge.role-operator {
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #f87171;
    background: rgba(239, 68, 68, 0.15);
}
.role-badge.role-user {
    border: 1px solid rgba(59, 130, 246, 0.5);
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.15);
}
.role-badge.role-none {
    border-color: rgba(255,255,255,0.25);
    color: #c0c0c0;
    background: rgba(255,255,255,0.08);
}

.login-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 0.85rem;
    color: #b0b0b0;
}

.login-footer code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: #667eea;
}

/* Dashboard */
.dashboard-header {
    margin-bottom: 2.5rem;
    text-align: center;
}

.dashboard-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
}

.dashboard-subtitle {
    color: #b0b0b0;
    font-size: 1.05rem;
}

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.service-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.8rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.service-header {
    margin-bottom: 1rem;
}

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

.status-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;      /* center children horizontally */
    width: max-content;       /* shrink-wrap to widest child (badge) */
}

.service-title h3 {
    font-size: 1.3rem;
    color: #fff;
    font-weight: 600;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 1.1rem; /* slightly wider so it umbrellas the timestamp below */
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-asof {
    color: #b0b0b0;
    font-size: 0.75rem;
    margin-top: 4px;
    margin-left: 0;
    text-align: center;
}

.status-running {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-down {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-development {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.status-icon {
    font-weight: bold;
    font-size: 1rem;
}

.service-body {
    flex: 1;
    margin-bottom: 1.5rem;
}

.service-description {
    color: #c0c0c0;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.service-update {
    color: #888;
    font-size: 0.85rem;
    font-style: italic;
}

.service-footer {
    margin-top: auto;
}

/* Dashboard Info Section */
.dashboard-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.info-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.5rem;
}

.info-card h4 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.info-card ul {
    list-style: none;
}

.info-card ul li {
    padding: 0.5rem 0;
    color: #c0c0c0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.info-card ul li:last-child {
    border-bottom: none;
}

.info-card a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s ease;
}

.info-card a:hover {
    color: #764ba2;
}

/* Admin tables */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    overflow: hidden;
}
.admin-table thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.06);
    color: #ddd;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}
.admin-table tbody td {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    vertical-align: middle;
}
.admin-table tbody td:nth-child(2) {
    overflow-wrap: anywhere; /* wrap long emails to avoid horizontal scroll */
    word-break: break-word;
}
.admin-table thead th:nth-child(4),
.admin-table tbody td:nth-child(4) {
    min-width: 130px; /* widen 'Added by' column so header stays on one line */
    width: 130px;
}
.admin-table thead th:nth-child(3),
.admin-table tbody td:nth-child(3) {
    width: 140px; /* make Roles column a bit narrower to give Email ~50px more space */
    max-width: 140px;
}
.admin-table thead th:nth-child(5),
.admin-table tbody td:nth-child(5) {
    min-width: 150px; /* narrower but still single-line header */
    width: 150px;
}
.admin-table tbody td:nth-child(5) {
    font-size: 0.8rem;      /* smaller timestamp text so table fits neatly */
    line-height: 1.2;
}
.admin-table tbody td .role-badge {
    display: inline-flex;
    margin-right: 0.5rem;
    margin-bottom: 0.35rem;
}
.admin-table .muted {
    color: #c0c0c0;
}

.danger-box {
    border: 1px solid rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.06);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: white;
    border: 1px solid rgba(239, 68, 68, 0.5);
}
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.35);
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
    color: #4ade80;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #f87171;
}

/* Placeholder Page */
.placeholder-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.placeholder-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 3rem;
    max-width: 600px;
}

.placeholder-content h2 {
    color: #fff;
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.placeholder-message {
    margin-bottom: 2rem;
}

.placeholder-message p {
    color: #c0c0c0;
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.note {
    color: #888;
    font-size: 0.9rem;
    font-style: italic;
}

/* MFA Setup */
.mfa-setup {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

.mfa-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 3rem;
    max-width: 600px;
    text-align: center;
}

.mfa-container h2 {
    color: #fff;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.qr-code {
    margin: 2rem 0;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    display: inline-block;
}

.qr-code img {
    display: block;
    max-width: 250px;
}

.mfa-secret {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.mfa-secret code {
    display: block;
    font-size: 1.2rem;
    color: #667eea;
    margin: 1rem 0;
    letter-spacing: 2px;
}

.mfa-instructions {
    text-align: left;
    margin: 2rem 0;
    color: #c0c0c0;
}

.mfa-instructions h3 {
    color: #fff;
    margin-bottom: 1rem;
}

.mfa-instructions ol {
    margin-left: 1.5rem;
}

.mfa-instructions li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Footer */
.footer {
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem 0;
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    margin-top: 3rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
    }

    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .dashboard-header h2 {
        font-size: 1.8rem;
    }

    .login-box {
        padding: 2rem;
    }

    .container {
        padding: 1rem;
    }
}
