@import url("colors.css");

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.12s ease, opacity 0.18s ease;
}

a {
    text-decoration: none;
}

h1, h2, h3 {
    color: var(--color-text-primary);
    letter-spacing: 0;
}

form {
    display: flex;
    flex-direction: column;
}

/* SELECT */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    background-color: var(--color-input-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    min-height: 40px;
    padding: 9px 34px 9px 12px;
    font-size: 0.9rem;
    color: var(--color-text-primary);

    width: 100%;
    max-width: 280px;

    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239ca3af' stroke-width='1.5' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px 6px;

    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--color-border-focus);
    background-color: var(--color-input-background);
    box-shadow: 0 0 0 3px var(--color-focus-ring);
}

option {
    padding: 8px;
}

.double-input-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.double-input-container .input-container {
    width: 100%;
    justify-content: flex-end;
}

.align-center {
    align-items: center;
}

.form-subtitle {
    border-bottom: 1px solid var(--color-border);
    font-size: 0.95rem;
    font-weight: 700;
    margin: 18px 0 14px;
    padding-bottom: 8px;
}

.input-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 14px;
}

.input-container label {
    color: var(--color-text-primary);
    font-weight: 700;
    font-size: 0.78rem;
    line-height: 1.3;
    margin-bottom: 6px;
}

.input-container button[type="submit"] {
    margin-top: 10px;
}

/* INPUT */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="date"] {
    background-color: var(--color-input-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    min-height: 40px;
    padding: 9px 12px;
    font-size: 0.9rem;
    color: var(--color-text-primary);
    width: 100%;
    max-width: 280px;
}

textarea {
    resize: none;
    overflow: auto;
    min-height: 80px;
}

textarea::-webkit-scrollbar {
    width: 4px;
    background-color: transparent;
}

textarea::-webkit-scrollbar-thumb {
    background-color: var(--color-scrollbar-primary);
    border-radius: 6px;
}

/* Estilização específica para checkbox */
input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

input[type="radio"] {
    accent-color: var(--color-primary);
    margin-right: 8px;
}

/* Para estilizar o container do checkbox */
.checkbox-container {
    display: flex; /* Flexbox para alinhar o checkbox e o label */
    align-items: center; /* Alinhar verticalmente */
}

input:focus {
    outline: none;
    border-color: var(--color-border-focus);
    background-color: var(--color-input-background);
    box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.search-wrap {
    position: relative;
    display: block;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}

.search-wrap .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--color-text-secondary);
    pointer-events: none;
}

.search-wrap input {
    width: 100%;
    padding: 8px 14px 8px 38px; /* espaço pro ícone */
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    box-sizing: border-box;
    display: block;
    max-width: none;
}

