/* General Tool Interface Styles */
.tool-interface {
    display: flex;
    flex-direction: row;
    gap: 18px; /* Main gap between options and results - Restored */
    margin-bottom: 20px; /* Restored margin */
    padding: 18px; /* Padding for the overall container - Restored */
    border: 1px solid #dcdcdc; 
    border-radius: 8px; 
    background-color: #f7f9fc; 
    box-sizing: border-box; /* Ensure padding and border are included in the element's total width and height */
}

.tool-options,
.tool-results-area {
    flex: 1 1 0; 
    padding: 18px; /* Consistent padding for both columns - Restored */
    border-radius: 6px; 
    box-sizing: border-box;
}

.tool-options {
    background-color: #ffffff; /* White background for options */
    border: 1px solid #e0e0e0; /* Light border for options */
    box-shadow: 0 1px 3px rgba(0,0,0,0.04); /* Subtle shadow for options */
    overflow-y: auto;
}

.tool-results-area { /* Container for preview and action buttons */
    background-color: #ffffff; /* White background for results */
    border: 1px solid #e0e0e0; /* Light border for results */
    box-shadow: 0 1px 3px rgba(0,0,0,0.04); /* Subtle shadow for results */
    display: flex;
    flex-direction: column;
    align-items: stretch; 
}

.tool-preview {
    width: 100%; /* Preview takes full width of its container (.tool-results-area) */
    flex-grow: 1; /* Allow tool-preview to take available vertical space */
    display: flex;
    flex-direction: column;
    /* Removed align-items: center; and justify-content: center; to allow content to fill space */
    background-color: #f0f4f8; /* Light blue-gray background for preview area */
    padding: 20px; /* Restored padding */
    border: 1px solid #d0d8e0; /* Softer border for preview */
    border-radius: 4px; 
    min-height: 380px; /* Restored min-height */
    overflow: auto; 
    margin-bottom: 20px; /* Restored space to action buttons */
    box-sizing: border-box; 
}

.tool-preview textarea {
    width: 100%;
    height: 100%; /* Make it fill the parent */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    min-height: 200px; /* Ensure a reasonable minimum height */
    resize: vertical; /* Allow vertical resizing */
}

.action-buttons {
    display: flex;
    flex-wrap: wrap; 
    gap: 12px; /* Slightly increased gap */
    justify-content: flex-start; /* Align buttons to the start */
    margin-top: auto; /* Pushes buttons to the bottom of the results area if space allows */
    padding-top: 15px; /* Space above buttons if they are not at the very bottom */
}

.tool-options h2, .tool-results-area h2 { 
    margin-top: 0;
    margin-bottom: 14px; /* Restored margin */
    font-size: 1.26em; /* Restored font size */
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 7px; /* Restored padding */
}

.form-group {
    margin-bottom: 14px; /* Restored margin */
}

.form-group label {
    display: block;
    margin-bottom: 4px; /* Restored margin */
    font-weight: bold;
    color: #555;
    font-size: 0.92em; /* Restored font size */
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px; /* Restored padding */
    border: 1px solid #ced4da; 
    border-radius: 4px;
    box-sizing: border-box; 
    font-size: 0.92em; /* Restored font size */
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; 
}
.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="url"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="tel"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #80bdff; /* Highlight color on focus */
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25); /* Glow effect on focus */
}


.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-group input[type="color"] {
    width: 60px; /* Smaller width for color pickers */
    height: 30px;
    padding: 2px;
    vertical-align: middle;
}
.form-group input[type="color"] + label { /* If label is after color input */
    margin-left: 5px;
}


.form-group input[type="file"] {
    padding: 5px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #777;
}

