/* Reset and General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--onx-main-bg);
    color: inherit;
}

html, body {
    height: 100%;
    overscroll-behavior: none;
}

body.school-dashboard {
    overflow: hidden;
}


/* Sidebar Styles */
:root {
    --sidebar-width: 280px;
    --sidebar-divider: 1px;
    --topbar-height: 65px;
}
.sidebar {
    height: calc(100vh - var(--topbar-height));
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: var(--sidebar-width);
    background: linear-gradient(to left, rgb(200, 133, 84), rgb(129, 102, 133));
    color: #fff;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    z-index: 1000;
    transform: translateX(0);
}

.sidebar.collapsed {
    transform: translateX(-100%);
    /* Hide completely off-screen */
}
body.sidebar-open .sidebar {
    transform: translateX(0);
}
body.sidebar-closed .sidebar {
    transform: translateX(-100%);
}

.sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.sidebar-header h5 {
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #fff;
    font-size: 1.2rem;
}

.logo {
    height: 50px;
    transition: height 0.3s ease;
}

.sidebar.collapsed .logo {
    height: 40px;
    margin: 0 auto;
}

.sidebar-content {
    padding-top: 1rem;
}

/* Accordion Styles */
.accordion-item {
    background: transparent !important;
    border: none;
    margin-bottom: 0.5rem;
}

.accordion-button {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #d1d5db !important;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    border-radius: 8px !important;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    overflow: hidden;
}

.accordion-button:not(.collapsed) {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.accordion-button:hover {
    background: rgba(255, 255, 250, 0.1) !important;
    color: #fff !important;
}

.accordion-button:focus {
    box-shadow: none;
}

.accordion-button::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E") !important;
}

.accordion-body {
    background: transparent !important;
    padding: 0;
}

.accordion-body .nav-link {
    color: #d1d5db;
    padding: 0.75rem 1.5rem 0.75rem 2.5rem;
    font-weight: 400;
    transition: all 0.3s ease;
    border-radius: 6px;
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
}

.accordion-body .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.accordion-body .nav-link.active {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    color: #fff !important;
    font-weight: 500;
}

/* Icon Styles */
.accordion-button i,
.nav-link i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    transition: font-size 0.3s ease;
}

/* Topbar Styles */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: linear-gradient(to right, rgb(200, 133, 84), rgb(129, 102, 133));
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid #e5e7eb;
    transition: left 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    z-index: 900;
}


.topbar.collapsed {
    left: 0;
    right: 0;
}

.topbar .btn-outline-secondary {
    border-color: #d1d5db;
    color: #374151;
}

.dark-mode .topbar .btn-outline-secondary {
    border-color: secondary;
    color: #d1d5db;
}

.topbar .btn-outline-secondary:hover {
    background: rgb(200, 133, 84);
    color: #fff;
    border-color: white;
}

/* Content Styles */
.content {
    margin-left: calc(var(--sidebar-width) + var(--sidebar-divider));
    margin-top: calc(var(--topbar-height));
    padding: 20px;
    background-color: #f0f4f8;
    height: calc(100vh - var(--topbar-height) - 15px);
    overflow-y: auto;
    overscroll-behavior: contain;
    transition: margin-left 0.3s ease;
    width: calc(100% - var(--sidebar-width) - var(--sidebar-divider));
}
body.sidebar-closed .topbar {
    left: 0;
}
body.sidebar-closed .content {
    margin-left: 0;
    width: 100%;
}

.content.collapsed {
    margin-left: 0;
    width: 100%;
}

.content.collapsed .container {
    max-width: 100%;
    width: 100%;
    padding-left: 20px;
    padding-right: 20px;
}


/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .topbar,
    .content {
        margin-left: 0;
        width: 100%;
    }

    .topbar.collapsed,
    .content.collapsed {
        margin-left: 0;
        width: 100%;
    }

    .topbar {
        left: 0;
        right: 0;
    }

    .content .container {
        max-width: 100%;
        width: 100%;
        padding-left: 20px;
        padding-right: 20px;
    }
}

.nome-escola {
    margin-left: 10px;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    display: flex;
    align-items: center;
    height: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#topbar > .d-flex:first-child {
    flex: 1 1 auto;
    min-width: 0;
}
#topbar > .d-flex:last-child {
    flex: 0 0 auto;
}

