/**
 * Estilos personalizados para o sistema Monitorei
 */

/* Variáveis CSS - Auxiliam na manutenção */
:root {
    --color-primary: #5271ff;
    --color-primary-hover: #4060eb;
    --color-secondary: #303030;
    --color-dark: #121212;
    --color-dark-light: #1e1e1e;
    --color-dark-deeper: #0a0a0a;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;
}

/* Estilos gerais */
body {
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden; /* Prevenir scroll horizontal */
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-dark-light);
}

::-webkit-scrollbar-thumb {
    background: var(--color-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* Transições suaves */
a, button, .transition {
    transition: all 0.2s ease-in-out;
}

/* Loader animado */
.loader {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top: 3px solid var(--color-primary);
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Cards com hover effect */
.card {
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Input focus com borda primária */
input:focus, select:focus, textarea:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 1px var(--color-primary) !important;
}

/* Badges de status */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

.badge-info {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--color-info);
}

/* Animações para notificações */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification {
    animation: slideInRight 0.3s ease-out forwards;
}

/* Estilos para tabelas responsivas */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Estilos para paginação */
.pagination-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    color: #9ca3af;
    margin: 0 2px;
}

.pagination-item:hover {
    background-color: var(--color-dark-light);
    color: white;
}

.pagination-item.active {
    background-color: var(--color-primary);
    color: white;
}

/* Estilos para o input de senha com toggle de visibilidade */
.password-input-container {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    z-index: 10;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.password-toggle:hover {
    color: white;
}

/* Estilos para tooltips */
.tooltip {
    position: relative;
}

.tooltip .tooltip-text {
    visibility: hidden;
    background-color: var(--color-dark);
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 5px 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    font-size: 0.75rem;
    white-space: nowrap;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Sidebar fixo - ajustado para responsividade */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 16rem;
    z-index: 30;
    overflow-y: auto;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

/* Configuração inicial do sidebar em mobile */
@media (max-width: 1023px) {
    #sidebar {
        transform: translateX(-100%);
        width: 80%; /* Ajuste para melhor visualização em telas pequenas */
        max-width: 16rem;
    }
    
    /* Conteúdo principal com margem menor em mobile */
    .lg\:pl-64 {
        padding-left: 0 !important;
    }
}

/* Garantir que os botões de toggle e fechamento sejam visíveis apenas em mobile */
#sidebar-toggle, #sidebar-close {
    display: none;
}

@media (max-width: 1023px) {
    #sidebar-toggle, #sidebar-close {
        display: flex !important;
    }
}

/* Sidebar aberto em mobile */
#sidebar.active {
    transform: translateX(0) !important;
}

/* Botão de toggle do menu - garantir visibilidade */
#sidebar-toggle {
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: 4px;
    background-color: var(--color-primary);
    border: none;
    outline: none;
    z-index: 20;
}

#sidebar-toggle:hover, #sidebar-toggle:focus {
    background-color: var(--color-primary-hover);
    outline: none;
}

/* Botão para fechar o sidebar */
#sidebar-close {
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background-color: transparent;
    cursor: pointer;
    border: none;
    outline: none;
    color: #9ca3af;
    transition: all 0.2s;
}

#sidebar-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Overlay para o sidebar em mobile */
#sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 25;
    transition: opacity 0.3s;
}

/* Quando body tem overflow hidden */
body.overflow-hidden {
    overflow: hidden;
}

/* Animação para o sidebar */
@keyframes sidebarFadeIn {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#sidebar.active {
    animation: sidebarFadeIn 0.3s forwards;
}

#sidebar-overlay:not(.hidden) {
    animation: overlayFadeIn 0.3s forwards;
}

/* Garantir que o conteúdo não seja cortado */
.p-8 {
    padding: 2rem !important;
}

@media (max-width: 640px) {
    .p-8 {
        padding: 1rem !important;
    }
}

/* Ajustes para formulários */
.form-error, .form-success {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 0.375rem;
}

.form-error {
    background-color: var(--color-danger);
    color: white;
}

.form-success {
    background-color: var(--color-success);
    color: white;
}