/* General Styles */
body {
  font-family: victormono, monospace;
  margin: 0;
  padding: 0;
  background-color: #f9f9f9;
}
input, button {
  font-family: victormono, monospace;
  width: 100%;
}

.container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
  background-color: #ffffff;
  padding: 20px 2rem;
  width: 20rem;
  box-shadow: 2px 0 5px rgba(0,0,0,0.1);
  box-sizing: border-box;
  overflow-y: auto;
}

.sidebar h1 {
  text-align: center;
  color: #333;
  margin-bottom: 20px;
}

.instructions {
  background-color: #f4f4f4;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.instructions pre {
  background-color: #e9ecef;
  padding: 10px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 12px;
}

.input-section label {
  display: block;
  font-weight: bold;
  margin-bottom: 5px;
  color: #555;
}

textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
  font-size: 14px;
  box-sizing: border-box;
}

.buttons {
  text-align: center;
  margin-top: 20px;
}

.buttons button {
  margin: 5px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  background-color: #4287f5;
  color: #fff;
  transition: background-color 0.3s;
}

.buttons button:hover {
  background-color: #306edc;
}

/* Dropdown for Copy Format */
.copy-format-section {
    margin-top: 20px;
}

.copy-format-section label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #555;
}

.copy-format-section select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    width: 100%;
}

/* Custom Copy Input Styles */
.custom-copy-section {
    margin-top: 15px;
}

.custom-copy-section label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #555;
}

.custom-copy-section input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    font-size: 14px;
    box-sizing: border-box;
}

.custom-copy-section small {
    display: block;
    margin-top: 5px;
    color: #777;
    font-size: 12px;
}

/* Main Content Styles */
.main-content {
  flex-grow: 1;
  padding: 20px 5rem;
  box-sizing: border-box;
  overflow-y: auto;
}

.main-content h2 {
  color: #333;
  margin-bottom: 20px;
}

/* Results Display */
#results {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Group Styles */
.color-group {
  display: flex;
  flex-direction: column;
}

.group-name {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
  color: #555;
}

/* Color Items */
.color-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.color-result {
  display: flex;
  flex-direction: column;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s;
  width: 8rem;
  position: relative;
  cursor: pointer; /* Make the entire card clickable */
}

.color-result:hover {
  transform: scale(1.02);
}

.color-box {
  width: 100%;
  height: 4rem;
  margin-right: 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.color-name {
  font-size: 14px;
  color: #333;
  user-select: none;
  position: relative;
  cursor: pointer;
  padding: 0.5rem;
}

.color-name:hover {
  text-decoration: underline;
  color: #4287f5;
}

/* Copied Text Styles */
.copied-text {
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  text-transform: uppercase;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s;
  position: absolute;
  background-color: rgba(40, 167, 69, 0.8);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none; /* Allow clicks to pass through */
  border-radius: 4px;
  font-size: 12px;
}

/* Show copied-text when the color-result has 'copied' class */
.color-result.copied .copied-text {
  opacity: 1;
}

/* Tooltip for "Click to copy" */
.color-result .color-name::after {
  content: 'Click to copy';
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #333;
  color: #fff;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
}

.color-result:hover .color-name::after {
  opacity: 1;
}

/* Error Messages */
.error {
  color: red;
  font-weight: bold;
  padding: 8px;
  background-color: #ffe6e6;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Modal Styles */
#modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1000; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}

#modalContent {
  background-color: #fefefe;
  margin: 5% auto; /* 5% from the top and centered */
  padding: 20px;
  border: 1px solid #888;
  width: 90%; /* Could be more or less, depending on screen size */
  max-width: 700px;
  border-radius: 8px;
  position: relative;
}

#modalContent pre {
  background-color: #f4f4f4;
  padding: 15px;
  border-radius: 4px;
  overflow-x: auto;
  max-height: 400px;
  font-size: 14px;
}

#modalContent button {
  background-color: #28a745;
  margin-top: 10px;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.3s;
  font-size: 14px;
}

#modalContent button:hover {
  background-color: #1e7e34;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  position: absolute;
  right: 20px;
  top: 10px;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        box-shadow: none;
        border-bottom: 1px solid #ddd;
    }
    
    .main-content {
        padding: 10px;
    }
    
    #modalContent {
        margin: 20% auto;
    }

    /* Adjust copy-format-section and custom-copy-section margins for smaller screens */
    .copy-format-section, .custom-copy-section {
        margin-top: 15px;
    }
}