/* ==========================================
   1. GLOBAL RESET & BASE SETTINGS
   ========================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  background: none;
  font-family: 'Poppins', sans-serif;
  color: #23272f;
}

button,
input[type='number'],
select,
#expand-btn,
#download-btn {
  cursor: pointer;
}

/* ==========================================
   2. OUTER CONTAINER (TRANSPARENT)
   ========================================== */
.outer-tool-card {
  width: 100%;
  max-width: 1200px;
  margin: 24px auto;
  background: transparent !important;
  border-radius: 8px;
  box-shadow: none;
  overflow: visible;
}

/* ==========================================
   3. TITLE ROW
   ========================================== */
.title-row {
  text-align: center;
  margin-bottom: 12px;
}

.title-row h1 {
  font-size: 1.8rem;
  font-weight: 600;
  color: #000;
}

.title-row p {
  margin-top: 4px;
  font-size: 1rem;
  color: #444;
}

/* ==========================================
   4. MAIN GRID LAYOUT
   ========================================== */
.main-tool-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  gap: 16px 0;
  padding: 0 24px 24px 24px;
}

.side-bar {
  grid-column: 1 / 2;
  grid-row: 1 / 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-bar .color-card {
  width: 140px;
  height: 48px;
  border: none;
  border-radius: 4px;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  padding: 0 8px;
  white-space: pre-wrap;
  background: transparent;
  word-break: break-word;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  color: #fff;
}

.side-bar .color-card:hover {
  transform: scale(1.05);
}

.side-bar .color-card.active {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* ==========================================
   6. MAIN BOX
   ========================================== */
.main-box {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
  position: relative;
  background: #00ff00;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 75%;
  justify-self: center;
  height: 225px;
}

#screen-box {
  width: 100%;
  height: 100%;
}

#expand-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 4px;
  padding: 6px;
  transition: background 0.2s ease;
  z-index: 2;
}
#expand-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}
#expand-btn svg {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

.tool-controls {
  grid-column: 3 / 4;
  grid-row: 1 / 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-title {
  font-size: 1rem;
  font-weight: 600;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

#resolution-select {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #cccccc;
  border-radius: 4px;
  font-size: 0.95rem;
}

.size-input-row input {
  width: 80px;
  padding: 6px 8px;
  border: 1px solid #cccccc;
  border-radius: 4px;
  font-size: 0.95rem;
}

#download-btn {
  padding: 8px 16px;
  background: #007bff;
  color: #ffffff;
  border: 1px solid #0056b3;
  border-radius: 4px;
  font-size: 0.95rem;
}
#download-btn:hover {
  background: #0056b3;
}

.palette-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.palette-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#color-hex {
  width: 80px;
  padding: 6px 8px;
  border: 1px solid #cccccc;
  border-radius: 4px;
  font-size: 0.95rem;
}

#color-picker {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  padding: 0;
}

.bottom-palette {
  grid-column: 2 / 3;
  grid-row: 2 / 3;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 0;
}

.bottom-palette .color-card {
  width: 140px;
  height: 48px;
  border: none;
  border-radius: 4px;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  padding: 0 8px;
  white-space: pre-wrap;
  background: transparent;
  word-break: break-word;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  color: #fff;
}

.bottom-palette .color-card[data-color="#ffffff"] {
  color: #000 !important;
}

.bottom-palette .color-card:hover {
  transform: scale(1.05);
}

.bottom-palette .color-card.active {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

#fullscreen-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #00ff00;
  z-index: 9999;
}

@media (max-width: 1100px) {
  .main-box {
    height: 175px;
  }
  .tool-controls {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 750px) {
  .main-tool-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 16px 16px 16px;
  }
  .side-bar {
    order: 0;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  .side-bar .color-card {
    width: 100px;
    height: 32px;
    font-size: 0.75rem;
  }
  .main-box {
    order: 1;
    width: 100%;
    min-width: 120px;
    height: 150px;
    justify-self: stretch;
  }
  .bottom-palette {
    order: 2;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0;
  }
  .bottom-palette .color-card {
    width: 100px;
    height: 32px;
  }
  .tool-controls {
    order: 3;
    width: 100%;
  }
}