/* ================================================================
   settings.css — Conecta Bueno
   Página "Configurações" — segue o mesmo design system das demais
   páginas do site (header hd-*, paleta leaf/grey, tipografia
   Poppins/Inter). Antes esta página usava um layout de painel
   administrativo genérico (azul/cinza) sem relação com o resto do
   site — foi substituído por cartões e cores consistentes.
   ================================================================ */

:root {
    /* Verde folha — mesma identidade usada em home.css/shared-components.css */
    --leaf-400: #4cc177;
    --leaf-500: #2f9e52;
    --leaf-700: #1f7a41;
    --leaf-900: #145c30;

    --grey-50:  #f7f9f8;
    --grey-100: #f3f4f6;
    --grey-200: #e5e7eb;
    --grey-300: #d1d5db;
    --grey-400: #9ca3af;
    --grey-500: #6b7280;
    --grey-600: #4b5563;
    --grey-700: #374151;
    --grey-900: #111827;

    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --info-color: #2196f3;

    --font-display: 'Poppins', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;

    --shadow-soft: 0 10px 26px rgba(20, 45, 30, 0.08);
    --shadow-card: 0 20px 46px rgba(20, 45, 30, 0.12);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --header-h: 66px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--grey-50);
    color: var(--grey-900);
    line-height: 1.6;
    min-height: 100vh;
}

/* ================================================================
   LOADING OVERLAY
   ================================================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(145deg, #0f2419, var(--leaf-900));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    z-index: 10000;
    color: white;
}

.loading-spinner {
    width: 46px;
    height: 46px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

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

.loading-overlay p {
    font-size: calc(15px * var(--a11y-text-scale, 1));
    opacity: 0.9;
}

/* ================================================================
   HEADER (sem hero atrás — usa sempre o fundo opaco, como em
   observatorio.html, em vez do gradiente translúcido pensado
   para ficar sobre uma imagem/vídeo de hero)
   ================================================================ */
.site-header {
    background: rgba(15, 36, 25, .92);
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

/* ================================================================
   LAYOUT — sidebar fixa sob o header + área de conteúdo fluida,
   mesmo padrão estrutural de observatorio.html/panel.html.
   ================================================================ */
.admin-layout {
    display: flex;
    min-height: calc(100vh - var(--header-h));
    margin-top: var(--header-h);
    background: var(--grey-50);
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.admin-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: white;
    border-right: 1px solid var(--grey-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--grey-600);
    font-family: var(--font-body);
    font-size: calc(14px * var(--a11y-text-scale, 1));
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.nav-item svg {
    color: var(--grey-400);
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.nav-item:hover {
    background: #f0f7f2;
    color: var(--leaf-900);
}

.nav-item:hover svg {
    color: var(--leaf-700);
}

.nav-item.active {
    background: #e3f3e9;
    color: var(--leaf-900);
    font-weight: 700;
}

.nav-item.active svg {
    color: var(--leaf-900);
}

/* ================================================================
   CONTENT AREA
   ================================================================ */
.admin-main {
    flex: 1;
    margin-left: 280px;
    padding: 32px;
    max-width: calc(100% - 280px);
}

/* Botão que abre a sidebar como gaveta no mobile/tablet — só
   aparece abaixo de 1024px (ver media query mais abaixo) */
.section-menu-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin-bottom: 20px;
    background: white;
    border: 1px solid var(--grey-200);
    border-radius: 10px;
    color: var(--leaf-900);
    font-family: var(--font-body);
    font-size: calc(14px * var(--a11y-text-scale, 1));
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.section-menu-toggle:hover {
    background: #f0f7f2;
    border-color: var(--leaf-500);
}

.admin-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: var(--header-h) 0 0 0;
    background: rgba(15, 36, 25, .45);
    z-index: 999;
}

.admin-sidebar-backdrop.active {
    display: block;
}

.section-content {
    display: none;
}

.section-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.content-header {
    margin-bottom: 24px;
}

.content-header h2 {
    font-family: var(--font-display);
    font-size: calc(26px * var(--a11y-text-scale, 1));
    font-weight: 700;
    color: var(--leaf-900);
    margin: 0 0 6px 0;
}

.content-header p {
    font-size: calc(14.5px * var(--a11y-text-scale, 1));
    color: var(--grey-500);
    margin: 0;
}

/* ================================================================
   SETTINGS CARD
   ================================================================ */
.settings-card {
    background: white;
    border: 1px solid var(--grey-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-section {
    padding: 28px;
}

.card-section h3 {
    font-family: var(--font-display);
    font-size: calc(17px * var(--a11y-text-scale, 1));
    font-weight: 700;
    color: var(--grey-900);
    margin: 0 0 18px 0;
}

.section-description {
    font-size: calc(14px * var(--a11y-text-scale, 1));
    color: var(--grey-500);
    line-height: 1.6;
    margin-bottom: 18px;
}

.divider {
    height: 1px;
    background: var(--grey-200);
}

/* ================================================================
   PROFILE PHOTO SECTION
   ================================================================ */
.profile-photo-section {
    display: flex;
    align-items: center;
    gap: 24px;
}

.current-photo {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--leaf-500), var(--leaf-900));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: calc(32px * var(--a11y-text-scale, 1));
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    border: 4px solid white;
    box-shadow: var(--shadow-soft);
}

.current-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}

.photo-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.photo-actions .form-hint {
    flex-basis: 100%;
}

/* ================================================================
   FORM ELEMENTS
   ================================================================ */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: calc(13.5px * var(--a11y-text-scale, 1));
    font-weight: 700;
    color: var(--grey-700);
}

