/* VMView Dashboard Styles */

:root {
    --color-bg: #f5f6fa;
    --color-surface: #ffffff;
    --color-text: #2d3436;
    --color-text-secondary: #636e72;
    --color-border: #dfe6e9;
    --color-primary: #0984e3;
    --color-primary-hover: #0773c5;
    --color-online: #00b894;
    --color-warning: #fdcb6e;
    --color-offline: #d63031;
    --color-online-bg: #e8f8f5;
    --color-warning-bg: #fef9e7;
    --color-offline-bg: #fdedec;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
}

/* Login */
.login-container {
    max-width: 380px;
    margin: 120px auto;
    padding: 40px;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.login-container h1 {
    font-size: 28px;
    margin-bottom: 4px;
    color: var(--color-primary);
}

.login-subtitle {
    color: var(--color-text-secondary);
    margin-bottom: 32px;
}

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

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(9, 132, 227, 0.15);
}

.error-msg {
    color: var(--color-offline);
    font-size: 13px;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--color-offline-bg);
    border-radius: 6px;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.btn:hover { background: var(--color-bg); }
.btn-primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-full { width: 100%; padding: 12px; font-size: 15px; }
.btn-sm { padding: 4px 12px; font-size: 12px; }

.btn-filter {
    background: transparent;
    border: 1px solid var(--color-border);
    padding: 6px 14px;
}
.btn-filter.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 20px;
    color: var(--color-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-text-secondary);
    font-size: 13px;
}

/* Stats Row */
.stats-row {
    display: flex;
    gap: 16px;
    padding: 20px 24px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 130px;
    padding: 20px;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.stat-online .stat-value { color: var(--color-online); }
.stat-warning .stat-value { color: #e17055; }
.stat-offline .stat-value { color: var(--color-offline); }

/* Filter Bar */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px 16px;
    gap: 16px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.filter-buttons {
    display: flex;
    gap: 6px;
}

/* VM Table */
.table-container {
    padding: 0 24px;
}

.vm-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.vm-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-secondary);
    background: #fafbfc;
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}

.th-sortable { cursor: pointer; user-select: none; }
.th-sortable:hover { color: var(--color-primary); }
.th-sortable.sort-asc::after { content: ' \u25B2'; font-size: 10px; }
.th-sortable.sort-desc::after { content: ' \u25BC'; font-size: 10px; }

.vm-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}

.vm-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.vm-table tbody tr:hover { background: #f8f9fa; }

.vm-table .loading {
    text-align: center;
    padding: 40px;
    color: var(--color-text-secondary);
}

/* Status Indicator */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
}

.status-dot.online { background: var(--color-online); box-shadow: 0 0 6px var(--color-online); }
.status-dot.warning { background: var(--color-warning); box-shadow: 0 0 6px var(--color-warning); }
.status-dot.offline { background: var(--color-offline); }

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.online { background: var(--color-online-bg); color: #00856a; }
.status-badge.warning { background: var(--color-warning-bg); color: #c0930a; }
.status-badge.offline { background: var(--color-offline-bg); color: var(--color-offline); }

/* User Tags */
.user-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #e8f0fe;
    border-radius: 4px;
    font-size: 12px;
    margin: 1px 2px;
    color: #1a56db;
}

.user-tag.rdp { background: #fce8e6; color: #c5221f; }

/* Progress Bar */
.progress-bar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.progress-track {
    flex: 1;
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
    min-width: 40px;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.progress-fill.low { background: var(--color-online); }
.progress-fill.medium { background: var(--color-warning); }
.progress-fill.high { background: var(--color-offline); }

/* Footer */
.footer-bar {
    display: flex;
    justify-content: space-between;
    padding: 12px 24px;
    color: var(--color-text-secondary);
    font-size: 12px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--color-surface);
    border-radius: var(--radius);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

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

.modal-header h2 { font-size: 18px; }

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--color-text-secondary);
}

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

.modal-body {
    padding: 24px;
}

.modal-body h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-secondary);
    margin: 24px 0 12px;
}

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-label {
    font-size: 12px;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value { font-weight: 500; }

/* Meters */
.detail-meters {
    display: flex;
    gap: 24px;
    margin-bottom: 8px;
}

.meter-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.meter-label {
    font-weight: 500;
    min-width: 30px;
}

.meter-bar {
    flex: 1;
    height: 16px;
    background: #eee;
    border-radius: 8px;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    border-radius: 8px;
    background: var(--color-primary);
    transition: width 0.3s;
}

.meter-text {
    min-width: 50px;
    text-align: right;
    font-weight: 500;
}

/* Detail Tables */
.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.detail-table th {
    padding: 8px 12px;
    text-align: left;
    font-size: 12px;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
    background: #fafbfc;
}

.detail-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
}

.event-login { color: var(--color-online); font-weight: 500; }
.event-logoff { color: var(--color-offline); font-weight: 500; }

/* Responsive */
@media (max-width: 768px) {
    .stats-row { padding: 12px; gap: 8px; }
    .stat-card { padding: 12px; min-width: 100px; }
    .stat-value { font-size: 24px; }
    .filter-bar { flex-direction: column; padding: 0 12px 12px; }
    .table-container { padding: 0 12px; overflow-x: auto; }
    .header { padding: 12px 16px; }
    .detail-meters { flex-direction: column; }
}
