:root {
  --primary-color: #0078d4;
  --word-color: #185abd;
  --excel-color: #107c41;
  --ppt-color: #c43e1c;
  --bg-color: #1e1e1e;
  --panel-bg: #2d2d2d;
  --text-color: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  color: var(--text-color);
  user-select: none;
}

#app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

#topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 38px;
  background-color: #121212;
  border-bottom: 1px solid #333333;
  padding: 0 12px;
  font-size: 13px;
  z-index: 10;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  font-weight: 600;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-word { background-color: var(--word-color); color: #fff; }
.badge-excel { background-color: var(--excel-color); color: #fff; }
.badge-powerpoint { background-color: var(--ppt-color); color: #fff; }

.btn {
  background: transparent;
  color: #cccccc;
  border: 1px solid #444444;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn:hover {
  background: #333333;
  color: #ffffff;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.btn:disabled:hover {
  background: transparent;
  color: #cccccc;
}

.btn-primary {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #ffffff;
  font-weight: 500;
}

.btn-primary:hover {
  background: #006abc;
}

#display-container {
  flex: 1;
  position: relative;
  width: 100%;
  height: calc(100% - 38px);
  background-color: #000000;
  overflow: hidden;
}

#display {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
}

#display canvas {
  display: block;
}

/* The remote desktop stays laid out but invisible until Office has started. */
#display.pending {
  visibility: hidden;
}

#displayLoading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  justify-content: center;
  color: #aaaaaa;
  font-size: 16px;
  z-index: 1;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #333333;
  border-top-color: #0078d4;
  border-radius: 50%;
  animation: loading-spin 0.9s linear infinite;
}

#displayLoading.failed .loading-spinner {
  display: none;
}

@keyframes loading-spin {
  to { transform: rotate(360deg); }
}

#displayLoading.hidden {
  display: none;
}

/* Modal Overlay Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(3px);
}

.modal-overlay.hidden {
  display: none !important;
}

.print-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  max-width: min(640px, calc(100vw - 48px));
  padding: 12px 20px;
  border-radius: 8px;
  background: #1f2937;
  color: #ffffff;
  font-size: 14px;
  line-height: 1.35;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  z-index: 120;
}

.print-toast.hidden {
  display: none !important;
}

.modal-card {
  background: #ffffff;
  color: #242424;
  width: 480px;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: modalIn 0.18s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #666;
  cursor: pointer;
}

.modal-body {
  padding: 18px;
  font-size: 14px;
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  background: #f7f7f7;
  border-top: 1px solid #e0e0e0;
}
