/**
 * ============================================================================
 * Ragnarok Online Authentic Retro UI Stylesheet
 * ============================================================================
 */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Cinzel:wght@700;900&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: 'Nunito', sans-serif;
  background-color: #090D16;
  color: #F8FAFC;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  cursor: crosshair;
}

/* ==========================================================================
   CLASSIC RO RETRO WINDOW FRAME
   ========================================================================== */
.ro-window {
  position: absolute;
  background: rgba(30, 41, 59, 0.94);
  border: 2px solid #64748B;
  border-radius: 6px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.ro-header {
  background: linear-gradient(180deg, #3B82F6 0%, #1D4ED8 100%);
  color: #FFFFFF;
  font-weight: 800;
  font-size: 11px;
  padding: 5px 8px;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.ro-header:active {
  cursor: grabbing;
}

.ro-close-btn {
  background: #DC2626;
  border: 1px solid #B91C1C;
  color: white;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s;
}

.ro-close-btn:hover {
  background: #EF4444;
}

.ro-content {
  padding: 10px;
  overflow-y: auto;
  max-height: calc(100% - 28px);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}
::-webkit-scrollbar-thumb {
  background: #64748B;
  border-radius: 3px;
}

/* ==========================================================================
   BASIC INFO HUD (Top Left)
   ========================================================================== */
#hud-player-info {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 220px;
  background: rgba(15, 23, 42, 0.88);
  border: 1.5px solid #475569;
  border-radius: 6px;
  padding: 8px 10px;
  z-index: 40;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.gauge-bar {
  position: relative;
  height: 12px;
  background: #1E293B;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 3px;
  border: 1px solid rgba(0, 0, 0, 0.5);
}

.gauge-fill {
  height: 100%;
  transition: width 0.15s ease-out;
}

.gauge-label {
  position: absolute;
  inset: 0;
  font-size: 8.5px;
  font-weight: 800;
  color: #FFFFFF;
  text-align: center;
  line-height: 12px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

/* ==========================================================================
   TARGET HUD (Top Center)
   ========================================================================== */
#hud-target {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  background: rgba(15, 23, 42, 0.88);
  border: 1.5px solid #EF4444;
  border-radius: 6px;
  padding: 6px 10px;
  z-index: 40;
  display: none;
}

/* ==========================================================================
   CAST BAR (Center Screen)
   ========================================================================== */
#hud-cast-bar {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 220px;
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid #F59E0B;
  border-radius: 6px;
  padding: 6px;
  z-index: 55;
  display: none;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

/* ==========================================================================
   RADAR MINI-MAP (Top Right)
   ========================================================================== */
#hud-minimap-container {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 140px;
  height: 160px;
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid #64748B;
  border-radius: 6px;
  z-index: 40;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#hud-minimap-header {
  font-size: 9.5px;
  font-weight: 800;
  background: #334155;
  color: #F8FAFC;
  padding: 4px;
  text-align: center;
}

#minimap-canvas {
  width: 100%;
  height: 135px;
  background: #020617;
}

/* ==========================================================================
   HOTBAR (Bottom Center)
   ========================================================================== */
#hud-hotbar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid #475569;
  border-radius: 8px;
  padding: 6px 8px;
  z-index: 45;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7);
}

.hotbar-slot {
  width: 36px;
  height: 36px;
  background: #1E293B;
  border: 1.5px solid #64748B;
  border-radius: 4px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s;
}

.hotbar-slot:hover {
  border-color: #38BDF8;
}

.hotbar-num {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 8px;
  font-weight: 900;
  color: #94A3B8;
}

.hotbar-count {
  position: absolute;
  bottom: 1px;
  right: 3px;
  font-size: 8px;
  font-weight: 800;
  color: #FFFFFF;
  text-shadow: 0 1px 2px black;
}

/* ==========================================================================
   CHATBOX (Bottom Left)
   ========================================================================== */
#hud-chatbox {
  position: absolute;
  bottom: 14px;
  left: 14px;
  width: 380px;
  height: 200px;
  background: rgba(15, 23, 42, 0.88);
  border: 1.5px solid #475569;
  border-radius: 6px;
  z-index: 45;
  display: flex;
  flex-direction: column;
}

.chat-tab {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  background: #1E293B;
  color: #94A3B8;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

.chat-tab.active {
  background: #3B82F6;
  color: white;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#chat-input-wrapper {
  display: flex;
  border-top: 1px solid #334155;
  background: #0F172A;
}

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #F8FAFC;
  padding: 5px 8px;
  font-size: 11px;
  outline: none;
}

/* ==========================================================================
   STATUS & STATS WINDOW (Alt+A)
   ========================================================================== */
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 11px;
}

.stat-btn-plus {
  background: #10B981;
  border: none;
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-btn-plus:disabled {
  background: #475569;
  cursor: not-allowed;
  opacity: 0.5;
}

/* ==========================================================================
   INVENTORY GRID (Alt+E)
   ========================================================================== */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
}

.inv-slot {
  width: 38px;
  height: 38px;
  background: #0F172A;
  border: 1px solid #475569;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.inv-slot:hover {
  border-color: #38BDF8;
}

.inv-count {
  position: absolute;
  bottom: 1px;
  right: 2px;
  font-size: 8px;
  font-weight: 800;
  color: #FFFFFF;
}

/* ==========================================================================
   LOGIN / CHARACTER SELECT MODAL
   ========================================================================== */
#login-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 360px;
  background: #1E293B;
  border: 2px solid #3B82F6;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  text-align: center;
}
