/* General container for the Text Reverser - Wider Layout */
#text-reverser-container {
  max-width: 1100px; /* FIX: Set to 1100px as requested */
  margin: 2rem auto; /* Centers the tool block on the page */
  padding: 2.5rem;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  font-family: Arial, sans-serif;
  color: #333333;
  text-align: left !important; /* Ensures all content inside this container aligns LEFT by default */
}

h2 {
  color: #333333;
  margin-bottom: 2rem;
  font-size: 2.2rem;
  font-weight: bold;
  text-align: left !important; /* Force main title to left-align */
}

h3 {
  color: #555555;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: bold;
  text-align: left !important; /* Force subheadings to left-align */
}

/* Two Column Layout Styling */
.tool-columns {
    display: flex; /* Enable Flexbox for columns */
    flex-wrap: wrap; /* Allow columns to wrap to new lines on smaller screens */
    gap: 20px; /* Space between columns */
    margin-bottom: 2.5rem; /* Space before buttons/error message */
}

.column {
    flex: 1 1 calc(50% - 10px); /* Distribute space: grow, shrink, and base width (50% minus half the gap) */
    box-sizing: border-box; /* Include padding/border in width calculation */
}

/* Input/Output Sections within columns */
.input-section,
.output-section {
    text-align: left !important;
    height: 100%; /* Ensure sections fill their column height if content varies */
    display: flex; /* Use flex to align label and textarea */
    flex-direction: column;
}

.input-group {
    margin-bottom: 1.2rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: bold;
    color: #333333;
    font-size: 1rem;
    text-align: left !important;
}

textarea { /* Styling for both input and output textareas */
    width: 100%;
    padding: 10px 12px;
    font-size: 0.95rem;
    border: 1px solid #dddddd;
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #f9f9f9;
    color: #333333;
    text-align: left !important;
    resize: vertical; /* Allow vertical resizing only */
    min-height: 200px; /* Minimum height for textareas */
    line-height: 1.5; /* Improve readability */
    flex-grow: 1; /* Allow textarea to fill available space in column */
}

textarea:focus {
    border-color: #ff8c00; /* Orange focus color */
    box-shadow: 0 0 0 2px rgba(255, 140, 0, 0.15);
    outline: none;
    background-color: #ffffff;
}

/* Styling for the output textarea to make it look distinct but still copyable */
#outputText {
    background-color: #f0f0f0; /* Slightly different background for output */
    border: 1px solid #cccccc;
    color: #555555;
    cursor: text; /* Allow text selection */
}

/* Button Group - for both Clear and Copy buttons */
.button-group {
  display: flex;
  justify-content: center; /* Centers buttons */
  gap: 0.8rem; /* Space between buttons */
  margin-top: 2rem; /* Space above button group */
  flex-wrap: wrap; /* Allows buttons to wrap on smaller screens */
}

/* Styling for ALL buttons within the button-group */
.button-group button { /* Targeting buttons inside .button-group */
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: bold;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  background-color: #ff8c00 !important; /* IMPORTANT: Force orange color */
  color: #ffffff !important; /* IMPORTANT: Force white text color */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  min-width: 150px; /* Make buttons slightly wider for better appearance */
}

.button-group button:hover {
    background-color: #e67e00 !important; /* IMPORTANT: Force hover color */
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.button-group button:active {
    background-color: #cc7000 !important; /* IMPORTANT: Force active color */
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Error Message */
.error-message {
    color: #e74c3c; /* Red error message */
    font-size: 0.95rem;
    margin-top: 1rem;
    text-align: center !important; /* Center error message */
    font-weight: bold;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #text-reverser-container {
        padding: 1.5rem;
        margin: 1rem auto;
    }
    h2 {
        font-size: 1.8rem;
    }
    h3 {
        font-size: 1.3rem;
    }
    /* Columns stack on smaller screens */
    .tool-columns {
        flex-direction: column; /* Stack columns vertically */
        gap: 0; /* Remove gap when stacked */
    }
    .column {
        flex: 1 1 100%; /* Each column takes full width */
        margin-bottom: 2rem; /* Add spacing between stacked columns */
    }
    .column:last-child {
        margin-bottom: 0; /* No margin after the last stacked column */
    }

    .input-group label {
        font-size: 0.95rem;
    }
    textarea {
        padding: 0.8rem;
        font-size: 0.9rem;
        min-height: 120px; /* Adjust min-height for mobile if needed */
    }
    .button-group button { /* Both buttons */
        width: 100%; /* Full width on mobile */
        min-width: unset;
        padding: 0.9rem 1.2rem;
        font-size: 0.95rem;
    }
    .button-group {
        gap: 0.6rem;
    }
}

@media (max-width: 480px) {
    #text-reverser-container {
        padding: 1rem;
    }
    h2 {
        font-size: 1.6rem;
    }
    h3 {
        font-size: 1.2rem;
    }
    .input-group label {
        font-size: 0.85rem;
    }
    textarea {
        padding: 0.7rem;
        font-size: 0.8rem;
    }
    .button-group button {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }
}