:root[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .modal-content {
    background: linear-gradient(to top, rgb(194, 181, 173), rgb(136, 133, 137));
    color: white;
}
:root[data-bs-theme="light"] .modal-content,
[data-bs-theme="light"] .modal-content {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: #1f2433;
    border: 1px solid #d5d8e4;
}

.modal-content label {
    color: white !important;
}

.modal-header {
    background-color: rgb(188, 134, 94);
    color: white;
}


/* Separadores (tabs) com aparência personalizada */
.nav-tabs .nav-link {
    border: 1px solid #ccc;
    border-bottom: none;
    background-color: transparent;
    color: #495057;
    font-weight: normal;
    transition: background-color 0.2s ease-in-out;
    opacity: 0.7;
}

/* Separador ativo em bold */
.nav-tabs .nav-link.active {
    font-weight: bold;
    background-color: #fff;
    opacity: 1;
    border-color: #dee2e6 #dee2e6 #fff;
}

/* Hover com fundo acinzentado */
.nav-tabs .nav-link:hover {
    background-color: #f0f0f0;
    opacity: 1;
}


/* Notificações Dropdown */
#notificacoesBadge {
    font-size: 0.7rem;
    padding: 0.25em 0.5em;
}

#notificacoesList {
    max-height: 400px;
    overflow-y: auto;
}

#notificacoesList .dropdown-item {
    white-space: normal;
    padding: 0.75rem 1rem;
}

#notificacoesList .dropdown-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

#notificacoesList .dropdown-item.fw-bold {
    background-color: rgba(0, 123, 255, 0.1);
}

/* Dark Mode - Notificações */
:root[data-bs-theme="dark"] #notificacoesList .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

:root[data-bs-theme="dark"] #notificacoesList .dropdown-item.fw-bold {
    background-color: rgba(123, 92, 255, 0.15);
}

/* Dark Mode Enhancements */
:root[data-bs-theme="dark"] body {
    background-color: #121212;
    color: #e9ecef;
}

:root[data-bs-theme="dark"] .sidebar {
    background: #212529;
    border-right: 1px solid #343a40;
}

:root[data-bs-theme="dark"] .topbar {
    background: #212529;
    border-bottom: 1px solid #343a40;
}

:root[data-bs-theme="dark"] .content {
    background-color: #121212;
}

:root[data-bs-theme="dark"] .card {
    background-color: #212529;
    border-color: #343a40;
    color: #e9ecef;
}

:root[data-bs-theme="dark"] .modal-content {
    background: linear-gradient(160deg, #1e213a 0%, #0a0b14 100%);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: #e9ecef;
    border: 1px solid rgba(123, 92, 255, 0.4);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9), 
                inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

:root[data-bs-theme="dark"] .modal-title {
    color: #a5b4fc;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
}

:root[data-bs-theme="dark"] .modal-header {
    background: linear-gradient(90deg, #252a41 0%, #1e213a 100%);
    border-bottom: 1px solid rgba(123, 92, 255, 0.2);
    padding: 1.25rem 1.5rem;
    border-top-left-radius: 19px;
    border-top-right-radius: 19px;
}

:root[data-bs-theme="dark"] .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

:root[data-bs-theme="dark"] .nav-tabs .nav-link {
    border-color: #495057;
    color: #adb5bd;
}

:root[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    background-color: #212529;
    color: #fff;
    border-color: #495057 #495057 #212529;
}

/* Dark Mode Buttons - Relevo e Animação */
:root[data-bs-theme="dark"] .btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    letter-spacing: 0.4px;
    position: relative;
}

/* Botões sólidos continuam sem borda no dark mode */
:root[data-bs-theme="dark"] .btn:not([class*="btn-outline-"]) {
    border: none !important;
}

/* Outline buttons: manter contorno visível no dark mode */
:root[data-bs-theme="dark"] .btn[class*="btn-outline-"] {
    border-width: 1px !important;
    border-style: solid !important;
    background-color: transparent !important;
}
:root[data-bs-theme="dark"] .btn-outline-warning {
    color: var(--bs-warning) !important;
    border-color: var(--bs-warning) !important;
}
:root[data-bs-theme="dark"] .btn-outline-warning:hover {
    background-color: var(--bs-warning) !important;
    color: #1a1a1a !important;
    border-color: var(--bs-warning) !important;
}

:root[data-bs-theme="dark"] .btn-primary {
    background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
    box-shadow: 0 4px 0px #3730a3, 0 8px 15px rgba(0, 0, 0, 0.4);
    color: white;
}

:root[data-bs-theme="dark"] .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 0px #3730a3, 0 10px 20px rgba(0, 0, 0, 0.5);
    background: linear-gradient(180deg, #818cf8 0%, #6366f1 100%);
}

:root[data-bs-theme="dark"] .btn-primary:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0px #3730a3, 0 2px 5px rgba(0, 0, 0, 0.5);
}

