/* Table Controls Styles */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    flex-wrap: nowrap;
    gap: 15px;
    overflow-x: auto;
}

/* Top Table Controls */
.table-controls:not(.table-controls-bottom) {
    margin-bottom: 10px;
    overflow-x: visible;
}

/* Bottom Table Controls */
.table-controls-bottom {
    margin-top: 10px;
    border-top: 1px solid #ddd;
    position: relative;
    background-color: #f5f5f5;
    z-index: 100;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    flex-wrap: nowrap;
    gap: 15px;
    overflow-x: auto;
    min-height: 60px; /* Ensure consistent height for the bottom controls */
    width: 100%; /* Ensure it takes full width */
}

/* Button Styles */
/* Action Menu Styles */
.action-menu-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.action-menu {
    display: flex;
    gap: 5px;
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.dropdown-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 9999;
    border-radius: 5px;
    overflow: hidden;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-item {
    color: #4a4a4a;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.3s;
}

.dropdown-item:hover {
    background-color: #e6e6fa;
}

.dropdown-item:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.action-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.action-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.action-status {
    font-size: 14px;
    padding: 5px 10px;
    border-radius: 4px;
    display: inline-block;
    min-width: 200px;
}

.action-status.loading {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.action-status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.action-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.action-status.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.save-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.save-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.save-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.save-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.save-status {
    font-size: 14px;
    padding: 5px 10px;
    border-radius: 4px;
    display: inline-block;
    min-width: 200px;
}

.save-status.loading {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.save-status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.save-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.save-status.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.rows-per-page {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rows-per-page label {
    font-size: 14px;
    color: #4a4a4a;
}

.rows-per-page select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    cursor: pointer;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Locale Selectors Container */
.locale-selectors-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-container label {
    font-size: 14px;
    color: #4a4a4a;
}

.search-container input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    min-width: 200px;
}

.search-input-wrapper {
    display: flex;
    position: relative;
    align-items: center;
}

.search-input-wrapper input {
    padding-right: 50px; /* Only room for the search icon button */
    border-right: none; /* Remove right border to blend with the button */
}

/* Make placeholder text in the search input ~50% smaller */
#slot-search::placeholder,
#sc-slot-search::placeholder { font-size: 60%; }
#slot-search::-webkit-input-placeholder,
#sc-slot-search::-webkit-input-placeholder { font-size: 60%; }
#slot-search::-moz-placeholder,
#sc-slot-search::-moz-placeholder { font-size: 60%; }
#slot-search:-ms-input-placeholder,
#sc-slot-search:-ms-input-placeholder { font-size: 60%; }
#slot-search:-moz-placeholder,
#sc-slot-search:-moz-placeholder { font-size: 60%; }

.search-icon {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-left: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 16px;
    padding: 8px 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-icon:hover {
    background-color: #667eea;
    color: white;
}

/* Minimalistic search fields toggle (hexagon) */
.search-filter-group { position: relative; display: flex; align-items: center; }

.search-filter-toggle {
    position: relative; /* normal flow on the left side */
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.search-filter-toggle:hover {
    background-color: #f3f4ff;
    color: #4f46e5; /* indigo */
    border-color: #c7d2fe;
}

.search-filter-toggle .hex-icon {
    display: block;
    pointer-events: none; /* let button receive the click */
}

/* Dropdown menu for search fields */
.search-filter-menu {
    position: absolute;
    left: 0; /* align under the toggle on the left */
    top: calc(100% + 6px);
    min-width: 200px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.10);
    padding: 8px 10px;
    display: none; /* hidden by default */
    z-index: 1000;
}

.search-filter-menu.open { display: block; }

.search-filter-menu .menu-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    margin-bottom: 6px;
    padding: 2px 6px;
}

.search-filter-menu .menu-item {
    display: grid;
    grid-template-columns: 18px auto;
    align-items: center;
    column-gap: 8px;
    justify-content: start;
    font-size: 14px;
    color: #374151;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    width: 100%;
}

.search-filter-menu .menu-item:hover {
    background: #f3f4f6;
}

.search-filter-menu .menu-item:focus-visible {
    outline: 2px solid #c7d2fe;
    outline-offset: 2px;
}

.search-filter-menu .menu-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0; /* прибрати дефолтні відступи */
    accent-color: #4f46e5; /* індиго як у кнопки */
}

.pagination {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination button {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination button:hover {
    background-color: #667eea;
    color: white;
}

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

.pagination button:disabled:hover {
    background-color: white;
    color: initial;
}

.page-info {
    font-size: 14px;
    color: #4a4a4a;
}

/* Cell Content Modal */
#cell-content-modal .modal-content {
    max-width: 700px;
    width: 80%;
}

.cell-content-wrapper {
    margin: 15px 0;
}

#cell-content-text {
    width: 100%;
    min-height: 250px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    background-color: #fcfcfc;
    color: #333;
    outline: none;
    transition: border-color 0.2s;
}

#cell-content-text:focus {
    border-color: #667eea;
}

#copy-cell-content.success {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
}

