/* Screen-reader only (visually hidden but accessible) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* General styles */
body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f9;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: 24px;
    text-align: center;
}

.summary-content, .storage-content {
    margin-top: 20px;
}

.storage-content {
    border-top: 1px solid #ddd;
}

/* Styles for each section (grouped and non-grouped) */
.tool-section {
    margin-bottom: 20px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.tool-section h3 {
    margin: 0;
}

.tool-section p {
    margin: 5px 0 10px;
    color: #666;
}

/* Summary box */
.summary-box {
    margin-bottom: 15px;
}

.summary-box h2 {
    font-size: 18px;
    margin: 0;
}

/* Collapsible section */
.collapse-section {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.collapse-content {
    display: none;
    margin-top: 10px;
}

/* Storage item styling */
.storage-item {
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.storage-item:last-child {
    border-bottom: none;
}

/* Input styles for key editing */
.edit-key-input {
    width: auto;
    padding: 5px;
    font-size: 1em;
    margin-bottom: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Edit box for values */
.edit-box {
    display: flex;
    flex-direction: column;
    margin-top: 5px;
}

/* Textarea styling */
textarea {
    width: 100%;
    max-width: 100%;
    overflow-y: hidden;
    resize: none; /* Disable manual resizing */
    padding: 5px;
    font-family: inherit;
}

/* Button container */
.edit-buttons {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

/* Styling Ok, Cancel, and Delete buttons in the edit box */
.edit-buttons .ok-button {
    padding: 8px 16px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.edit-buttons .ok-button:hover {
    background-color: #2980b9;
}

.edit-buttons .cancel-button {
    padding: 8px 16px;
    background-color: #7f8c8d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.edit-buttons .cancel-button:hover {
    background-color: #6c7a7b;
}

.edit-buttons .delete-button {
    padding: 8px 16px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.edit-buttons .delete-button:hover {
    background-color: #c0392b;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Styling for warning messages */
.edit-box .warning {
    color: red;
    font-size: 0.9em;
    margin-top: 5px;
}

/* Add attribute section */
.add-attribute-section {
    margin-top: 20px;
    padding: 20px;
    padding-left: 20px; /* Left padding to match input field */
    padding-right: 20px; /* Right padding to match input field */
    background-color: #333; /* Dark grey background */
    color: #f4f4f4; /* Light text color for readability */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.add-attribute-section h3 {
    margin-bottom: 10px;
    color: #f4f4f4; /* Light color for the heading */
}

.add-attribute-section input,
.add-attribute-section textarea {
    width: calc(100% - 20px); /* Adjust width to match section padding */
    padding: 10px; /* Consistent padding inside input fields */
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #444; /* Slightly lighter grey for input fields */
    color: #f4f4f4; /* Light text color for readability */
}

.add-attribute-section input::placeholder,
.add-attribute-section textarea::placeholder {
    color: #bbb; /* Placeholder text color */
}

.add-attribute-section button {
    padding: 10px 20px;
    cursor: pointer;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.add-attribute-section button:hover {
    background-color: #2980b9;
}

/* Note at the bottom of the page */
#storageContent p {
    font-style: italic;
    margin-top: 20px;
    color: #666;
}

/* Default styling for key and value with a transparent border */
.key > span,
.value {
    border: 1px dotted transparent; /* Transparent border to maintain space */
    border-radius: 3px;
    padding: 2px;
    box-sizing: border-box;
}

/* Key and value hover effect */
.key > span:hover,
.value:hover {
    border-color: blue; /* Changes border color to blue on hover */
    cursor: pointer;
}

/* Delete key icon */
.delete-key-icon {
    cursor: pointer;
    margin-right: 6px;
    opacity: 0.4;
    filter: grayscale(100%);
    transition: opacity 0.2s, filter 0.2s;
    font-size: 0.9em;
}

.delete-key-icon:hover {
    opacity: 1;
    filter: grayscale(0%);
}

/* Key styling */
.key {
    font-weight: bold;
}

/* Value styling */
.value {
    font-family: monospace;
    white-space: pre-wrap;
    color: #888;
}

/* Type styling (no hover effect) */
.type {
    color: #666;
}

/* Collapsible section header styling */
.section-header {
    display: flex;
    align-items: center;
    background-color: #f0f0f5; /* Light shading for header */
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

/* Triangle indicator for collapse/expand */
.triangle {
    font-size: 14px;
    margin-right: 10px;
    transition: transform 0.3s ease;
}

/* Title styling */
.section-header .title {
    margin: 0;
    font-size: 18px;
    flex: 1;
}

.section-header .title.empty a {
    color: darkgrey;
}

/* Collapsible content */
.collapse-content {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 5px;
    padding-bottom: 10px; /* Extra padding below items */
}

.clear-button, .save-button, .load-button, .bookmark-button {
    margin-left: 5px;
    padding: 5px 10px;
    cursor: pointer;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
}

.clear-button {
    background-color: #e74c3c;
}

.save-button:hover, .load-button:hover {
    background-color: #2980b9;
}

.clear-button:hover {
    background-color: #c0392b;
}

.bookmark-button {
    background-color: #f39c12; /* Orange background */
    transition: background-color 0.3s ease;
}
  
.bookmark-button:hover {
    background-color: #e67e22; /* Darker orange on hover */
}

.global-controls {
    display: flex;
    flex-wrap: wrap; /* Allow buttons to wrap onto a new line */
    justify-content: center;
    gap: 15px;
    padding: 20px;
    margin: 20px auto;
    max-width: 80%;
    background-color: #f0f4f8;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.global-controls button {
    padding: 10px 20px;
    cursor: pointer;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    min-width: 180px; /* Ensures buttons have a minimum width for readability */
    flex: 1 1 200px; /* Allows flexibility in resizing with a minimum size */
    text-align: center;
}

#clearAllButton {
    background-color: #e74c3c;
}

.global-controls button:hover {
    background-color: #2980b9;
}

#clearAllButton:hover {
    background-color: #c0392b;
}

.global-controls button:focus-visible {
    outline: 3px solid #ff9800;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(255, 152, 0, 0.3);
}

.global-options {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px auto;
    max-width: 80%;
    padding: 10px;
    background-color: #f0f4f8;
    border: 1px solid #ddd;
    border-radius: 8px;
}
.global-options input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
}
.global-options label {
    font-size: 16px;
    color: #333;
}

/* ===================== Import Preview Modal ===================== */

.import-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.import-preview-modal {
    background: #2c2c2c;
    color: #e8e8e8;
    border-radius: 10px;
    max-width: 640px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.import-preview-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.import-preview-header h2 {
    margin: 0;
    font-size: 20px;
    color: #fff;
}

.import-preview-filename {
    font-size: 13px;
    color: #999;
    font-family: monospace;
    word-break: break-all;
}

.import-preview-notice {
    background: #3a3a3a;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #ccc;
}

/* Import mode radio buttons */
.import-preview-mode {
    background: #363636;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.import-mode-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 14px;
    cursor: pointer;
    color: #ddd;
}

.import-mode-label input[type="radio"] {
    margin: 0;
    transform: scale(1.1);
    accent-color: #3498db;
}

.import-mode-label strong {
    color: #fff;
}

/* Select all / deselect all controls */
.import-preview-select-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.import-preview-select-btn {
    padding: 4px 12px;
    font-size: 12px;
    background: #444;
    color: #ccc;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.import-preview-select-btn:hover {
    background: #555;
    color: #fff;
}

/* Tool list */
.import-preview-tool-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 20px;
    max-height: 40vh;
    overflow-y: auto;
}

.import-preview-tool-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #353535;
    cursor: pointer;
    transition: background-color 0.15s;
}

.import-preview-tool-row:hover {
    background: #3e3e3e;
}

.import-preview-tool-row.has-existing {
    border-left: 3px solid #e67e22;
}

.import-preview-tool-row input[type="checkbox"] {
    margin: 0;
    margin-top: 3px;
    transform: scale(1.15);
    accent-color: #3498db;
    flex-shrink: 0;
}

.import-preview-tool-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.import-preview-tool-title {
    font-weight: bold;
    font-size: 14px;
    color: #fff;
}

.import-preview-tool-counts {
    font-size: 12px;
    color: #aaa;
}

.import-preview-tool-status {
    font-size: 12px;
}

.import-preview-tool-status.overwrite-warning {
    color: #e67e22;
}

.import-preview-tool-status.new-tool {
    color: #2ecc71;
}

/* Action buttons */
.import-preview-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid #444;
}

.import-preview-import-btn {
    padding: 10px 24px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.import-preview-import-btn:hover {
    background: #2980b9;
}

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

.import-preview-cancel-btn {
    padding: 10px 24px;
    background: #555;
    color: #ddd;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.import-preview-cancel-btn:hover {
    background: #666;
}

/* Scrollbar styling for the modal and tool list */
.import-preview-modal::-webkit-scrollbar,
.import-preview-tool-list::-webkit-scrollbar {
    width: 8px;
}

.import-preview-modal::-webkit-scrollbar-track,
.import-preview-tool-list::-webkit-scrollbar-track {
    background: #2c2c2c;
}

.import-preview-modal::-webkit-scrollbar-thumb,
.import-preview-tool-list::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.import-preview-modal::-webkit-scrollbar-thumb:hover,
.import-preview-tool-list::-webkit-scrollbar-thumb:hover {
    background: #777;
}