.form-input {
    padding: 12px 16px;
    border: 1.5px solid var(--grey-200);
    border-radius: 10px;
    font-size: calc(15px * var(--a11y-text-scale, 1));
    font-family: var(--font-body);
    color: var(--grey-900);
    transition: all 0.2s ease;
    background: white;
    width: 100%;
}

.form-input:focus {
    outline: none;
    border-color: var(--leaf-500);
    box-shadow: 0 0 0 3px rgba(47, 158, 82, 0.15);
}

.form-input::placeholder {
    color: var(--grey-400);
}

.form-hint {
    font-size: calc(12.5px * var(--a11y-text-scale, 1));
    color: var(--grey-500);
}

.input-with-icon {
    position: relative;
}

.input-with-icon .form-input {
    padding-right: 45px;
}

.btn-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--grey-400);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.btn-toggle-password:hover {
    color: var(--leaf-700);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--leaf-500), var(--leaf-900));
    color: white;
    border: none;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: calc(14.5px * var(--a11y-text-scale, 1));
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(31, 122, 65, 0.25);
    text-decoration: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--leaf-700), var(--leaf-900));
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(31, 122, 65, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: white;
    color: var(--grey-600);
    border: 1.5px solid var(--grey-200);
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: calc(14.5px * var(--a11y-text-scale, 1));
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: var(--leaf-500);
    color: var(--leaf-900);
    background: #f0f7f2;
}

/* ================================================================
   DATA ACTIONS & DANGER ZONE
   ================================================================ */
.data-actions,
.danger-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-data-export,
.btn-danger {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    border: 1.5px solid var(--grey-200);
    border-radius: var(--radius-md);
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
    font-family: var(--font-body);
}

.btn-data-export:hover {
    border-color: var(--leaf-500);
    background: #f0f7f2;
}

.btn-data-export svg {
    color: var(--leaf-700);
    flex-shrink: 0;
}

.btn-data-export h4,
.btn-danger h4 {
    font-size: calc(14.5px * var(--a11y-text-scale, 1));
    font-weight: 700;
    color: var(--grey-900);
    margin: 0 0 4px 0;
}

.btn-data-export p,
.btn-danger p {
    font-size: calc(13px * var(--a11y-text-scale, 1));
    color: var(--grey-500);
    margin: 0;
    line-height: 1.5;
}

.danger-zone {
    background: #fef5f5;
}

.btn-danger {
    border-color: #f8d3d3;
    background: white;
}

.btn-danger:hover {
    border-color: var(--danger-color);
    background: #fdeeee;
}