#copy-cell-content.error {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

/* Modal Styles */
/* Field selection list: three-column grid */
.field-checkboxes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 16px;
    margin: 20px 0;
    max-height: 50vh;
    overflow-y: auto;
}

@media (max-width: 600px) {
    .field-checkboxes, .locale-checkboxes {
        grid-template-columns: 1fr; /* Stack on very small screens */
    }
}

.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 50%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

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

.locale-checkboxes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 16px;
    margin: 20px 0;
    max-height: 50vh;
    overflow-y: auto;
}

.locale-checkbox-item {
    margin: 10px 0;
    display: flex;
    align-items: center;
}

.locale-checkbox {
    margin-right: 10px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.cancel-button {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
}


/* Posting Results: center status, keep Save on right, search left */
.has-results-posting .table-controls:not(.table-controls-bottom) {
  display: grid;
  grid-template-columns: 1fr auto 1fr; /* left | center | right */
  align-items: center;
  gap: 15px;
}

.has-results-posting .table-controls:not(.table-controls-bottom) .controls-left {
  justify-self: start;
}

.has-results-posting .table-controls:not(.table-controls-bottom) .controls-center {
  justify-self: center;
  text-align: center;
}

.has-results-posting .table-controls:not(.table-controls-bottom) .controls-right {
  justify-self: end;
}


/* Small modal variant for status */
.modal-content.small {
    width: 360px;
    max-width: 90%;
    margin: 15% auto;
}

/* Status modal enhancements */
#status-modal .modal-content.small {
    width: 420px;
    max-width: 92%;
    animation: statusModalIn 180ms ease-out;
}

#status-modal h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #333;
}

#status-message.action-status {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    background-color: #f7f9fb;
    border: 1px solid #e6eef5;
    border-left-width: 6px;
    word-break: break-word;
    line-height: 1.4;
}

/* Icons per status type */
#status-message.action-status::before {
    content: "ℹ️";
    display: inline-block;
    font-size: 18px;
    line-height: 1;
}
#status-message.action-status.loading::before { content: "⏳"; }
#status-message.action-status.success::before { content: "✅"; }
#status-message.action-status.error::before { content: "⚠️"; }
#status-message.action-status.info::before { content: "ℹ️"; }

/* Colored left border per type */
#status-message.action-status.loading { border-left-color: #adb5bd; background-color: #f8f9fa; }
#status-message.action-status.success { border-left-color: #28a745; background-color: #edf7ef; }
#status-message.action-status.error { border-left-color: #dc3545; background-color: #fdf0f1; }
#status-message.action-status.info { border-left-color: #17a2b8; background-color: #eef8fb; }

/* Center button row in small modal */
#status-modal .modal-actions { justify-content: center; }

@keyframes statusModalIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

