/* DevOps Monitoring Dashboard Styles */
/* Inspired by cyberpunk/terminal aesthetics */

:root {
    --bg-primary: #0a0e14;
    --bg-secondary: #121820;
    --bg-card: #161d26;
    --bg-hover: #1e2734;
    
    --accent-primary: #00ff9d;
    --accent-secondary: #00b8ff;
    --accent-warning: #ffb800;
    --accent-danger: #ff3d5a;
    
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;
    
    --border-color: #21262d;
    --border-glow: rgba(0, 255, 157, 0.3);
    
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    --shadow-glow: 0 0 20px rgba(0, 255, 157, 0.15);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ============================================
   Header
============================================ */

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-title h1 {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.header-title .version {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.header-stats {
    display: flex;
    gap: 2rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

.header-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-stat .count {
    font-size: 1.25rem;
    font-weight: 700;
}

.header-stat.online .count {
    color: var(--accent-primary);
}

.header-stat.offline .count {
    color: var(--accent-danger);
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 1rem;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.header-btn.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* ============================================
   Controls Bar (Search & Sort)
============================================ */

.controls-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    max-width: 400px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i.fa-search {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 2.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 255, 157, 0.1);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.clear-search {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.clear-search:hover {
    color: var(--text-primary);
}

.sort-controls select {
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    transition: all 0.2s;
}

.sort-controls select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.sort-controls select:hover {
    border-color: var(--text-muted);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    transition: color 0.2s;
}

.back-btn:hover {
    color: var(--accent-primary);
}

/* ============================================
   Main Container
============================================ */

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
}

/* ============================================
   Server Cards Grid
============================================ */

.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
}

.server-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.server-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--border-color);
    transition: background 0.3s;
}

.server-card.online::before {
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary);
}

.server-card.offline::before {
    background: var(--accent-danger);
}

.server-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.server-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.server-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.server-domain {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-secondary);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: var(--bg-primary);
}

.server-status.online {
    color: var(--accent-primary);
}

.server-status.offline {
    color: var(--accent-danger);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

.server-status.offline .status-dot {
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.server-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.info-item {
    font-size: 0.8rem;
}

.info-label {
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.125rem;
}

.info-value {
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.server-metrics {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.metric-bar {
    flex: 1;
    background: var(--bg-primary);
    border-radius: 4px;
    height: 32px;
    padding: 0.25rem 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.metric-bar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: var(--value, 0%);
    transition: width 0.5s ease;
}

.metric-bar.cpu::after { background: var(--accent-secondary); }
.metric-bar.ram::after { background: var(--accent-warning); }
.metric-bar.disk::after { background: var(--accent-primary); }

.metric-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.metric-value {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
}

.server-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.action-btn:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.action-btn i {
    font-size: 0.875rem;
}

/* ============================================
   Server Detail Page
============================================ */

.server-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1200px) {
    .server-detail {
        grid-template-columns: 1fr;
    }
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.detail-card.full-width {
    grid-column: 1 / -1;
}

.detail-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-card-title i {
    color: var(--accent-secondary);
}

/* Copy Button */
.copy-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.copy-row:last-child {
    margin-bottom: 0;
}

.copy-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.copy-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-top: 0.25rem;
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.copy-btn.copied {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Editable Field */
.editable-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.editable-input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.editable-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.save-btn {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.save-btn:hover {
    opacity: 0.9;
}

.toggle-password-btn {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-password-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Progress Bars */
.resource-bar {
    margin-bottom: 1rem;
}

.resource-bar:last-child {
    margin-bottom: 0;
}

.resource-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.resource-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.resource-value {
    font-family: var(--font-mono);
    font-weight: 600;
}

.resource-track {
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.resource-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.resource-fill.cpu { background: linear-gradient(90deg, var(--accent-secondary), #0099cc); }
.resource-fill.ram { background: linear-gradient(90deg, var(--accent-warning), #cc9900); }
.resource-fill.disk { background: linear-gradient(90deg, var(--accent-primary), #00cc7d); }

.resource-fill.warning { background: linear-gradient(90deg, var(--accent-warning), #ff9500); }
.resource-fill.danger { background: linear-gradient(90deg, var(--accent-danger), #ff1a3d); }

/* Version History */
.version-list {
    max-height: 200px;
    overflow-y: auto;
}

.version-item {
    display: flex;
    justify-content: space-between;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.version-item:last-child {
    border-bottom: none;
}

.version-number {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent-primary);
}

.version-date {
    color: var(--text-muted);
}

/* Errors List */
.errors-list {
    max-height: 300px;
    overflow-y: auto;
}

.error-item {
    background: var(--bg-primary);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--accent-danger);
}

.error-item:last-child {
    margin-bottom: 0;
}

.error-message {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-primary);
    word-break: break-all;
}

.error-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Updates List */
.updates-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--accent-warning);
    color: var(--bg-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.update-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border-color);
}

.update-item:last-child {
    border-bottom: none;
}

.update-title {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.update-kb {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-secondary);
}

/* Backup Info */
.backup-info {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 1rem;
}

.backup-file {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.backup-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--accent-primary);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-card);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast i {
    color: var(--accent-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .servers-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 1rem;
    }
    
    .server-info {
        grid-template-columns: 1fr;
    }
}

