/* Sentinel360 Glassmorphic Premium Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --font-primary: 'Plus Jakarta Sans', sans-serif;
    --font-display: 'Outfit', sans-serif;
    
    --bg-main: #060913;
    --bg-surface: #0b0f19;
    --bg-card: rgba(15, 23, 42, 0.45);
    --bg-card-hover: rgba(30, 41, 59, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(99, 102, 241, 0.4);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent: #6366f1;
    --accent-rgb: 99, 102, 241;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    
    --online: #10b981;
    --online-glow: rgba(16, 185, 129, 0.25);
    --offline: #ef4444;
    --offline-glow: rgba(239, 68, 68, 0.25);
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.25);
    --unknown: #6b7280;
    
    --shadow-sm: 0 2px 8px -2px rgba(0,0,0,0.5);
    --shadow-md: 0 10px 25px -5px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-primary);
    line-height: 1.5;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.05) 0%, transparent 40%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: rgba(6, 9, 19, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo-icon {
    width: 2.2rem;
    height: 2.2rem;
    background: var(--accent-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
    font-weight: 700;
    font-family: var(--font-display);
    font-size: 1.2rem;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-badge {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--accent);
    color: var(--text-primary);
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

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

/* Grid & Dashboard layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 0.9rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* Server Cards Grid */
.server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Glassmorphic Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--unknown);
}

.card.status-online::before { background: var(--online); }
.card.status-offline::before { background: var(--offline); }

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

.server-title-container {
    display: flex;
    flex-direction: column;
}

.server-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.server-name:hover {
    color: var(--accent);
}

.server-ip {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-online {
    background: rgba(16, 185, 129, 0.1);
    color: var(--online);
    border: 1px solid rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 10px var(--online-glow);
}
.status-online .dot {
    background: var(--online);
    box-shadow: 0 0 8px var(--online);
}

.status-offline {
    background: rgba(239, 68, 68, 0.1);
    color: var(--offline);
    border: 1px solid rgba(239, 68, 68, 0.2);
    box-shadow: 0 0 10px var(--offline-glow);
}
.status-offline .dot {
    background: var(--offline);
    box-shadow: 0 0 8px var(--offline);
}

.status-unknown {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(107, 114, 128, 0.2);
}
.status-unknown .dot {
    background: var(--unknown);
}

.server-meta-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.metric-bar-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.metric-label-container {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 500;
}

.metric-label {
    color: var(--text-secondary);
}

.metric-value {
    color: var(--text-primary);
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Change progress bar color based on load value */
.progress-bar-fill.normal { background: var(--online); }
.progress-bar-fill.warning { background: var(--warning); }
.progress-bar-fill.danger { background: var(--offline); }

.server-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.monitor-type-badge {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 500;
}

/* Sidebar - Alerts List */
.sidebar-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.alert-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.alert-item {
    padding: 1rem;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alert-item.resolved {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.15);
}

.alert-msg {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.alert-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Modal Native Dialog styling */
dialog {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-hover);
    border-radius: 14px;
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    margin: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), var(--shadow-glow);
    font-family: var(--font-primary);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

dialog[open] {
    opacity: 1;
    transform: translate(-50%, -50%);
}

dialog::backdrop {
    background: rgba(6, 9, 19, 0.8);
    backdrop-filter: blur(8px);
}

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

.modal-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

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

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

.form-input, .form-select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    background: #0f172a;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.form-select option {
    background-color: #0b0f19;
    color: var(--text-primary);
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.25);
    background: rgba(255, 255, 255, 0.05);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 2rem;
}

/* Detail view style updates */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 1.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--accent);
}

.server-detail-header-card {
    margin-bottom: 2rem;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.6) 0%, rgba(30, 41, 59, 0.3) 100%);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 2rem;
}

.detail-header-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

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

.detail-header-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.detail-header-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-display);
}

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

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    height: 350px;
    display: flex;
    flex-direction: column;
}

.chart-container {
    flex-grow: 1;
    position: relative;
    width: 100%;
    height: 100%;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
    text-align: center;
}

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

/* Custom SNMP credentials popup wrapper */
.api-key-display {
    background: rgba(99, 102, 241, 0.08);
    border: 1px dashed var(--accent);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    position: relative;
}

.api-key-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.3rem;
}

.api-key-value-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.api-key-value {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-all;
}

.copy-btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
}

.copy-btn:hover {
    opacity: 0.9;
}