/* BUTTON */
button {
    align-items: center;
    background-color: var(--color-card-background);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    display: inline-flex;
    justify-content: center;
    gap: 6px;
    padding: 0 14px;
    height: 40px;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

button:hover {
    background-color: var(--color-hover);
    border-color:  var(--color-border-hover);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

button:focus-visible {
    outline: none;
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px var(--color-focus-ring);
}

button:disabled {
    background-color: #e5e7eb;
    border-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.btn-themed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-themed ion-icon {
    flex: 0 0 auto;
    font-size: 16px;
    color: currentColor;
}

.btn-refresh {
    color: var(--button-refresh-color);
    border-color: var(--button-refresh-border);
    background: var(--button-refresh-background);
}

.btn-add {
    color: var(--button-primary-color);
    border-color: var(--button-primary-border);
    background: var(--button-primary-background);
}

.btn-filter {
    color: var(--button-filter-color);
    border-color: var(--button-filter-border);
    background: var(--button-filter-background);
}

.btn-clear {
    color: var(--button-clear-color);
    border-color: var(--button-clear-border);
    background: var(--button-clear-background);
    min-width: 96px;
    white-space: nowrap;
}

.btn-edit-action {
    color: var(--button-edit-color);
    border-color: var(--button-edit-border);
    background: var(--button-edit-background);
    min-width: 84px;
}

.btn-neutral,
.btn-delete-action[data-modal-cancel],
.btn-delete-action[data-advanced-filter-cancel],
.btn-clear[data-advanced-filter-save-cancel] {
    color: var(--button-neutral-color);
    border-color: var(--button-neutral-border);
    background: var(--button-neutral-background);
}

.btn-delete-action {
    color: var(--button-delete-color);
    border-color: var(--button-delete-border);
    background: var(--button-delete-background);
    min-width: 84px;
}

.btn-refresh:hover,
.btn-clear:hover,
.btn-neutral:hover,
.btn-delete-action[data-modal-cancel]:hover,
.btn-delete-action[data-advanced-filter-cancel]:hover,
.btn-clear[data-advanced-filter-save-cancel]:hover,
.btn-edit-action:hover,
.btn-delete-action:hover {
    filter: brightness(0.98);
}

.btn-refresh:hover {
    background-color: var(--button-refresh-background);
    border-color: var(--button-refresh-border);
}

.btn-clear:hover {
    background-color: var(--button-clear-hover-background);
    border-color: var(--button-clear-hover-border);
}

.btn-edit-action:hover {
    background-color: var(--button-edit-background);
    border-color: var(--button-edit-border);
}

.btn-neutral:hover,
.btn-delete-action[data-modal-cancel]:hover,
.btn-delete-action[data-advanced-filter-cancel]:hover,
.btn-clear[data-advanced-filter-save-cancel]:hover {
    background-color: var(--button-neutral-hover-background);
    border-color: var(--button-neutral-hover-border);
}

.btn-delete-action:hover {
    background-color: var(--button-delete-hover-background);
    border-color: var(--button-delete-hover-border);
}

.btn-add:hover {
    background-color: var(--button-primary-hover-background);
    border-color: var(--button-primary-hover-border);
    color: var(--button-primary-color);
    filter: brightness(0.95);
}

.btn-filter:hover {
    background-color: var(--button-filter-hover-background);
    border-color: var(--button-filter-hover-border);
    color: var(--button-filter-color);
    filter: brightness(0.98);
}

button[type="submit"].btn-filter,
.modal-form-actions .btn-filter,
[data-advanced-filter-apply],
#btn-save-access-definitions,
#api-credential-regenerate,
.access-denied-actions .btn-filter {
    color: var(--button-primary-color);
    border-color: var(--button-primary-border);
    background: var(--button-primary-background);
}

button[type="submit"].btn-filter:hover,
.modal-form-actions .btn-filter:hover,
[data-advanced-filter-apply]:hover,
#btn-save-access-definitions:hover,
#api-credential-regenerate:hover,
.access-denied-actions .btn-filter:hover {
    color: var(--button-primary-color);
    border-color: var(--button-primary-hover-border);
    background: var(--button-primary-hover-background);
}

.hub-message-container {
    display: grid;
    gap: 10px;
    max-width: min(460px, calc(100vw - 32px));
    position: fixed;
    right: 16px;
    top: 16px;
    width: 100%;
    z-index: 1400;
}

.hub-message {
    align-items: center;
    background: var(--color-card-background);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    border-radius: 6px;
    box-shadow: 0 10px 24px var(--color-shadow-card);
    color: var(--color-text-primary);
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr auto auto;
    opacity: 1;
    padding: 12px 12px 12px 14px;
    transform: translateY(0);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.hub-message.is-closing {
    opacity: 0;
    transform: translateY(-6px);
}

.hub-message-success {
    border-left-color: var(--color-success);
}

.hub-message-error {
    border-left-color: var(--color-danger);
}

.hub-message-warning {
    border-left-color: var(--color-warning);
}

.hub-message-info {
    border-left-color: var(--color-secondary);
}

.hub-message-content {
    font-size: 0.9rem;
    line-height: 1.35;
}

.hub-message-countdown {
    color: var(--color-text-secondary);
    font-size: 0.78rem;
    white-space: nowrap;
}

.hub-message-close {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--color-text-primary);
    display: inline-flex;
    font-size: 18px;
    height: 28px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    width: 28px;
}

.hub-message-close:hover {
    background: var(--color-hover);
}

.modal-form-actions {
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 16px;
}

.modal-form-actions button {
    min-width: 128px;
}

.btn-secondary {
    background-color: var(--button-filter-background);
    border: 1px solid var(--button-filter-border);
    color: var(--button-filter-color);

}

.btn-secondary:hover {
    background-color: var(--button-filter-hover-background);
    border-color: var(--button-filter-hover-border);
}

.global-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 3px solid #ccc;
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle; /* centraliza com o texto do botão */
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.master-body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--color-background);
    color: var(--color-text-primary);
}

/* Navbar fixa no topo */
.navbar {
    width: 100%;
    height: var(--layout-topbar-height);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 100;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--color-card-background);
    box-shadow: var(--shadow-sm);
}

