/* css/global-styles.css */
/* --- Theme Variables: Light (Default) --- */
:root {
    --color-bg: #f8f9fa;
    --color-bg-alt: #fff;
    --color-text: #222;
    --color-text-muted: #666;
    --color-primary: #1976d2;
    --color-primary-hover: #1565c0;
    --color-accent: #e53935;
    --color-success: #388e3c;
    --color-warning: #ffa000;
    --color-border: #e0e0e0;
    --color-shadow: rgba(0, 0, 0, 0.04);
    --color-header-bg: #fff;
    --color-header-text: #1976d2;
    --color-dropdown-bg: #fff;
    --color-dropdown-border: #eee;
    --color-dropdown-shadow: rgba(0, 0, 0, 0.08);
    --color-notification-unread: #e3f2fd;
    --color-notification-read: #f9f9f9;
    --color-btn-bg: #1976d2;
    --color-btn-text: #fff;
    --color-btn-bg-hover: #1565c0;
    --color-input-bg: #fff;
    --color-input-border: #ccc;
}

/* --- Theme Variables: Dark Mode --- */
body.dark-mode {
    --color-bg: #181a1b;
    --color-bg-alt: #23272a;
    --color-text: #f1f1f1;
    --color-text-muted: #b0b0b0;
    --color-primary: #90caf9;
    --color-primary-hover: #64b5f6;
    --color-accent: #ef9a9a;
    --color-success: #81c784;
    --color-warning: #ffd54f;
    --color-border: #333a40;
    --color-shadow: rgba(0, 0, 0, 0.5);
    --color-header-bg: #23272a;
    --color-header-text: #90caf9;
    --color-dropdown-bg: #23272a;
    --color-dropdown-border: #333a40;
    --color-dropdown-shadow: rgba(0, 0, 0, 0.7);
    --color-notification-unread: #263238;
    --color-notification-read: #22292f;
    --color-btn-bg: #1976d2;
    --color-btn-text: #fff;
    --color-btn-bg-hover: #1565c0;
    --color-input-bg: #23272a;
    --color-input-border: #333a40;
}

/* --- Apply Theme Variables --- */
body {
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
}

.container {
    background: var(--color-bg-alt);
    color: var(--color-text);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--color-header-text);
}

button,
.btn {
    background: var(--color-btn-bg);
    color: var(--color-btn-text);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    padding: 0.75em 1.5em;
    min-width: 44px;
    min-height: 44px;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover,
.btn:hover {
    background: var(--color-btn-bg-hover);
}

input,
select,
textarea {
    background: var(--color-input-bg);
    color: var(--color-text);
    border: 1px solid var(--color-input-border);
    border-radius: 6px;
    font-size: 1rem;
    padding: 0.75em;
    min-width: 44px;
    min-height: 44px;
    box-sizing: border-box;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--color-primary);
    border-color: var(--color-primary);
}

/* Utility classes for responsive spacing */
.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 2rem;
}

/* Touch-friendly tap targets */
button,
.btn,
input,
select,
textarea,
label {
    touch-action: manipulation;
}

/* Estilos de scrollbar (opcional, mas estava em plataforma.html) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #005EC4;
    /* primary-bg color */
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #004b9e;
    /* um tom mais escuro de primary-bg */
}

/* Classes de utilidade primária (para consistência) */
.primary-bg {
    background-color: #005EC4;
}

.primary-text {
    color: #005EC4;
}

.secondary-bg {
    background-color: #009959;
}

.secondary-text {
    color: #009959;
}

.dark-blue-bg {
    background-color: #00244D;
}

.dark-blue-text {
    color: #00244D;
}

