/**
 * --------------------------------------------------------------------------
 * Customizações Unitá para GLPI
 * --------------------------------------------------------------------------
 * Licença Comercial de Uso – Unitá Soluções Digitais Ltda.
 *
 * Estas customizações são licenciadas exclusivamente para uso interno dos
 * clientes Unitá, conforme os Termos e Condições disponíveis em:
 *
 * https://unitasolucoes.com.br/licenca
 *
 * É proibido copiar, distribuir, sublicenciar, vender, alugar, modificar,
 * realizar engenharia reversa ou criar obras derivadas destas customizações
 * sem autorização expressa da Unitá.
 *
 * --------------------------------------------------------------------------
 * @package   Unitá - Termos
 * @developer Unitá Soluções Digitais Ltda.
 * @copyright Copyright (c) 2026 Unitá Soluções Digitais Ltda.
 * @license   Licença Comercial - Todos os direitos reservados
 * @link      https://unitasolucoes.com.br
 * @since     2026
 * --------------------------------------------------------------------------
 */

/* Container principal */
.terms-container {
    padding: 15px;
}

/* Header com ações */
.terms-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.terms-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Seletor de template */
.terms-select {
    padding: 8px 12px;
    border: 1px solid var(--sp-light-color);
    border-radius: 4px;
    min-width: 250px;
    font-size: 14px;
    background: var(--tblr-body-bg);
}

.terms-select:focus {
    border-color: var(--main-secondary-color);
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--main-secondary-color) 20%, transparent);
}

/* Botões */
.terms-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

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

.terms-btn-primary {
    background: var(--main-secondary-color);
    color: var(--main-secondary-color-text);
}

.terms-btn-primary:hover:not(:disabled) {
    background: var(--main-secondary-color-hover);
}

.terms-btn-secondary {
    background: var(--main-primary-color);
    color: var(--main-primary-color-text);
}

.terms-btn-secondary:hover:not(:disabled) {
    background: var(--main-primary-color-hover);
    color: var(--main-primary-color);
}

/* Área de preview */
.terms-preview {
    background: var(--tblr-body-bg);
    border: 1px solid var(--sp-light-color);
    padding: 20px;
    margin-top: 20px;
    min-height: 400px;
    border-radius: 4px;
}

.terms-preview-placeholder {
    color: var(--tblr-secondary-color);
    text-align: center;
    padding: 50px;
}

/* Tabela de termos */
.terms-table {
    width: 100%;
    margin-top: 20px;
}

/* Badge de status */
.terms-status-badge {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    color: var(--main-secondary-color-text);
    display: inline-block;
}

/* Modal de tags */
.terms-tags-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.terms-tags-modal-content {
    background: var(--tblr-body-bg);
    padding: 20px;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.terms-tags-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--sp-light-color);
}

.terms-tags-modal-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
    color: var(--main-primary-color);
}

.terms-tags-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--tblr-secondary-color);
}

.terms-tags-modal-close:hover {
    color: var(--main-secondary-color-hover);
}

/* Tabela de tags */
.terms-tags-table {
    width: 100%;
    border-collapse: collapse;
}

.terms-tags-table th,
.terms-tags-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--sp-light-color);
}

.terms-tags-table th {
    background: var(--sp-light-color);
    font-weight: 600;
    color: var(--main-primary-color);
}

.terms-tags-table tr:hover {
    background: var(--sp-light-color);
}

.terms-tag-code {
    font-family: monospace;
    background: var(--sp-light-color);
    padding: 2px 6px;
    border-radius: 3px;
    cursor: pointer;
}

.terms-tag-code:hover {
    background: var(--main-secondary-color);
    color: var(--main-secondary-color-text);
}

/* Categoria de tags */
.terms-tags-category {
    font-weight: bold;
    background: var(--main-primary-color);
    color: var(--main-primary-color-text);
    padding: 8px 12px;
    margin-top: 15px;
    border-radius: 4px;
}

.terms-tags-category:first-child {
    margin-top: 0;
}

/* Formulário de template */
.terms-template-form {
    max-width: 100%;
}

.terms-template-form textarea {
    width: 100%;
    min-height: 400px;
}

/* Responsivo */
@media (max-width: 768px) {
    .terms-header {
        flex-direction: column;
        align-items: stretch;
    }

    .terms-actions {
        flex-direction: column;
    }

    .terms-select {
        width: 100%;
    }

    .terms-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Loading */
.terms-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.terms-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid var(--sp-light-color);
    border-top: 4px solid var(--main-secondary-color);
    border-radius: 50%;
    animation: terms-spin 1s linear infinite;
}

@keyframes terms-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Alertas */
.terms-alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.terms-alert-success {
    background: color-mix(in srgb, var(--main-secondary-color) 10%, transparent);
    color: var(--main-secondary-color);
    border: 1px solid var(--main-secondary-color);
}

.terms-alert-error {
    background: color-mix(in srgb, var(--main-counter-color) 10%, transparent);
    color: var(--main-counter-color);
    border: 1px solid var(--main-counter-color);
}

.terms-alert-warning {
    background: color-mix(in srgb, var(--main-secondary-color-hover) 10%, transparent);
    color: var(--main-secondary-color-hover);
    border: 1px solid var(--main-secondary-color-hover);
}

.terms-alert-info {
    background: color-mix(in srgb, var(--main-primary-color) 10%, transparent);
    color: var(--main-primary-color);
    border: 1px solid var(--main-primary-color);
}
