/* ==================================================
   RESET
================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: Arial, sans-serif;
    background: #0e1117;
    color: #e6e6e6;
}
img { max-width: 100%; height: auto; }

/* ==================================================
   TOP NAV BAR
================================================== */
.topnav{
    display: flex; justify-content: space-between; align-items: center;
    background: #161b22; padding: 10px 16px; border-bottom: 1px solid #222; height: 50px;
}
.nav-left, .nav-right { display: flex; align-items: center; gap: 10px; }
.nav-logo { max-height: 22px; max-width: 140px; object-fit: contain; margin-right: 12px; }
.brand { font-weight: bold; color: #58a6ff; margin-right: 16px; }
.nav-btn{
    background: #21262d; color: #c9d1d9; border: 1px solid #30363d;
    padding: 6px 12px; border-radius: 6px;
    text-decoration: none; font-size: 13px;
    display: inline-flex; align-items: center; gap: 6px;
}
.nav-btn:hover { background: #30363d; }
.nav-btn.active { background: #238636; border-color: #2ea043; color: #fff; }
.nav-btn.danger { background: #8b1d1d; border-color: #b62323; }

/* ==================================================
   MAIN LAYOUT
================================================== */
.layout { display: flex; min-height: calc(100vh - 50px); width: 100%; }
.canvas { flex: 1; padding: 20px; overflow-x: auto; }
.muted { color: #9ca3af; }

/* ==================================================
   SIDEBAR
================================================== */
.sidebar{
    width: 220px; background: #161b22; border-right: 1px solid #222;
    padding: 12px; flex-shrink: 0;
}
.sidebar h3{ font-size: 13px; margin-bottom: 10px; color: #9da7b1; }
.company-link{
    display: block; padding: 8px 10px; margin-bottom: 6px;
    background: #21262d; color: #c9d1d9;
    text-decoration: none; border-radius: 6px;
    border: 1px solid #30363d;
}
.company-link:hover { background: #30363d; }
.company-link.active { background: #238636; border-color: #2ea043; color: #fff; }

/* ==================================================
   DASHBOARD GRID
================================================== */
.dashboard-grid{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.dashboard-grid .tile{
    position: relative;
    background: #161b22;
    border: 2px solid #30363d;
    border-radius: 10px;
    padding: 10px 12px;
    height: 90px;
    text-decoration: none;
    color: #e6e6e6;
    overflow: hidden;
}
.dashboard-grid .tile.up{
    border-color: #2ea043;
    box-shadow: 0 0 10px rgba(46,160,67,.55);
}
.dashboard-grid .tile.down{
    border-color: #b62323;
    box-shadow: 0 0 10px rgba(182,35,35,.55);
}
.tile-header{
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.dashboard-grid .tile .icon{
    width: 24px; height: 24px; flex-shrink: 0;
}
.dashboard-grid .tile .name{
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dashboard-grid .tile-meta{
    margin-top: 6px;
    font-size: 11px;
    color: #9da7b1;
}
.dashboard-grid .tile-meta .meta-line{
    white-space: normal;
    word-break: break-word;
}
.reboot-badge{
    position: absolute;
    top: 6px; right: 6px;
    background: #f59e0b; color: #000;
    font-size: 11px; padding: 2px 7px;
    border-radius: 10px; font-weight: 800;
}

/* ==================================================
   DEVICES PAGE
================================================== */
.bulk-bar{
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.bulk-bar select,
.bulk-bar button{
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    padding: 6px 10px;
    border-radius: 6px;
}

.devices-table{
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.devices-table th,
.devices-table td{
    padding: 10px;
    border-bottom: 1px solid #222;
    white-space: nowrap;
}
.devices-table th{ color: #9da7b1; font-weight: normal; }
.devices-table tr:hover{ background: #161b22; }

.devices-actions{
    text-align: right;
}
.devices-actions a,
.devices-actions button{
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
}
.devices-actions .danger{
    background: #8b1d1d;
    border-color: #b62323;
}

/* ==================================================
   EDIT DEVICE FORM
================================================== */
.edit-form{
    max-width: 480px;
    background: #161b22;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #30363d;
}

.form-row{
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.form-row label{
    font-size: 12px;
    color: #9da7b1;
    margin-bottom: 4px;
}

.form-row input,
.form-row textarea,
.form-row select{
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    padding: 8px 10px;
    border-radius: 6px;
}

/* ==================================================
   DEVICE VIEW
================================================== */
.metric-row{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 20px;
}
.metric-card{
    background: #1e2329;
    border-radius: 10px;
    padding: 14px 16px;
    border: 1px solid #242a31;
    min-height: 110px;
}
.metric-label{
    font-size: 13px;
    color: #9da7b1;
    margin-bottom: 8px;
}
.metric-value{
    font-size: 22px;
    font-weight: 700;
}

/* Gauges */
.gauge{
    width: 120px; height: 120px;
    border-radius: 50%;
    background: conic-gradient(#2ea043 calc(var(--pct) * 1%), #30363d 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0 auto;
}
.gauge::after{
    content: "";
    width: 90px; height: 90px;
    background: #0e1117;
    border-radius: 50%;
    position: absolute;
    z-index: 1;
}
.gauge-value{
    position: relative;
    z-index: 2;
    font-size: 18px;
    font-weight: 800;
}

/* Network */
.net-card{
    margin-top: 18px;
    background: #1e2329;
    border-radius: 10px;
    padding: 14px 16px;
    border: 1px solid #242a31;
}
.net-title{
    font-size: 13px;
    color: #9da7b1;
    margin-bottom: 10px;
}

/* Disks */
.disk-card{
    margin-top: 18px;
    background: #1e2329;
    border-radius: 10px;
    padding: 14px 16px;
    border: 1px solid #242a31;
}
.disk-row{ margin-top: 10px; }
.disk-label{
    font-size: 12px;
    color: #c9d1d9;
    margin-bottom: 6px;
}
.disk-bar{
    width: 100%;
    height: 12px;
    background: #30363d;
    border-radius: 10px;
    overflow: hidden;
}
.disk-fill{
    height: 100%;
    background: #2ea043;
}

/* Reboot table */
.reboot-table{
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px;
}
.reboot-table th,
.reboot-table td{
    padding: 8px 10px;
    border-bottom: 1px solid #222;
}
.reboot-table th{ color: #9da7b1; font-weight: normal; }

/* ==================================================
   MOBILE
================================================== */
@media (max-width: 900px){
    .sidebar{ display: none; }
    .layout{ flex-direction: column; }
    .canvas{ padding: 12px; }
}

/* Style for map markers */
.mapbox-dot {
    width: 20px;
    height: 20px;
    background-color: #00FF00; /* Default color */
    border-radius: 50%;
    cursor: pointer;
}

/* Dot colors based on status */
.mapbox-dot.green {
    background-color: #2ea043; /* Green for healthy */
}

.mapbox-dot.amber {
    background-color: #f39c12; /* Amber for warning */
}

.mapbox-dot.red {
    background-color: #e74c3c; /* Red for critical */
}