/* Estilos básicos para botões, se não usar Tailwind para tudo */
button,
input[type="submit"] {
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Estilo para campos obrigatórios */
.required-star {
    color: red;
    margin-left: 2px;
}

/* Estilos para inputs e selects (base) - ATUALIZADO */
.form-input,
.form-select,
/* <--- ADICIONADO .form-select AQUI */
.filter-input,
.filter-select {
    width: 100%;
    /* Usando os valores mais específicos que tínhamos no HTML para maior consistência no formulário-cadastro */
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #cbd5e1;
    /* Cor da borda que estava no style inline */
    border-radius: 0.375rem;
    /* Raio da borda que estava no style inline */
    outline: none;
    box-sizing: border-box;
    color: #374151;
    /* text-gray-700 */
    background-color: white;
    /* Fundo branco para campos ativos */
    line-height: 1.25rem;
    /* Adicionado para consistência com inputs */
    appearance: none;
    /* Remove a aparência padrão do sistema para selects (opcional) */
    -webkit-appearance: none;
    -moz-appearance: none;
    /* Se remover a aparência, precisa adicionar um ícone de seta para o select */
    /* Exemplo com background-image para seta (simplificado): */
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 0.65em auto;
    padding-right: 2.5rem;
    /* Adiciona espaço para a seta customizada */
}

/* Ajuste para que selects no Safari no iOS não apliquem zoom */
select.form-select {
    font-size: 16px;
    /* iOS Safari pode aplicar zoom se font-size for menor que 16px */
}

@media (min-width: 640px) {

    /* Ou o breakpoint que você usa para telas maiores */
    select.form-select {
        font-size: 0.875rem;
        /* Volta ao font-size menor para telas maiores */
    }
}


.form-input:focus,
.form-select:focus,
/* <--- ADICIONADO .form-select:focus AQUI */
.filter-input:focus,
.filter-select:focus {
    border-color: #005EC4;
    /* primary-text */
    box-shadow: 0 0 0 2px rgba(0, 94, 196, 0.5);
}

/* Estilo para mensagens de notificação (base) */
.notification-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    color: white;
    z-index: 1000;
    font-size: 0.875rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.notification-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.notification-toast.success {
    background-color: #10B981;
}

/* green-500 */
.notification-toast.error {
    background-color: #EF4444;
}

/* red-500 */
.notification-toast.info {
    background-color: #3B82F6;
}

/* blue-500 */

/* Estilo para modal (base) */
.modal,
.confirm-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(17, 24, 39, 0.75);
    /* bg-gray-900 bg-opacity-75 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    z-index: 50;
    transition: opacity 0.25s ease;
}

.modal.active,
.confirm-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content,
.confirm-modal-content {
    background-color: white;
    border-radius: 0.75rem;
    /* rounded-xl */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    /* shadow-2xl */
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    /* p-8 */
    transform: scale(0.95);
    transition: transform 0.25s ease;
}

.modal.active .modal-content,
.confirm-modal.active .confirm-modal-content {
    transform: scale(1);
}

.modal-header,
.confirm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    /* mb-6 */
    padding-bottom: 0.75rem;
    /* pb-3 */
    border-bottom: 1px solid #E5E7EB;
    /* border-gray-200 */
}

.modal-title,
.confirm-modal-title {
    font-size: 1.5rem;
    /* text-2xl */
    font-weight: 600;
    /* font-semibold */
}

.modal-close-btn,
.confirm-modal-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    /* text-3xl */
    color: #6B7280;
    /* text-gray-500 */
    cursor: pointer;
}

.modal-close-btn:hover,
.confirm-modal-close-btn:hover {
    color: #1F2937;
    /* text-gray-800 */
}

.modal-body {
    /* Estilos para o corpo do modal, se necessário */
}

.modal-footer,
.confirm-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    /* space-x-4 */
    padding-top: 1rem;
    /* pt-4 */
    margin-top: 1.5rem;
    /* mt-6, ajuste conforme necessário */
    border-top: 1px solid #E5E7EB;
    /* border-gray-200 */
}

/* Esconder conteúdo até que a autenticação seja verificada */
.content-hidden-auth-check {
    display: none;
}

.content-hidden-auth-check.visible {
    display: block;
    /* ou outro valor de display apropriado */
}

/* --- Responsive Design: Global Styles --- */

/* Base styles (mobile first) */
.container {
    width: 100%;
    max-width: 100vw;
    padding: 1rem;
    margin: 0 auto;
    box-sizing: border-box;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    margin: 0.5em 0 0.25em 0;
}

button,
.btn {
    font-size: 1rem;
    padding: 0.75em 1.5em;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    transition: background 0.2s;
}

input,
select,
textarea {
    font-size: 1rem;
    padding: 0.75em;
    border-radius: 6px;
    border: 1px solid #ccc;
    min-width: 44px;
    min-height: 44px;
    box-sizing: border-box;
}

