/* S-Tier List Maker Styles */

/* ===========================
   Google Fonts Import
   =========================== */
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap");

/* ===========================
   CSS Variables
   =========================== */
:root {
  /* Base Colors */
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #252525;

  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;

  /* Border Colors */
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);

  /* Effects */
  --shadow: rgba(0, 0, 0, 0.4);

  /* Accent Colors */
  --accent-primary: #606060;
  --accent-primary-light: #707070;
  --accent-primary-dark: #505050;
  --accent-danger: #f87171;

  /* Glass Effect */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
}

/* ===========================
   Base Styles
   =========================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family:
    "Space Grotesk",
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Oxygen,
    Ubuntu,
    Cantarell,
    sans-serif;
  background: #000000;
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

::selection {
  background-color: #ffffff;
  color: #0a0a0a;
}
/* ===========================
   Header
   =========================== */
header {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 20px 16px;
  text-align: center;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: var(--text-primary);
  font-weight: 900;
  letter-spacing: -0.01em;
}

header p {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 700;
  opacity: 0.8;
}

/* ===========================
   Controls Section
   =========================== */
.controls {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 12px;
}

.control-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

/* ===========================
   Buttons
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  justify-content: center;
  transition:
    opacity 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
  white-space: nowrap;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
}

.btn-label {
  display: inline-flex;
  align-items: center;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn:hover {
  opacity: 0.85;
}

.btn:active {
  opacity: 0.7;
}

.btn-primary,
.btn-secondary,
.btn-success {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-success:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-danger {
  background: var(--accent-danger);
  color: white;
  border-color: rgba(248, 113, 113, 0.3);
}

.btn-danger:hover {
  background: #e65555;
  border-color: rgba(248, 113, 113, 0.5);
}

/* ===========================
   Tier List
   =========================== */
.tier-list {
  border: 1px solid var(--border-color);
  overflow: hidden;
  background: var(--glass-bg);
}

.tier-row {
  display: flex;
  min-height: 80px;
  border-bottom: 1px solid var(--border-color);
}

.tier-row:last-child {
  border-bottom: none;
}

.tier-label {
  min-width: 100px;
  width: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  border-right: 1px solid var(--border-color);
  color: #4d4343;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
  padding: 8px;
  word-break: break-word;
  text-align: center;
  transition: filter 0.15s ease;
}

.tier-label:hover {
  filter: brightness(0.9);
}

.tier-label:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: -2px;
}

.tier-content {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 1px;
  padding: 1px;
  min-height: 82px;
}

.tier-content.drag-over {
  background: rgba(255, 255, 255, 0.06);
}

.tier-controls {
  width: 88px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-left: 4px solid;
  background: rgba(255, 255, 255, 0.02);
  padding: 0 8px;
}

.tier-controls button {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease;
}

.tier-controls button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
}

.tier-controls svg {
  width: 20px;
  height: 20px;
}

/* ===========================
   Tier Items
   =========================== */
.tier-item {
  width: 80px;
  height: 80px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  cursor: move;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: border-color 0.15s ease;
}

.tier-item:hover {
  border-color: var(--accent-primary);
}

.tier-item:active,
.tier-item.dragging {
  cursor: grabbing;
}

.tier-item.dragging {
  opacity: 0.4;
}

.tier-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.tier-item.text-item {
  padding: 6px;
  text-align: center;
  font-weight: 600;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===========================
   Items Pool
   =========================== */
.items-pool-container {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 16px;
}

.items-pool-container h3 {
  margin-bottom: 10px;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 700;
}

.items-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  min-height: 86px;
  padding: 1px;
  background: rgba(0, 0, 0, 0.2);
  border: 2px dashed var(--border-color);
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.items-pool.drag-over {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent-primary);
}

.items-pool:empty::before {
  content: "Drop items here or add images/text above";
  display: block;
  width: 100%;
  text-align: center;
  color: var(--text-primary);
  font-style: italic;
  padding: 50px 0;
}

.tier-actions {
  display: flex;
  justify-content: flex-end;
}

.btn-full-width {
  width: 100%;
}

/* ===========================
   Scrollbar (Custom)
   =========================== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #0a0a0a;
  border-left: 1px solid var(--border-color);
}

::-webkit-scrollbar-thumb {
  background: #333;
  border: 2px solid #0a0a0a;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ===========================
   Background Presets (Removed)
   =========================== */
/* Background themes removed */

/* ===========================
   Modal
   =========================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}

.modal.hiding {
  animation: fadeOut 0.15s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.modal-content {
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid var(--glass-border);
  padding: 24px;
  min-width: 360px;
  max-width: 90%;
  animation: slideUp 0.15s ease;
}

.modal.hiding .modal-content {
  animation: slideDown 0.15s ease forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.modal-content h3 {
  margin-bottom: 15px;
  font-size: 1.3rem;
  font-weight: 700;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-primary);
  font-weight: 600;
}

.modal-content input[type="text"],
.modal-content input[type="color"] {
  width: 100%;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 0;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.modal-content input[type="text"]:focus,
.modal-content input[type="color"]:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: rgba(0, 0, 0, 0.4);
}

.modal-content input[type="color"] {
  height: 40px;
  cursor: pointer;
}

.modal-content input[type="color"]:hover {
  border-color: var(--border-hover);
}

.modal-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 15px;
}

#tierModalDelete {
  margin-right: auto;
}

#confirmMessage {
  margin-bottom: 15px;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.4;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 768px) {
  body {
    padding: 8px;
  }

  .container {
    gap: 8px;
  }

  .tier-label {
    min-width: 60px;
    width: 60px;
    font-size: 1.25rem;
  }

  .tier-item {
    width: 60px;
    height: 60px;
  }

  header h1 {
    font-size: 1.75rem;
  }

  .control-group {
    flex-direction: column;
    gap: 10px;
  }

  .btn {
    width: 100%;
    justify-content: space-between;
    padding: 14px 16px;
    font-size: 1rem;
  }

  .btn-label {
    order: 1;
  }

  .btn-icon {
    order: 2;
    margin-left: 12px;
  }

  .modal-content {
    min-width: auto;
    width: 95%;
    padding: 20px;
  }

  .modal-buttons {
    flex-direction: column;
  }

  #tierModalDelete {
    margin-right: 0;
    order: 3;
  }

  .tier-row {
    min-height: 60px;
  }

  .tier-content {
    min-height: 64px;
    padding: 2px;
  }

  .items-pool {
    min-height: 68px;
    padding: 2px;
  }

  .items-pool:empty::before {
    padding: 30px 0;
  }

  .tier-controls {
    width: 80px;
    gap: 6px;
    padding: 0 6px;
  }

  .tier-controls button {
    width: 32px;
    height: 32px;
  }

  .tier-controls svg {
    width: 18px;
    height: 18px;
  }

  .tier-actions {
    justify-content: center;
  }
}
/* ===========================
   Print Styles
   =========================== */
@media print {
  .controls,
  .items-pool-container {
    display: none !important;
  }
}

/* ===========================
   Utility Animations
   =========================== */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
