/* ==========================================================================
   Android 4.4 KitKat (Holo) Design System for Maincra Server Panel
   ========================================================================== */

:root {
  /* Holo Dark (Default) */
  --bg-canvas: #0f1011;
  --bg-surface: #18191a;
  --bg-card: #222326;
  --bg-card-alt: #1d1e20;
  --bg-header: #1b1c1e;
  --bg-input: #121314;
  --bg-dialog: #242528;
  
  --border-color: #32353a;
  --border-subtle: #25272a;
  
  --holo-blue: #33b5e5;
  --holo-blue-dark: #0099cc;
  --holo-blue-glow: rgba(51, 181, 229, 0.25);
  --holo-green: #99cc00;
  --holo-green-dark: #669900;
  --holo-red: #ff4444;
  --holo-red-dark: #cc0000;
  --holo-orange: #ffbb33;
  --holo-purple: #aa66cc;
  
  --text-primary: #ffffff;
  --text-secondary: #c0c4c8;
  --text-muted: #80868b;
  --text-inverse: #111111;

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-actionbar: 0 2px 4px rgba(0, 0, 0, 0.6);
}

body.holo-light {
  /* Holo Light */
  --bg-canvas: #f2f3f5;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-alt: #f8f9fa;
  --bg-header: #e6e8eb;
  --bg-input: #ffffff;
  --bg-dialog: #ffffff;
  
  --border-color: #d0d4d9;
  --border-subtle: #e1e4e8;
  
  --holo-blue: #0099cc;
  --holo-blue-dark: #007399;
  --holo-blue-glow: rgba(0, 153, 204, 0.2);
  --holo-green: #669900;
  --holo-green-dark: #4d7300;
  --holo-red: #cc0000;
  --holo-red-dark: #990000;
  --holo-orange: #ff8800;
  --holo-purple: #9933cc;
  
  --text-primary: #212529;
  --text-secondary: #495057;
  --text-muted: #6c757d;
  --text-inverse: #ffffff;

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.12);
  --shadow-actionbar: 0 2px 4px rgba(0, 0, 0, 0.15);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: 'Roboto', 'Segoe UI', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  background-color: var(--bg-canvas);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--holo-blue);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--holo-blue-dark);
  text-decoration: none;
}

/* ==========================================================================
   Action Bar (Top Bar)
   ========================================================================== */
.actionbar {
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-actionbar);
  min-height: 50px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.actionbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.actionbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: 0.5px;
}

.actionbar-brand:hover {
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: var(--holo-blue-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-title-main {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 1px;
}

.brand-title-sub {
  font-size: 10px;
  color: var(--holo-blue);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-top: -2px;
}

.actionbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 2px;
  font-size: 11px;
  cursor: pointer;
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: all 0.15s ease;
}
.theme-toggle-btn:hover {
  border-color: var(--holo-blue);
  color: var(--holo-blue);
}

.user-badge {
  color: var(--text-secondary);
  font-size: 12px;
}
.user-badge strong {
  color: var(--text-primary);
}

/* ==========================================================================
   Holo Tab Navigation
   ========================================================================== */
.holo-tabs-bar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.holo-tabs-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  white-space: nowrap;
}

.holo-tab {
  display: inline-flex;
  align-items: center;
  padding: 12px 18px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 4px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
}

.holo-tab:hover {
  color: var(--text-primary);
  text-decoration: none;
  background-color: rgba(255, 255, 255, 0.03);
}

.holo-tab.active {
  color: var(--holo-blue);
  border-bottom-color: var(--holo-blue);
  background-color: transparent;
}

/* ==========================================================================
   Page Layout & Headings
   ========================================================================== */
.page-container {
  max-width: 1200px;
  margin: 20px auto 40px;
  padding: 0 16px;
}

.holo-header {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.holo-title {
  font-size: 22px;
  font-weight: 300;
  letter-spacing: 0.5px;
  margin: 0 0 4px;
  color: var(--text-primary);
}

.holo-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

/* Iconic KitKat Holo Section Title with Blue Horizontal Bar */
.holo-section-divider {
  display: flex;
  flex-direction: column;
  margin: 24px 0 14px;
}

.holo-section-divider h2,
.holo-section-title {
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--holo-blue);
  margin: 0 0 6px;
}

.holo-divider-line {
  height: 2px;
  background-color: var(--holo-blue);
  width: 100%;
}

/* ==========================================================================
   Holo Cards & Panels
   ========================================================================== */
.holo-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}

.holo-card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background-color: var(--bg-card-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.holo-card-header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-primary);
}

.holo-card-body {
  padding: 16px;
}

/* ==========================================================================
   Metric Gauges / Grid
   ========================================================================== */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.metric-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  padding: 14px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.metric-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.metric-value {
  font-size: 26px;
  font-weight: 300;
  color: var(--text-primary);
  margin: 4px 0 2px;
  line-height: 1.1;
}

.metric-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.metric-bar-bg {
  height: 3px;
  background-color: var(--border-subtle);
  width: 100%;
  margin-top: 8px;
  border-radius: 1px;
  overflow: hidden;
}

.metric-bar-fill {
  height: 100%;
  background-color: var(--holo-blue);
  transition: width 0.3s ease;
}

.metric-bar-fill.green { background-color: var(--holo-green); }
.metric-bar-fill.orange { background-color: var(--holo-orange); }
.metric-bar-fill.red { background-color: var(--holo-red); }