.nav-logo img {
    display: block;
    filter: var(--brightness);
    height: 53px;
    object-fit: contain;
    width: 242px;
}

.nav-logo {
    align-items: center;
    display: inline-flex;
    gap: 8px;
}

.sidebar-toggle {
    border-radius: 999px;
    flex: 0 0 auto;
    height: 36px;
    min-width: 36px;
    padding: 0;
    width: 36px;
}

.sidebar-toggle ion-icon {
    font-size: 18px;
}

.mobile-menu-trigger {
    display: none;
}

.navbar .welcome-message p {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.88rem;
    font-weight: 600;
}

.notification-menu {
    position: relative;
    display: inline-block;
}

.notification-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    height: 38px;
    width: 38px;
}

.notification-trigger ion-icon {
    font-size: 1.3rem;
    color: var(--color-text-primary);
    transition: opacity 0.2s ease;
}

.notification-trigger ion-icon:hover {
    opacity: 0.7;
}

.notification-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 7px;
    height: 7px;
    background: var(--color-danger);
    border-radius: 50%;
}

.hidden {
    display: none;
}

/* Dropdown */
.notification-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    background: var(--color-card-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    min-width: 240px;
    box-shadow: var(--shadow-md);
    padding: 0.5rem 0;
    z-index: 10;
}

.notification-dropdown li {
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border-light);
}

.notification-dropdown li a {
    font-size: 0.84rem;
    color: var(--color-text-primary);
    margin-left: 1.6rem;
    font-weight: normal;

}

.notification-dropdown li:last-child {
    border-bottom: none;
}

.notification-dropdown li:hover {
    background: var(--color-hover);
}

.notification-item.warning ion-icon {
    color: #d87a00;
    font-size: 1rem;
    position: absolute;

}

.notification-item.info ion-icon {
    color: #007bff;
    font-size: 1rem;
    position: absolute;
}

/* Mostrar dropdown */
.notification-menu.active .notification-dropdown {
    display: block;
}

.profile-menu {
    position: relative;
    display: inline-block;
}

.profile-trigger img {
    display: flex;
    justify-content: center;
    align-items: center;
}

.profile-trigger img {
    width: 38px;
    height: 38px;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    cursor: pointer;
    object-fit: cover;
}

.profile-trigger img:hover {
    opacity: 0.8;
}

/* Dropdown */
.profile-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    background: var(--color-card-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    min-width: 280px;
    box-shadow: var(--shadow-md);
    padding: 0.5rem 0;
    z-index: 10;
}

.profile-dropdown li {
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.profile-dropdown li a {
    color: var(--color-danger);
    width: 100%;
}

.profile-dropdown li a:hover {
    color: var(--color-danger-hover);
    text-decoration: underline;
}

/* .profile-dropdown .profile-item:hover {
    background: var(--color-hover);
}

.profile-dropdown .theme-toggle:hover {
    background: var(--color-hover);
} */

.user-name {
    font-weight: 500;
    color: var(--color-text-secondary);
}

.theme-toggle span, .color-selector span {
    color: var(--color-text-primary);
}

/* Toggle de tema */
.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 34px;
    transition: 0.3s;
}

.slider::before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider {
    background-color: var(--color-primary);
}

input:checked + .slider::before {
    transform: translateX(16px);
}



.color-selector {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    justify-content: flex-start;
    padding: 6px 10px;
}

.color-options {
    display: grid;
    grid-template-columns: repeat(4, 22px);
    gap: 8px;
}