.tool-button {
    background-color: #007bff;
    color: white;
    padding: 9px 16px; /* Restored padding */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.92em; /* Restored font size */
    font-weight: 500; 
    transition: background-color 0.2s ease-in-out, transform 0.1s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.tool-button.primary-action { /* For the main generate/submit button */
    background-color: #007bff;
    color: white;
}
.tool-button.primary-action:hover {
    background-color: #0069d9;
}
.tool-button.secondary-action { /* For copy, clear, download buttons */
    background-color: #6c757d;
    color: white;
}
.tool-button.secondary-action:hover {
    background-color: #5a6268;
}
.tool-button:active {
    transform: translateY(1px); /* Slight press effect */
}


.tool-button:hover {
    background-color: #0056b3; /* Default hover, can be overridden by specific classes */
}

.tool-button:disabled {
    background-color: #e9ecef; /* Lighter disabled background */
    color: #6c757d; /* Muted text color for disabled */
    cursor: not-allowed;
    box-shadow: none;
}

/* New button styles for copy, export, clear */
.tool-button.btn-copy, .tool-button.btn-copy:disabled:hover {
    background-color: #007bff !important; /* Added !important to ensure override */
    color: white !important;
    border-color: #007bff !important;
}
.tool-button.btn-copy:hover:not(:disabled) {
    background-color: #0056b3 !important;
    border-color: #0056b3 !important;
}

.tool-button.btn-export, .tool-button.btn-export:disabled:hover {
    background-color: #28a745 !important;
    color: white !important;
    border-color: #28a745 !important;
}
.tool-button.btn-export:hover:not(:disabled) {
    background-color: #1e7e34 !important;
    border-color: #1e7e34 !important;
}

.tool-button.btn-clear, .tool-button.btn-clear:disabled:hover {
    background-color: #fd7e14 !important;
    color: white !important;
    border-color: #fd7e14 !important;
}
.tool-button.btn-clear:hover:not(:disabled) {
    background-color: #c6650f !important;
    border-color: #c6650f !important;
}

/*
  The !important tags are added to ensure these specific button styles
  override any general styles from .tool-button, .primary-action, or .secondary-action.
  Ideally, CSS specificity would handle this, but !important provides a stronger guarantee
  if there are conflicting specificities that are hard to resolve otherwise.
  We aim to remove .primary-action and .secondary-action from these buttons in HTML.
*/

#qr-code-result-container {
    margin-bottom: 15px;
    text-align: center; 
    width: 100%; /* Ensure it takes space within preview */
}
#qr-code-result-container img, 
#qr-code-result-container canvas,
#barcode-result-container svg { /* Ensure generated images/svgs are responsive */
    max-width: 100%;
    height: auto;
    display: block; /* Remove extra space below inline elements */
    margin: 0 auto; /* Center if not taking full width */
}


#qr-code-placeholder {
    background-color: transparent; /* Inherit from .tool-preview */
    color: #6c757d; /* Muted placeholder text */
    font-size: 1em; /* Larger placeholder text */
    padding: 20px;
    border: 2px dashed #adb5bd; /* Dashed border for placeholder */
    border-radius: 4px;
    width: auto; /* Adjust width as needed or make it 100% of parent */
    min-width: 150px; /* Ensure it's not too small */
    max-width: 80%;
    box-sizing: border-box;
}

.tool-instructions {
    margin-top: 20px; /* Restored margin */
    padding: 18px; /* Restored padding */
    background-color: #f7f9fc; /* Same as .tool-interface background */
    border: 1px solid #dcdcdc; /* Same as .tool-interface border */
    border-radius: 8px; /* Same as .tool-interface border-radius */
    box-sizing: border-box;
}

.tool-instructions h2 {
    margin-top: 0;
    margin-bottom: 14px; /* Restored margin */
    font-size: 1.26em; /* Restored font size */
    color: #333; /* Consistent with other h2 */
    border-bottom: 1px solid #eee; /* Consistent with other h2 */
    padding-bottom: 7px; /* Restored padding */
}

.tool-instructions ol {
    padding-left: 20px; /* Restored padding */
}
.tool-instructions ol li {
    margin-bottom: 8px; /* Restored margin */
    line-height: 1.6; /* Restored line height */
    /* font-size: 0.9em; Removed, rely on inherited/default */
}

/* Specific to QR Code Tool if needed */
.qr-code-tool .tool-options {
    /* any specific styles for qr code options */
}

.qr-code-tool .tool-preview {
    /* any specific styles for qr code preview */
}

/* Styles for dynamically shown/hidden input fields */
.content-type-field {
    /* display: none; Initially hidden, JS will show the relevant one */
}

/* Responsive adjustments if needed */
@media (max-width: 768px) {
    .tool-interface {
        flex-direction: column; 
        padding: 15px; /* Reduced padding for mobile */
    }
    .tool-options,
    .tool-results-area {
        flex-basis: auto; 
        width: 100%; 
        padding: 15px; /* Reduced padding for columns on mobile */
    }
    .tool-options {
        margin-bottom: 15px; /* Gap when stacked */
    }
    .tool-preview {
        min-height: 180px; /* Adjusted for mobile */
    }
    .action-buttons {
        justify-content: center; /* Center buttons on mobile */
    }
}
