/* StatusIntel - Enterprise IT Monitoring Dashboard */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --bg-card: #151c2c;
    --border-color: #2d3748;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Terminal-style header */
.header {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    color: white;
}

.logo-text {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-text span { color: var(--accent-cyan); }

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

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
    padding: 0.5rem 0;
}

.nav-link:hover, .nav-link.active { color: var(--accent-cyan); }

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-badge {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    text-decoration: none;
    font-family: var(--font-sans);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover { background: var(--bg-card); border-color: var(--accent-cyan); }

.btn-success { background: var(--accent-green); color: white; }
.btn-danger { background: var(--accent-red); color: white; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }

/* Main container */
.main { max-width: 1400px; margin: 0 auto; padding: 2rem; }

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
}

.stat-card.up::before { background: var(--accent-green); }
.stat-card.down::before { background: var(--accent-red); }
.stat-card.warning::before { background: var(--accent-yellow); }

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value.up { color: var(--accent-green); }
.stat-value.down { color: var(--accent-red); }

/* Panel */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

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

.panel-body { padding: 1.5rem; }

/* Monitor list */
.monitor-list { display: flex; flex-direction: column; gap: 0.75rem; }

.monitor-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.monitor-item:hover {
    border-color: var(--accent-cyan);
    transform: translateX(4px);
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: relative;
}

.status-dot.up {
    background: var(--accent-green);
    box-shadow: 0 0 12px var(--accent-green);
}

.status-dot.down {
    background: var(--accent-red);
    box-shadow: 0 0 12px var(--accent-red);
    animation: pulse-red 2s infinite;
}

.status-dot.pending {
    background: var(--accent-yellow);
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.monitor-info { min-width: 0; }

.monitor-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.monitor-target {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.monitor-type {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    color: var(--accent-cyan);
    text-transform: uppercase;
}

.monitor-uptime {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--accent-green);
    min-width: 60px;
    text-align: right;
}

.monitor-response {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 70px;
    text-align: right;
}

.monitor-actions {
    display: flex;
    gap: 0.5rem;
}

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

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-input, .form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.form-input::placeholder { color: var(--text-muted); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal { transform: translateY(0); }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title { font-size: 1.125rem; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

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

.modal-body { padding: 1.5rem; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Auth pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo .logo-icon {
    width: 56px;
    height: 56px;
    font-size: 24px;
    margin: 0 auto 1rem;
}

.auth-logo .logo-text { font-size: 1.5rem; }

.auth-title {
    font-size: 1.25rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-footer a { color: var(--accent-cyan); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
}

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

.table th, .table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.table td { font-size: 0.875rem; }

.table tr:hover td { background: var(--bg-secondary); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* Referral box */
.referral-box {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(6, 182, 212, 0.1));
    border: 1px solid var(--accent-purple);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.referral-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--accent-purple);
}

.referral-code {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.referral-code input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

/* 2FA Setup */
.totp-setup {
    text-align: center;
}

.totp-qr {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    display: inline-block;
    margin: 1rem 0;
}

.totp-secret {
    font-family: var(--font-mono);
    font-size: 1.125rem;
    letter-spacing: 0.1em;
    background: var(--bg-secondary);
    padding: 0.75rem;
    border-radius: 6px;
    margin: 1rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content { flex-direction: column; gap: 1rem; }
    .nav { flex-wrap: wrap; justify-content: center; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .monitor-item { grid-template-columns: auto 1fr; }
    .monitor-type, .monitor-uptime, .monitor-response { display: none; }
    .form-row { grid-template-columns: 1fr; }
    .main { padding: 1rem; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Loading */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Checkbox/Toggle */
.toggle {
    position: relative;
    width: 48px;
    height: 24px;
}

.toggle input { display: none; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-tertiary);
    border-radius: 24px;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider { background: var(--accent-green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(24px); background: white; }

/* Enterprise features - Role badges */
.role-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.role-badge.role-1 { background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue)); color: white; }
.role-badge.role-2 { background: var(--accent-blue); color: white; }
.role-badge.role-3 { background: var(--accent-cyan); color: var(--bg-primary); }
.role-badge.role-4 { background: var(--bg-tertiary); color: var(--text-secondary); }

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
}

.status-badge.active, .status-badge.up { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.status-badge.inactive, .status-badge.down { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.status-badge.pending { background: rgba(245, 158, 11, 0.15); color: var(--accent-yellow); }

/* General badge */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.badge-primary { background: var(--accent-blue); color: white; }
.badge-success { background: var(--accent-green); color: white; }
.badge-warning { background: var(--accent-yellow); color: var(--bg-primary); }
.badge-danger { background: var(--accent-red); color: white; }

/* Data tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg-secondary);
}

.data-table td { font-size: 0.875rem; }
.data-table tr:hover td { background: rgba(6, 182, 212, 0.05); }

/* User cell */
.user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

/* Button group */
.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* Text utilities */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--accent-green); }
.text-danger { color: var(--accent-red); }

/* Form hint */
.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Notification toast */
.notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification.success { border-color: var(--accent-green); }
.notification.error { border-color: var(--accent-red); }

/* Card grid for groups */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.group-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: border-color 0.2s;
}

.group-card:hover {
    border-color: var(--accent-cyan);
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.group-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.group-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.group-stats {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.group-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Two column layout for modals */
.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.column h4 {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Member list */
.member-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.member-item:last-child {
    border-bottom: none;
}

.member-item:hover {
    background: var(--bg-tertiary);
}

.member-name {
    flex: 1;
    font-size: 0.9rem;
}

/* Large modal */
.modal-lg {
    max-width: 700px;
}

/* Button block */
.btn-block {
    width: 100%;
    justify-content: center;
}

/* Page header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    color: var(--text-primary);
}

/* Activity log */
.activity-log {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.activity-content {
    flex: 1;
    font-size: 0.875rem;
}

.activity-user {
    font-weight: 500;
    color: var(--accent-cyan);
}

/* Detail grid for monitor view */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Responsive updates */
@media (max-width: 768px) {
    .two-columns {
        grid-template-columns: 1fr;
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .groups-grid {
        grid-template-columns: 1fr;
    }
}