.color-swatch {
    background: var(--swatch-color);
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 1px solid rgba(15, 23, 42, 0.18);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.color-swatch:hover {
    transform: scale(1.1);
}

/* Paletas dos temas */
.color-swatch.hub {
    --swatch-color: #0F766E;
}

.color-swatch.blue {
    --swatch-color: #2563EB;
}

.color-swatch.yellow {
    --swatch-color: #EAB308;
}

.color-swatch.orange {
    --swatch-color: #EA580C;
}

.color-swatch.red {
    --swatch-color: #DC2626;
}

.color-swatch.pink {
    --swatch-color: #DB2777;
}

.color-swatch.purple {
    --swatch-color: #7C3AED;
}

.color-swatch.gray {
    --swatch-color: #6B7280;
}

/* Indica o tema ativo */
.color-swatch.active {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px var(--color-focus-ring);
}


/* Dropdown aberto */
.profile-menu.active .profile-dropdown {
    display: block;
}

.layout {
    display: flex;
    height: 94vh;
    padding: 0 200px;
}

.clickable {
    cursor: pointer;
    width: 50px;
    height: 50px;
    background-color: var(--color-default);
    border-radius: 50%;
}

.profile-container {
    margin: 0 0 0 24px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.profile-container form {
    width: 240px !important;
}

.profile-container select {
    max-width: none;
}

.profile-container a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: center;
    padding: 3px 0 3px 0;
    width: 100%;
    font-weight: bold;
    background-color: transparent;
    border-radius: 0;
}

/* Estrutura principal */
.container-row {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
}

.content-container {
    box-sizing: border-box;
    margin-top: var(--layout-topbar-height);
    min-height: calc(100vh - var(--layout-topbar-height));
    min-width: 0;
    width: 100%;
}

html.sidebar-collapsed {
    --layout-sidebar-width: var(--layout-sidebar-collapsed-width);
}

html.sidebar-expanded {
    --layout-sidebar-width: var(--layout-sidebar-expanded-width);
}

.master-body.has-sidebar .content-container {
    padding-left: var(--layout-sidebar-width);
    transition: padding-left 0.18s ease;
}

/* Sidebar fixa na lateral */
.sidebar {
    width: var(--layout-sidebar-width);
    height: calc(100vh - var(--layout-topbar-height));
    border-right: 1px solid var(--color-border);
    z-index: 300;
    position: fixed;
    top: var(--layout-topbar-height);
    left: 0;
    background-color: var(--color-card-background);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.18s ease;
}

.side-options {
    gap: 6px;
    margin: 0;
    padding: 10px 12px 20px;
    display: flex;
    flex-direction: column;
}

.side-options li {
    display: flex;
    align-items: center;
    list-style: none;
    min-height: 38px;
    cursor: pointer;
}

.option-link:hover {
    background-color: var(--color-surface-muted);
    color: var(--color-theme-text);
}

.option-link.is-active,
.has-dropdown.is-active > .option-link {
    background-color: var(--color-surface-muted);
    color: var(--color-theme-text);
}

.option-link {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
    border-radius: var(--radius-md);
    padding: 0 12px;
    font-size: 0.9rem;
    font-weight: 800;
    min-height: 38px;
    color: var(--color-text-secondary);
    text-decoration: none;
    width: 100%;
}

.option-link .menu-icon {
    flex: 0 0 auto;
    font-size: 18px;
}

.option-link .option-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.option-link .icon {
    margin-right: 10px;
    display: flex;
    align-items: center;
}

.option-link .text {
    flex-grow: 1;
    display: flex;
    align-items: center;
}

.option-link .arrow {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.option-link ion-icon {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.option-link:hover ion-icon,
.option-link.is-active ion-icon,
.has-dropdown.is-active > .option-link ion-icon {
    color: var(--color-theme-text);
}

/* Dropdown*/
.has-dropdown {
    flex-direction: column;
    width: 100%;
}

.has-dropdown .arrow {
    transition: transform 0.3s ease;
    display: none
}

.has-dropdown.open > .option-link .arrow {
    transform: rotate(180deg);
    display: none;
}

/* Dropdown embutido */
.dropdown {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    width: 100%;
}

/* .dropdown.open { */
.dropdown {
    max-height: 300px;
    padding-bottom: 5px;
    background-color: transparent;
    width: 100%;
}

.has-dropdown .option-link .arrow {
    transition: transform 0.3s ease;
}

.has-dropdown.open > .option-link > .arrow {
    transform: rotate(180deg);
}

.dropdown li {
    list-style: none;
    min-height: 30px;
    padding-left: 18px;
    transition: padding 0.3s ease;
    width: 100%;
}

.dropdown li:hover {
    background-color: transparent;
    padding-left: 18px;
}

.dropdown li a {
    display: flex;
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-weight: normal;
    font-size: 0.84rem;
    width: 100%;
}

.dropdown li a:hover,
.dropdown li a:focus-visible {
    background: var(--color-surface-muted);
    color: var(--color-theme-text);
    outline: none;
}

.dropdown li a.is-active {
    background: var(--color-primary-light);
    color: var(--color-theme-text-strong);
    font-weight: 700;
}

html.sidebar-collapsed .sidebar {
    overflow: visible;
}

html.sidebar-collapsed .sidebar-toggle ion-icon {
    transform: rotate(180deg);
}

html.sidebar-collapsed .side-options {
    padding-left: 4px;
    padding-right: 4px;
}

html.sidebar-collapsed .option-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

html.sidebar-collapsed .option-link .option-text,
html.sidebar-collapsed .option-link .arrow {
    display: none;
}

html.sidebar-collapsed .option-link .menu-icon {
    font-size: 21px;
}

html.sidebar-collapsed .has-dropdown {
    position: relative;
}

html.sidebar-collapsed .has-dropdown .dropdown {
    background: var(--color-card-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    left: var(--sidebar-flyout-left, calc(var(--layout-sidebar-collapsed-width) + 8px));
    max-height: none;
    min-width: 220px;
    opacity: 0;
    overflow: visible;
    padding: 8px;
    pointer-events: none;
    position: fixed;
    top: var(--sidebar-flyout-top, calc(var(--layout-topbar-height) + 64px));
    transform: translateX(-4px);
    transition: opacity 0.12s ease, transform 0.12s ease;
    width: min(260px, calc(100vw - var(--layout-sidebar-collapsed-width) - 24px));
    z-index: 700;
}

html.sidebar-collapsed .has-dropdown:hover .dropdown,
html.sidebar-collapsed .has-dropdown:focus-within .dropdown,
html.sidebar-collapsed .has-dropdown.is-flyout-open .dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

html.sidebar-collapsed .dropdown li {
    padding-left: 0;
}

html.sidebar-collapsed .dropdown li:hover {
    padding-left: 0;
}

.subdropdown {
    padding-left: 25px;
}

.subdropdown li {
    min-height: 20px;
}

.subdropdown li a {
    min-height: 20px;
}

/* Conteúdo principal */
.main-content {
    box-sizing: border-box;
    padding: 28px;
    margin-left: 0;
    min-width: 0;
    min-height: calc(100vh - var(--layout-topbar-height));
    overflow-y: auto; /* Adiciona rolagem se necessário */
    background-color: var(--color-background);
    transition: none;
    width: auto;
}

#filter-type {
    max-width: 180px;
    padding-right: 15px;
}

.filter-toolbar {
    margin-bottom: 15px;
}

.filter-toolbar button {
    padding: 5px 10px;
    margin-right: 10px;
}


/* Modal */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none; /* impede clique quando invisível */
    transition: opacity 0.18s ease;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--color-card-background);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    color: var(--color-text-primary);
    padding: 24px;
    border-radius: var(--radius-lg);
    min-width: 300px;
    max-height: 88vh;
    max-width: 620px;
    overflow: auto;
    position: relative;
    transform: translateY(10px) scale(0.98);
    transition: transform 0.16s ease;
    width: min(620px, calc(100vw - 32px));
}

.modal.show .modal-content {
    transform: translateY(0) scale(1);
}

.modal-title {
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-primary);
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding: 0 42px 16px 0;
}