/* ==========================================================================
   Buttons (Holo Flat Rectangular)
   ========================================================================== */
.holo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-radius: 2px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card-alt);
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  line-height: 1;
}

.holo-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--holo-blue);
  color: var(--holo-blue);
  text-decoration: none;
}

.holo-btn-primary {
  background-color: var(--holo-blue-dark);
  border-color: var(--holo-blue);
  color: #ffffff !important;
}

.holo-btn-primary:hover {
  background-color: var(--holo-blue);
  border-color: var(--holo-blue);
  color: #ffffff !important;
  box-shadow: 0 0 6px var(--holo-blue-glow);
}

.holo-btn-danger {
  background-color: var(--holo-red-dark);
  border-color: var(--holo-red);
  color: #ffffff !important;
}

.holo-btn-danger:hover {
  background-color: var(--holo-red);
  color: #ffffff !important;
}

.holo-btn-success {
  background-color: var(--holo-green-dark);
  border-color: var(--holo-green);
  color: #ffffff !important;
}

.holo-btn-success:hover {
  background-color: var(--holo-green);
  color: #ffffff !important;
}

.holo-btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

.holo-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed !important;
  pointer-events: none;
}

/* ==========================================================================
   Status Badges (Holo Pills)
   ========================================================================== */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
}

.status-pill.running {
  background-color: rgba(153, 204, 0, 0.15);
  border-color: var(--holo-green);
  color: var(--holo-green);
}

.status-pill.stopped {
  background-color: rgba(255, 68, 68, 0.15);
  border-color: var(--holo-red);
  color: var(--holo-red);
}

.status-pill.starting, .status-pill.stopping {
  background-color: rgba(255, 187, 51, 0.15);
  border-color: var(--holo-orange);
  color: var(--holo-orange);
}

.status-pill.crashed, .status-pill.unknown {
  background-color: rgba(204, 0, 0, 0.2);
  border-color: var(--holo-red-dark);
  color: var(--holo-red);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

/* ==========================================================================
   Holo Switch / Toggle Control
   ========================================================================== */
.holo-switch-container {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.holo-switch {
  position: relative;
  display: inline-block;
  width: 70px;
  height: 28px;
  user-select: none;
}

.holo-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.holo-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.holo-switch-slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 30px;
  left: 3px;
  bottom: 3px;
  background-color: #555;
  border-radius: 2px;
  transition: all 0.2s ease;
  z-index: 2;
}

.holo-switch input:checked + .holo-switch-slider {
  background-color: rgba(0, 153, 204, 0.2);
  border-color: var(--holo-blue);
}

.holo-switch input:checked + .holo-switch-slider::before {
  transform: translateX(32px);
  background-color: var(--holo-blue);
  box-shadow: 0 0 6px var(--holo-blue-glow);
}

.switch-label-on {
  color: var(--holo-blue);
  z-index: 1;
}

.switch-label-off {
  color: var(--text-muted);
  z-index: 1;
}

/* ==========================================================================
   Form Controls & Inputs
   ========================================================================== */
.holo-form-group {
  margin-bottom: 14px;
}

.holo-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.holo-input,
.holo-select,
.holo-textarea {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  border-radius: 2px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.holo-input:focus,
.holo-select:focus,
.holo-textarea:focus {
  outline: none;
  border-color: var(--holo-blue);
  box-shadow: 0 0 4px var(--holo-blue-glow);
}

.holo-help-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ==========================================================================
   Tables
   ========================================================================== */
.table-responsive {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 2px;
}

.holo-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.holo-table th {
  background-color: var(--bg-card-alt);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
}

.holo-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.holo-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* ==========================================================================
   Live Console
   ========================================================================== */
.console-window {
  background-color: #0c0d0e;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  height: 480px;
}

.console-output {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.45;
  color: #cfd8dc;
  white-space: pre-wrap;
  word-break: break-word;
}

.console-line {
  margin: 1px 0;
}
.console-line.info { color: #81d4fa; }
.console-line.warn { color: var(--holo-orange); }
.console-line.error { color: var(--holo-red); }

.console-input-row {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background-color: var(--bg-card-alt);
  border-top: 1px solid var(--border-color);
}

.console-input {
  flex: 1;
  background-color: #121314;
  border: 1px solid var(--border-color);
  color: #ffffff;
  padding: 8px 12px;
  font-family: 'Consolas', monospace;
  font-size: 13px;
  border-radius: 2px;
}

.console-input:focus {
  outline: none;
  border-color: var(--holo-blue);
  box-shadow: 0 0 5px var(--holo-blue-glow);
}

/* ==========================================================================
   Alerts & Notifications
   ========================================================================== */
.holo-alert {
  padding: 10px 14px;
  border-radius: 2px;
  margin-bottom: 14px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid transparent;
}

.holo-alert.success {
  background-color: rgba(153, 204, 0, 0.15);
  border-color: var(--holo-green-dark);
  color: var(--holo-green);
}

.holo-alert.error {
  background-color: rgba(255, 68, 68, 0.15);
  border-color: var(--holo-red-dark);
  color: var(--holo-red);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 900px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }
  .actionbar-inner {
    padding: 0 10px;
  }
  .page-container {
    padding: 0 10px;
  }
  .holo-tabs-inner {
    padding: 0 8px;
  }
  .holo-tab {
    padding: 10px 12px;
    font-size: 11px;
  }
}