.btn-danger svg {
    color: var(--danger-color);
    flex-shrink: 0;
}

/* ================================================================
   LGPD INFO
   ================================================================ */
.lgpd-info {
    margin-top: 24px;
    padding: 22px;
    background: white;
    border: 1px solid var(--grey-200);
    border-radius: var(--radius-lg);
    display: flex;
    gap: 16px;
}

.lgpd-info svg {
    color: var(--leaf-700);
    flex-shrink: 0;
}

.lgpd-info h4 {
    font-size: calc(14.5px * var(--a11y-text-scale, 1));
    font-weight: 700;
    color: var(--grey-900);
    margin: 0 0 12px 0;
}

.lgpd-info ul {
    margin: 0;
    padding-left: 20px;
    list-style: disc;
}

.lgpd-info li {
    font-size: calc(13.5px * var(--a11y-text-scale, 1));
    color: var(--grey-600);
    margin-bottom: 6px;
    line-height: 1.5;
}

.lgpd-info li:last-child {
    margin-bottom: 0;
}

/* ================================================================
   TOAST NOTIFICATIONS
   ================================================================ */
.toast-container {
    position: fixed;
    top: 84px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    background: white;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid var(--leaf-700);
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left-color: var(--leaf-500); }
.toast.error   { border-left-color: var(--danger-color); }
.toast.info    { border-left-color: var(--info-color); }

.toast-icon {
    font-size: calc(20px * var(--a11y-text-scale, 1));
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: calc(14px * var(--a11y-text-scale, 1));
    color: var(--grey-900);
    font-weight: 500;
}

/* ================================================================
   MODAL
   ================================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 30, 22, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
    backdrop-filter: blur(3px);
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-card);
    animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.94); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 24px 28px 18px;
    border-bottom: 1px solid var(--grey-100);
}

.modal-header h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: calc(19px * var(--a11y-text-scale, 1));
    font-weight: 700;
    color: var(--grey-900);
}

.modal-body {
    padding: 22px 28px;
}

.modal-body p {
    margin: 0;
    font-size: calc(14.5px * var(--a11y-text-scale, 1));
    color: var(--grey-600);
    line-height: 1.6;
}

.modal-footer {
    padding: 18px 28px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1024px) {
    .admin-sidebar {
        left: -280px;
        transition: left 0.3s ease;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .admin-sidebar.active {
        left: 0;
    }

    .admin-main {
        margin-left: 0;
        padding: 24px;
        max-width: 100%;
    }

    .section-menu-toggle {
        display: flex;
    }
}

@media (max-width: 640px) {
    .admin-main {
        padding: 20px;
    }

    .content-header h2 {
        font-size: calc(22px * var(--a11y-text-scale, 1));
    }

    .card-section {
        padding: 22px 20px;
    }

    .profile-photo-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 18px;
    }

    .photo-actions {
        width: 100%;
    }

    .photo-actions button {
        flex: 1 1 auto;
    }

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

    .form-actions button {
        width: 100%;
    }

    .toast-container {
        left: 16px;
        right: 16px;
        top: 76px;
        max-width: none;
    }

    .modal-content {
        margin: 0 16px;
    }
}

/* ================================================================
   UTILITIES
   ================================================================ */
.hidden {
    display: none !important;
}

/* ================================================================
   ACESSIBILIDADE — ajustes específicos das configurações
   ================================================================ */
.a11y-focus .settings-card {
    box-shadow: none;
}

.a11y-high-contrast .admin-sidebar,
.a11y-high-contrast .settings-card,
.a11y-high-contrast .card-section {
    background: #fff !important;
    background-image: none !important;
    color: #111827 !important;
    border-color: #000 !important;
}

.a11y-high-contrast .admin-sidebar *,
.a11y-high-contrast .settings-card *,
.a11y-high-contrast .card-section * {
    color: inherit !important;
    background: transparent !important;
    background-image: none !important;
    text-shadow: none !important;
}

.a11y-high-contrast .nav-item.active {
    outline: 2px solid #000 !important;
}