.modal-close {
    align-items: center;
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text-primary);
    display: inline-flex;
    height: 32px;
    justify-content: center;
    line-height: 1;
    position: absolute;
    top: 18px;
    right: 18px;
    font-size: 22px;
    cursor: pointer;
    opacity: 0.9;
    width: 32px;
}

.modal-close:hover {
    background: var(--color-hover);
    color: var(--color-theme-text);
    opacity: 1;
}

.modal-content.catalog-relations-modal,
.modal-content.integration-response-modal {
    display: flex;
    flex-direction: column;
    max-height: 88vh;
    max-width: calc(100vw - 32px);
    overflow: hidden;
    padding: 0;
    width: min(90vw, 1120px);
}

.catalog-relations-modal .modal-title,
.integration-response-modal .modal-title {
    flex: 0 0 auto;
    margin: 0;
    padding: 22px 64px 16px 24px;
}

.catalog-relations-body,
.api-response-shell {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding: 18px 24px 24px;
}

.catalog-relations-body {
    display: flex;
    flex-direction: column;
}

.catalog-relations-body .table-header {
    display: grid;
    grid-template-columns: auto minmax(260px, 1fr);
    margin-bottom: 14px;
}

.catalog-relations-body .table-header #btn-filter,
.catalog-relations-body .table-header #btn-clear {
    display: none;
}

