/* ===== EC2 콘솔 - 다크 테마 ===== */
:root {
  --bg: #0d1017;
  --bg2: #11161f;
  --card: #161c26;
  --card2: #1c2330;
  --border: #2a323f;
  --text: #e6edf3;
  --muted: #8b97a7;
  --green: #3fb950;
  --green-d: #2ea043;
  --red: #f85149;
  --red-d: #da3633;
  --amber: #e3b341;
  --blue: #3b82f6;
  --blue-d: #2f6fe0;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

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

html, body {
  height: 100%;
  background: radial-gradient(1200px 600px at 50% -10%, #18202c 0%, var(--bg) 60%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Pretendard', 'Apple SD Gothic Neo', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.hidden { display: none !important; }

.card {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

/* ===== 공통 요소 ===== */
.title { font-size: 26px; font-weight: 700; text-align: center; }
.subtitle { font-size: 15px; color: var(--muted); text-align: center; margin-top: 8px; }
.lock-emoji { font-size: 46px; text-align: center; margin-bottom: 8px; }
.msg { font-size: 14px; color: var(--muted); text-align: center; margin-top: 14px; min-height: 20px; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--green); }

.input {
  width: 100%;
  padding: 16px 16px;
  font-size: 17px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  outline: none;
  margin-top: 16px;
  transition: border-color .15s;
}
.input::placeholder { color: #5b6470; }
.input:focus { border-color: var(--blue); }

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 0; }

/* ===== 버튼 ===== */
.btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 600;
  padding: 16px;
  cursor: pointer;
  color: #fff;
  transition: transform .05s, filter .15s, background .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-lg { padding: 18px; font-size: 19px; margin-top: 18px; }
.btn-primary { background: var(--blue); }
.btn-primary:hover:not(:disabled) { background: var(--blue-d); }
.btn-start { background: var(--green-d); }
.btn-start:hover:not(:disabled) { background: var(--green); }
.btn-stop { background: var(--red-d); }
.btn-stop:hover:not(:disabled) { background: var(--red); }
.btn-ghost { background: var(--card2); border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: #232b39; }
.btn-danger-ghost { background: transparent; border: 1px solid var(--red-d); color: var(--red); }

.link-btn { background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer; padding: 6px; }
.link-btn:hover { color: var(--text); text-decoration: underline; }

/* ===== 사용자 제어 화면 ===== */
.machine-name { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 22px; word-break: break-all; }

.status-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 26px 0 30px;
}
.status-dot {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: #3a4250;
  box-shadow: 0 0 0 0 rgba(0,0,0,0);
  transition: background .25s;
}
.status-dot.on   { background: var(--green); box-shadow: 0 0 40px rgba(63,185,80,.5); }
.status-dot.off  { background: #4a5260; }
.status-dot.busy { background: var(--amber); animation: pulse 1.2s ease-in-out infinite; }
.status-dot.bad  { background: var(--red); }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(227,179,65,.45); opacity: .9; }
  50%     { box-shadow: 0 0 0 18px rgba(227,179,65,0); opacity: 1; }
}
.status-text { font-size: 24px; font-weight: 700; }

.ip-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  cursor: pointer;
  user-select: all;
}
.ip-box:hover { border-color: var(--blue); }
.ip-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.ip-value { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; color: #79c0ff; word-break: break-all; }

.btn-action { font-size: 20px; padding: 20px; }

.foot { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; }

/* ===== 관리자 화면 ===== */
.admin-wrap { max-width: 920px; margin: 0 auto; padding: 28px 16px 60px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.admin-header h1 { font-size: 22px; font-weight: 700; }
.brand { display: flex; align-items: center; gap: 10px; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 20px;
}
.panel h2 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.panel .hint { font-size: 13px; color: var(--muted); margin-bottom: 14px; line-height: 1.5; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

.field label { margin-top: 0; margin-bottom: 0; }
.field .input { margin-top: 6px; }

.row-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.row-actions .btn { width: auto; padding: 12px 20px; font-size: 15px; }

/* 머신 카드 목록 */
.machine-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
}
.machine-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.machine-title { font-size: 18px; font-weight: 700; }
.machine-meta { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.7; word-break: break-all; }
.machine-meta code { font-family: ui-monospace, Menlo, monospace; color: #adbac7; background: var(--bg2); padding: 2px 6px; border-radius: 6px; }

.url-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px; margin-top: 10px;
  font-family: ui-monospace, Menlo, monospace; font-size: 14px; color: #79c0ff;
  cursor: pointer;
}
.url-pill:hover { border-color: var(--blue); }

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 700; padding: 7px 14px; border-radius: 999px;
  background: #2a323f; color: var(--muted);
}
.badge .d { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.badge.on  { background: rgba(63,185,80,.15);  color: var(--green); }
.badge.off { background: rgba(139,151,167,.15); color: var(--muted); }
.badge.busy{ background: rgba(227,179,65,.15); color: var(--amber); }
.badge.bad { background: rgba(248,81,73,.15);  color: var(--red); }

.card-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.card-actions .btn { width: auto; padding: 10px 16px; font-size: 14px; border-radius: 10px; }

.empty { text-align: center; color: var(--muted); padding: 30px; font-size: 15px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 유틸리티 (CSP 때문에 inline style 대신 클래스 사용) ===== */
.brand-emoji { font-size: 24px; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.btn-inline { width: auto; padding: 12px 18px; font-size: 14px; border-radius: 10px; }
.mt-10 { margin-top: 10px; }
.mt-14 { margin-top: 14px; }
.loadmsg { margin-top: 8px; margin-bottom: 0; }
.text-left { text-align: left; }

/* ===== 위장(decoy): 브라우저 기본 Apache 404 처럼 보이게 (흰 배경/Times/좌상단) ===== */
.decoy-body { background: #fff; }
.decoy-apache {
  margin: 8px; color: #000;
  font-family: "Times New Roman", Times, serif;
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.decoy-apache h1 { font-size: 2em; font-weight: bold; margin: 0.67em 0; }
.decoy-apache p { font-size: 1em; margin: 1em 0; }
.decoy-apache hr { border: 0; border-top: 1px solid #000; margin: 0.5em 0; height: 0; }
.decoy-apache address { font-style: italic; font-size: 1em; display: block; }

/* ===== 로그인 모달 ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(0, 0, 0, .65);
}
.modal-box {
  width: 100%; max-width: 320px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 22px; box-shadow: var(--shadow);
}
.modal-box .input { margin-top: 0; }
.modal-box .btn { margin-top: 12px; }
.modal-msg { font-size: 13px; color: var(--red); text-align: center; min-height: 18px; margin-top: 10px; }
.shake { animation: shake .3s ease; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 60% { transform: translateX(7px); } }