:root[data-bs-theme="dark"] .btn-success {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 0px #065f46, 0 8px 15px rgba(0, 0, 0, 0.3);
    color: white;
}

:root[data-bs-theme="dark"] .btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 0px #065f46, 0 10px 20px rgba(0, 0, 0, 0.4);
}

:root[data-bs-theme="dark"] .btn-success:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0px #065f46, 0 2px 5px rgba(0, 0, 0, 0.4);
}

:root[data-bs-theme="dark"] .btn-danger {
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 0px #991b1b, 0 8px 15px rgba(0, 0, 0, 0.3);
    color: white;
}

:root[data-bs-theme="dark"] .btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 0px #991b1b, 0 10px 20px rgba(0, 0, 0, 0.4);
}

:root[data-bs-theme="dark"] .btn-danger:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0px #991b1b, 0 2px 5px rgba(0, 0, 0, 0.4);
}

:root[data-bs-theme="dark"] .btn-warning {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 0px #92400e, 0 8px 15px rgba(0, 0, 0, 0.3);
    color: #1a1a1a;
}

:root[data-bs-theme="dark"] .btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 0px #92400e, 0 10px 20px rgba(0, 0, 0, 0.4);
}

:root[data-bs-theme="dark"] .btn-warning:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0px #92400e, 0 2px 5px rgba(0, 0, 0, 0.4);
}

/* Dark Mode Inputs */
:root[data-bs-theme="dark"] .form-control,
:root[data-bs-theme="dark"] .form-select,
:root[data-bs-theme="dark"] input[type="text"],
:root[data-bs-theme="dark"] input[type="email"],
:root[data-bs-theme="dark"] input[type="password"],
:root[data-bs-theme="dark"] input[type="number"],
:root[data-bs-theme="dark"] input[type="date"],
:root[data-bs-theme="dark"] input[type="tel"],
:root[data-bs-theme="dark"] textarea,
:root[data-bs-theme="dark"] .flatpickr-input {
    background-color: #1e213a !important;
    border: 1px solid rgba(123, 92, 255, 0.3) !important;
    color: #e9ecef !important;
    transition: all 0.3s ease;
}

:root[data-bs-theme="dark"] .form-control:focus,
:root[data-bs-theme="dark"] .form-select:focus,
:root[data-bs-theme="dark"] input[type="text"]:focus,
:root[data-bs-theme="dark"] input[type="email"]:focus,
:root[data-bs-theme="dark"] input[type="password"]:focus,
:root[data-bs-theme="dark"] input[type="number"]:focus,
:root[data-bs-theme="dark"] input[type="date"]:focus,
:root[data-bs-theme="dark"] input[type="tel"]:focus,
:root[data-bs-theme="dark"] textarea:focus,
:root[data-bs-theme="dark"] .flatpickr-input:focus {
    background-color: #252a41 !important;
    border-color: rgba(123, 92, 255, 0.6) !important;
    color: #fff !important;
    box-shadow: 0 0 0 0.2rem rgba(123, 92, 255, 0.25) !important;
    outline: none;
}

:root[data-bs-theme="dark"] .form-control::placeholder,
:root[data-bs-theme="dark"] textarea::placeholder,
:root[data-bs-theme="dark"] input::placeholder {
    color: transparent !important;
    opacity: 0 !important;
}