.catalog-relations-body .table-header .search-wrap {
    grid-column: auto;
    min-width: 0;
}

.catalog-relations-body .table-wrapper {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    position: relative;
}

.catalog-relations-body .minimal-table {
    border: 0;
    min-width: 680px;
    table-layout: auto;
}

.catalog-relations-body .minimal-table thead {
    display: table-header-group;
    position: sticky;
    top: 0;
    z-index: 2;
}

.catalog-relations-body .minimal-table tbody {
    display: table-row-group;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
}

.catalog-relations-body .minimal-table tr {
    display: table-row;
    min-height: 0;
    table-layout: auto;
}

.catalog-relations-body .minimal-table th,
.catalog-relations-body .minimal-table td {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.catalog-relations-body .pagination {
    display: none;
}

.api-response-shell {
    display: grid;
    gap: 12px;
    grid-template-rows: auto auto minmax(0, 1fr);
}

.api-response-summary {
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0;
    padding: 12px 14px;
}

.api-response-summary.is-error {
    background: var(--color-danger-light);
    border-color: var(--button-delete-border);
    color: var(--color-danger-hover);
}

.api-response-summary.is-success {
    background: var(--color-success-light);
    border-color: color-mix(in srgb, var(--color-success) 42%, transparent);
    color: var(--color-success-hover);
}

.api-response-toolbar {
    align-items: center;
    color: var(--color-text-secondary);
    display: flex;
    font-size: 0.82rem;
    font-weight: 800;
    gap: 12px;
    justify-content: space-between;
    text-transform: uppercase;
}

.api-response-copy {
    min-width: 104px;
    text-transform: none;
}

.api-response-body {
    background: color-mix(in srgb, var(--color-background) 72%, var(--color-card-background));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    margin: 0;
    min-height: 260px;
    overflow: auto;
    padding: 14px;
    tab-size: 2;
    white-space: pre-wrap;
    word-break: normal;
}

.no-data {
    color: var(--color-text-secondary) !important;
    font-style: italic;
    text-align: center;
    padding: 8px;
}

.response-item {
    background: color-mix(in srgb, var(--color-background) 72%, var(--color-card-background));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    padding: 12px;
    max-height: 60vh;
    overflow: auto;
    white-space: pre-wrap;
}

.menu-options {
    display: none;
    position: absolute;
    left: -35px;
    top: 60%;
    background: var(--color-card-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    min-width: 180px;
    box-shadow: var(--shadow-md);
    z-index: 100;
    padding: 0;
    color: var(--color-text-secondary);
  }

.menu-options ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

@media (max-width: 980px) {
    :root {
        --layout-sidebar-expanded-width: 220px;
    }

    .navbar {
        padding: 0 16px;
    }

    .welcome-message {
        display: none;
    }

    .profile-container form {
        width: 190px !important;
    }
}

@media (max-width: 760px) {
    :root {
        --layout-topbar-height: 72px;
    }

    .master-body {
        min-width: 0;
        overflow-x: hidden;
    }

    .master-body.has-sidebar .content-container {
        padding-left: 0;
    }

    .double-input-container {
        flex-direction: column;
        gap: 0;
    }

    .navbar {
        gap: 8px;
        height: var(--layout-topbar-height);
        padding: 8px 10px;
    }

    .mobile-menu-trigger {
        align-items: center;
        background: var(--color-card-background);
        border: 1px solid var(--color-border);
        border-radius: 999px;
        color: var(--color-text-primary);
        display: inline-flex;
        height: 36px;
        justify-content: center;
        min-width: 36px;
        padding: 0;
        width: 36px;
    }

    .mobile-menu-trigger ion-icon {
        font-size: 20px;
    }

    .sidebar {
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
        display: none;
        height: auto;
        left: 10px;
        max-height: calc(100vh - var(--layout-topbar-height) - 20px);
        overflow-x: hidden;
        overflow-y: auto;
        padding: 10px;
        top: calc(var(--layout-topbar-height) + 8px);
        width: min(330px, calc(100vw - 20px));
        z-index: 500;
    }

    .sidebar-toggle {
        display: none;
    }

    .sidebar.is-mobile-open {
        display: block;
    }

    .side-options {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
        margin: 0;
        min-width: 0;
        padding: 0;
    }

    html.sidebar-collapsed .side-options {
        padding: 0;
    }

    .side-options li {
        align-items: flex-start;
        min-height: 0;
    }

    .has-dropdown {
        background: var(--color-card-background);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        flex: 0 0 auto;
        padding: 8px;
    }

    .option-link {
        gap: 10px;
        justify-content: flex-start;
        min-height: 30px;
        padding: 0 6px;
    }

    html.sidebar-collapsed .option-link {
        justify-content: flex-start;
        padding: 0 6px;
    }

    html.sidebar-collapsed .option-link .option-text {
        display: inline;
    }

    html.sidebar-collapsed .option-link .menu-icon {
        font-size: 18px;
    }

    .dropdown {
        max-height: none;
        padding-bottom: 0;
    }

    html.sidebar-collapsed .has-dropdown .dropdown {
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        left: auto;
        min-width: 0;
        opacity: 1;
        overflow: visible;
        padding: 0;
        pointer-events: auto;
        position: static;
        top: auto;
        transform: none;
        transition: max-height 0.3s ease, padding 0.3s ease;
        width: 100%;
    }

    .dropdown li {
        min-height: 26px;
        padding-left: 0;
    }

    .dropdown li:hover {
        padding-left: 0;
    }

    .dropdown li a {
        padding: 6px;
    }

    .main-content {
        margin-left: 0;
        min-width: 0;
        padding: 18px 12px;
        width: 100%;
    }

    .nav-logo img {
        height: 44px;
        width: 152px;
    }

    .profile-container {
        gap: 6px;
        margin-left: 0;
        min-width: 0;
    }

    .profile-container form {
        width: 132px !important;
    }

    .profile-container select {
        font-size: 0.84rem;
        min-height: 38px;
        padding-left: 10px;
        padding-right: 28px;
    }

    .notification-menu {
        display: none;
    }

    .profile-trigger img {
        height: 34px;
        width: 34px;
    }

    .profile-dropdown {
        right: 0;
        top: calc(100% + 8px);
    }

    .modal-content {
        padding: 18px;
        width: calc(100vw - 20px);
    }

    .modal-content.catalog-relations-modal,
    .modal-content.integration-response-modal {
        max-height: 90vh;
        max-width: calc(100vw - 16px);
        padding: 0;
        width: 95vw;
    }

    .catalog-relations-modal .modal-title,
    .integration-response-modal .modal-title {
        padding: 18px 56px 14px 18px;
    }

    .catalog-relations-body,
    .api-response-shell {
        padding: 14px 16px 18px;
    }

    .catalog-relations-body .table-header {
        grid-template-columns: 1fr;
    }

    .catalog-relations-body .table-header button,
    .catalog-relations-body .table-header .search-wrap {
        width: 100%;
    }

    .catalog-relations-body .minimal-table {
        min-width: 560px;
    }

    .api-response-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .api-response-copy {
        width: 100%;
    }

    .api-response-body {
        min-height: 220px;
    }
}

@media (max-width: 420px) {
    .navbar {
        gap: 6px;
        padding-left: 8px;
        padding-right: 8px;
    }

    .nav-logo img {
        width: 130px;
    }

    .mobile-menu-trigger {
        height: 34px;
        min-width: 34px;
        width: 34px;
    }

    .profile-container form {
        width: 116px !important;
    }

    .profile-container select {
        font-size: 0.8rem;
    }

    .profile-trigger img {
        height: 32px;
        width: 32px;
    }
}

.menu-options li {
    width: 100%;
    padding: 10px;
    cursor: pointer;
}

.menu-options li:hover {
    background-color: var(--color-hover);
}