/* --- Breakpoint: >=600px (Tablet) --- */
@media (min-width: 600px) {
    .container {
        max-width: 90vw;
        padding: 2rem;
    }

    h1 {
        font-size: 2rem;
    }

    button,
    .btn {
        font-size: 1.1rem;
        padding: 1em 2em;
    }
}

/* --- Breakpoint: >=900px (Desktop) --- */
@media (min-width: 900px) {
    .container {
        max-width: 800px;
        padding: 2.5rem;
    }

    h1 {
        font-size: 2.5rem;
    }
}

/* --- Breakpoint: >=1200px (Large Desktop) --- */
@media (min-width: 1200px) {
    .container {
        max-width: 1100px;
    }
}

/* Hide number input spinners for Chrome, Safari, Edge, Opera */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Hide number input spinners for Firefox */
input[type="number"] {
    -moz-appearance: textfield;
}

/* FIX: Remover múltiplas setas dos selects - regra mais específica */
select,
select.form-input,
select.form-select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M6 8L10 12L14 8" stroke="%236b7280" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 1.2em auto !important;
    padding-right: 2.5rem !important;
}

/* Hide the default arrow in select elements (Chrome, Safari, Edge, Opera) */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 1px solid #d1d5db;
    /* Tailwind gray-300 */
    border-radius: 0.375rem;
    /* Tailwind rounded-md */
    padding: 0.5rem 0.75rem;
    background-color: #fff;
    /* Adiciona setinha personalizada para todos os selects */
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M6 8L10 12L14 8" stroke="%236b7280" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.2em auto;
    padding-right: 2.5rem;
}

.input-disabled {
    background-color: #f3f4f6 !important;
    /* bg-gray-100 */
    cursor: not-allowed !important;
    color: #6b7280 !important;
    /* text-gray-400 */
}

.input-editable {
    background-color: #e0f2fe !important;
    /* bg-blue-50 */
    border-color: #3b82f6 !important;
    /* border-blue-500 */
    color: #1e293b !important;
    /* text-gray-800 */
}

select.form-input {
    background-color: #fff !important;
    border: 1px solid #cbd5e1 !important;
    color: #374151 !important;
    min-height: 44px;
    height: 44px;
    padding-right: 2.5rem;
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M6 8L10 12L14 8" stroke="%233b82f6" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.2em auto;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.input-disabled.form-input,
input.form-input:disabled,
select.form-input:disabled,
textarea.form-input:disabled {
    background-color: #f3f4f6 !important;
    color: #6b7280 !important;
    cursor: not-allowed !important;
}

/* Estilos para hover e focus nos selects */
select:hover {
    border-color: #9ca3af;
    /* gray-400 */
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M6 8L10 12L14 8" stroke="%239ca3af" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}

select:focus {
    border-color: #005EC4;
    /* primary color */
    box-shadow: 0 0 0 2px rgba(0, 94, 196, 0.5);
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M6 8L10 12L14 8" stroke="%23005EC4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
    outline: none;
}

/* Estilo específico para selects com classe form-select */
select.form-select {
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M6 8L10 12L14 8" stroke="%236b7280" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.2em auto;
    padding-right: 2.5rem;
}

select.form-select:hover {
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M6 8L10 12L14 8" stroke="%239ca3af" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}

select.form-select:focus {
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M6 8L10 12L14 8" stroke="%23005EC4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}

/* Suporte para modo escuro nos selects */
body.dark-mode select {
    background-color: var(--color-input-bg) !important;
    border-color: var(--color-input-border) !important;
    color: var(--color-text) !important;
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M6 8L10 12L14 8" stroke="%23b0b0b0" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>') !important;
}

body.dark-mode select:hover {
    border-color: #4b5563;
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M6 8L10 12L14 8" stroke="%23d1d5db" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>') !important;
}

body.dark-mode select:focus {
    border-color: var(--color-primary);
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M6 8L10 12L14 8" stroke="%2390caf9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>') !important;
}

body.dark-mode select.form-select {
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M6 8L10 12L14 8" stroke="%23b0b0b0" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>') !important;
}

body.dark-mode select.form-select:hover {
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M6 8L10 12L14 8" stroke="%23d1d5db" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>') !important;
}

body.dark-mode select.form-select:focus {
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M6 8L10 12L14 8" stroke="%2390caf9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>') !important;
}