/* Forçar SweetAlert2 no Dark Mode */
html[data-bs-theme="dark"] .swal2-popup {
    background: linear-gradient(160deg, #1e213a 0%, #0a0b14 100%) !important;
    color: #e9ecff !important;
    border: 1px solid rgba(123, 92, 255, 0.4) !important;
}

html[data-bs-theme="dark"] .swal2-title,
html[data-bs-theme="dark"] .swal2-html-container,
html[data-bs-theme="dark"] .swal2-content {
    color: #e9ecff !important;
}

html[data-bs-theme="dark"] .swal2-confirm:not([style*="background-color"]):not([style*="background"]) {
    background-color: #7b5cff !important;
}

html[data-bs-theme="dark"] .swal2-cancel:not([style*="background-color"]):not([style*="background"]) {
    background-color: #15182a !important;
    border: 1px solid #26293b !important;
}

/* Overlay do SweetAlert2 controlado no theme-dark.css.
   Removido aqui para evitar duplicação de escurecimento no dark mode. */


:root[data-bs-theme="dark"] .form-label {
    color: #a5b4fc !important;
    font-weight: 500;
}

:root[data-bs-theme="dark"] .form-floating > label {
    color: #6c757d !important;
}

:root[data-bs-theme="dark"] .form-floating > .form-control:focus ~ label,
:root[data-bs-theme="dark"] .form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: #a5b4fc !important;
}

/* Dark Mode Quill Editor (Observações) */
:root[data-bs-theme="dark"] .ql-container,
:root[data-bs-theme="dark"] #editor-observacoes .ql-container {
    background-color: #1e213a !important;
    border: 1px solid rgba(123, 92, 255, 0.3) !important;
    border-radius: 0.375rem !important;
    color: #e9ecef !important;
}

:root[data-bs-theme="dark"] .ql-editor,
:root[data-bs-theme="dark"] #editor-observacoes .ql-editor {
    background-color: #1e213a !important;
    color: #e9ecef !important;
}

:root[data-bs-theme="dark"] .ql-editor.ql-blank::before,
:root[data-bs-theme="dark"] #editor-observacoes .ql-editor.ql-blank::before {
    color: #6c757d !important;
    opacity: 0.7;
}

:root[data-bs-theme="dark"] .ql-toolbar,
:root[data-bs-theme="dark"] #editor-observacoes .ql-toolbar {
    background-color: #252a41 !important;
    border: 1px solid rgba(123, 92, 255, 0.3) !important;
    border-bottom: none !important;
    border-radius: 0.375rem 0.375rem 0 0 !important;
}

:root[data-bs-theme="dark"] .ql-toolbar .ql-stroke,
:root[data-bs-theme="dark"] #editor-observacoes .ql-toolbar .ql-stroke {
    stroke: #a5b4fc !important;
}

:root[data-bs-theme="dark"] .ql-toolbar .ql-fill,
:root[data-bs-theme="dark"] #editor-observacoes .ql-toolbar .ql-fill {
    fill: #a5b4fc !important;
}

:root[data-bs-theme="dark"] .ql-toolbar button:hover,
:root[data-bs-theme="dark"] .ql-toolbar button:focus,
:root[data-bs-theme="dark"] .ql-toolbar button.ql-active,
:root[data-bs-theme="dark"] #editor-observacoes .ql-toolbar button:hover,
:root[data-bs-theme="dark"] #editor-observacoes .ql-toolbar button:focus,
:root[data-bs-theme="dark"] #editor-observacoes .ql-toolbar button.ql-active {
    background-color: rgba(123, 92, 255, 0.2) !important;
    border-radius: 4px !important;
}

:root[data-bs-theme="dark"] .ql-toolbar .ql-picker-label,
:root[data-bs-theme="dark"] #editor-observacoes .ql-toolbar .ql-picker-label {
    color: #a5b4fc !important;
}

:root[data-bs-theme="dark"] .ql-toolbar .ql-picker-options,
:root[data-bs-theme="dark"] #editor-observacoes .ql-toolbar .ql-picker-options {
    background-color: #252a41 !important;
    border: 1px solid rgba(123, 92, 255, 0.3) !important;
    color: #e9ecef !important;
}

:root[data-bs-theme="dark"] .btn-outline-secondary {
    border-color: #3b82f6 !important;
    color: #60a5fa !important;
    background: rgba(59, 130, 246, 0.1) !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

:root[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background: #3b82f6 !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}
