/* --- NEW SPINNER STYLES --- */

/* --- ESTILOS DO BANNER DE MANUTENÇÃO --- */
#maintenance-banner {
    background-color: #fff3cd; /* Amarelo de alerta do Bootstrap */
    color: #856404;
    text-align: center;
    padding: 10px 15px;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 2000; /* Garante que fique acima da navbar */
    border-bottom: 1px solid #ffeeba;
}

#maintenance-banner p {
    margin: 0;
}

body.dark-mode #maintenance-banner {
    background-color: #664d03;
    color: #ffecb5;
    border-bottom-color: #997404;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    display: none;
    justify-content: center;
    align-items: center;
}

.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* --- END OF SPINNER STYLES --- */

/* --- NEW VISUAL FEEDBACK STYLES --- */
.highlight-change {
    background-color: #d4edda !important;
    transition: background-color 1.5s ease-out;
}

body.dark-mode .highlight-change {
    background-color: #2a4b37 !important;
}

/* --- END OF VISUAL FEEDBACK STYLES --- */

.page-wrapper {
    display: flex;
    flex-wrap: nowrap;
}

.sidebar-left {
    width: 250px;
    background-color: #f8f9fa;
    flex-shrink: 0;
    cursor: pointer;
}

.content-area {
    flex-grow: 1;
    overflow-x: auto;
}

.sidebar-right {
    width: 250px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s ease, padding 0.3s ease;
    flex-shrink: 0;
    max-height: calc(100vh - 80px);
    /* Limit height to enable scroll */
}

.sidebar-right.hidden {
    width: 0;
    padding: 0;
    overflow: hidden;
}

.sidebar-down {
    display: none;
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    min-height: 65px;
    background-color: #f8f9fa;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    padding: 10px 15px;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.toggle-sidebar-right {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    cursor: pointer;
}

table.dataTable {
    margin: 0 auto;
    width: 80%;
    table-layout: auto;
    margin-bottom: 50px;
    margin-right: 50px;
}

.dataTables_wrapper {
    overflow-x: auto;
}

.clickable-item {
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.clickable-item:hover {
    background-color: #f0f0f0;
}

.clickable-item strong {
    color: #2196F3;
    font-weight: bold;
}

.forms {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out, margin 0.3s ease-in-out;
    /* Added padding and margin to transition */
    padding: 0 15px;
    /* Vertical padding set to 0 */
    margin: 0 0 0 15px;
    /* Top and bottom margin set to 0 */
    border-left: 3px solid #e0e0e0;
}

.forms.open {
    max-height: 700px;
    padding: 15px;
    margin-top: 10px;
    overflow: visible;
}

.forms input,
.forms select,
.forms textarea {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.forms .input-container {
    position: relative;
}

.forms .tooltip-text {
    visibility: hidden;
    width: 260px;
    background-color: #333;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 10;
    bottom: 115%;
    left: 50%;
    margin-left: -130px;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: normal;
    font-size: 13px;
    line-height: 1.4;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.forms .input-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

#transformation-container {
    padding: 10px 0;
}

.transformation-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 5px;
}

.tab {
    display: flex;
    align-items: center;
    padding-left: 15px;
    padding-right: 8px;
}

.tab,
.add-branch-btn {
    padding-top: 6px;
    padding-bottom: 6px;
    margin-right: 5px;
    margin-bottom: 5px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 5px 5px 0 0;
    background-color: #f1f1f1;
    font-size: 14px;
    white-space: nowrap;
}

.tab.active {
    background-color: white;
    border-bottom-color: white;
    position: relative;
    top: 1px;
    font-weight: bold;
}

.close-tab {
    font-family: 'Helvetica', 'Arial', sans-serif;
    font-weight: bold;
    margin-left: 10px;
    padding: 0 4px;
    border-radius: 50%;
}

.close-tab:hover {
    background-color: #e0e0e0;
    color: #d32f2f;
}

.add-branch-btn {
    background-color: #28a745;
    color: white;
    font-weight: bold;
    border-color: #28a745;
    padding-left: 15px;
    padding-right: 15px;
}

.add-branch-btn:hover {
    background-color: #218838;
}

.command-display {
    display: none;
    margin-top: 10px;
    padding: 8px;
    border-radius: 4px;
    word-break: break-all;
}

#drop-zone {
    border: 2px dashed #ccc;
    border-radius: 5px;
    text-align: center;
    transition: border-color 0.3s, background-color 0.3s;
}

#drop-zone.dragover {
    border-color: #007bff;
    background-color: #f0f8ff;
}

#drop-zone .form-control-file {
    display: none;
}

#welcome-message {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 45vh;
    text-align: center;
    opacity: 1;
    transition: opacity 0.5s ease-out, height 0.5s ease-out;
    overflow: hidden;
}

#welcome-message.hidden {
    opacity: 0;
    height: 0;
    margin: 0;
    padding: 0;
}

#welcome-message h2 {
    font-size: 2.8rem;
    font-weight: bold;
    background: linear-gradient(45deg, #28a745, #2196F3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

#welcome-message p {
    font-size: 1.25rem;
    color: #6c757d;
}

div.dt-buttons {
    float: left;
    margin-right: 15px;
    margin-bottom: 10px;
}

.dt-button {
    align-items: center;
    appearance: none;
    background-color: #fff;
    border-radius: 24px;
    border-style: none;
    box-shadow: rgba(0, 0, 0, .2) 0 3px 5px -1px, rgba(0, 0, 0, .14) 0 6px 10px 0, rgba(0, 0, 0, .12) 0 1px 18px 0;
    box-sizing: border-box;
    color: #3c4043;
    cursor: pointer;
    display: inline-flex;
    fill: currentcolor;
    font-family: "Google Sans", Roboto, Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    height: 40px;
    justify-content: center;
    letter-spacing: .25px;
    line-height: normal;
    max-width: 100%;
    overflow: visible;
    padding: 2px 24px;
    position: relative;
    text-align: center;
    text-transform: none;
    transition: box-shadow 280ms cubic-bezier(.4, 0, .2, 1), opacity 15ms linear 30ms, transform 270ms cubic-bezier(0, 0, .2, 1) 0ms;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    width: auto;
    will-change: transform, opacity;
    z-index: 0;
}

.dt-button:hover {
    background: #F6F9FE;
    color: #174ea6;
}

.dt-button:active {
    box-shadow: 0 4px 4px 0 rgb(60 64 67 / 30%), 0 8px 12px 6px rgb(60 64 67 / 15%);
    outline: none;
}

.dt-button:focus {
    outline: none;
    border: 2px solid #4285f4;
}

.dt-button:not(:disabled) {
    box-shadow: rgba(60, 64, 67, .3) 0 1px 3px 0, rgba(60, 64, 67, .15) 0 4px 8px 3px;
}

.dt-button:not(:disabled):hover {
    box-shadow: rgba(60, 64, 67, .3) 0 2px 3px 0, rgba(60, 64, 67, .15) 0 6px 10px 4px;
}

.dt-button:not(:disabled):focus {
    box-shadow: rgba(60, 64, 67, .3) 0 1px 3px 0, rgba(60, 64, 67, .15) 0 4px 8px 3px;
}

.dt-button:not(:disabled):active {
    box-shadow: rgba(60, 64, 67, .3) 0 4px 4px 0, rgba(60, 64, 67, .15) 0 8px 12px 6px;
}

.dt-button:disabled {
    box-shadow: rgba(60, 64, 67, .3) 0 1px 3px 0, rgba(60, 64, 67, .15) 0 4px 8px 3px;
    cursor: not-allowed;
    opacity: 0.6;
}

#myTable tbody td {
    position: relative;
}

.edit-toolbar {
    position: absolute;
    top: -35px;
    left: 0;
    background-color: #333;
    border-radius: 5px;
    padding: 5px;
    display: inline-flex;
    gap: 5px;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.edit-toolbar button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 2px 5px;
    font-size: 14px;
}

.edit-toolbar button:hover {
    background-color: #555;
}

div.editor-active[contenteditable="true"] {
    border: 1px solid #007bff;
    padding: 5px;
    min-height: 30px;
    outline: none;
    background-color: #fff;
    border-radius: 3px;
}

/* --- STYLES FOR HEADER & SIDEBARS --- */
.navbar {
    background-color: #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 0.75rem 1.5rem;
}

.navbar-brand {
    font-family: "Google Sans", Roboto, Arial, sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
}

.sidebar-sticky {
    padding: 20px;
}

#drop-zone {
    padding: 30px 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

#drop-zone .fa-upload {
    font-size: 2.2rem;
    color: #007bff;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

#drop-zone:hover .fa-upload {
    opacity: 1;
}

#upload-form .btn-primary {
    border-radius: 24px;
    border-style: none;
    box-shadow: rgba(0, 0, 0, .2) 0 3px 5px -1px, rgba(0, 0, 0, .14) 0 6px 10px 0, rgba(0, 0, 0, .12) 0 1px 18px 0;
    font-family: "Google Sans", Roboto, Arial, sans-serif;
    font-weight: 500;
    letter-spacing: .25px;
    transition: box-shadow 280ms cubic-bezier(.4, 0, .2, 1);
    width: 100%;
    background-color: #28a745;
    border-color: #28a745;
}

#upload-form .btn-primary:hover {
    background-color: #218838;
    border-color: #1e7e34;
    box-shadow: rgba(60, 64, 67, .3) 0 2px 3px 0, rgba(60, 64, 67, .15) 0 6px 10px 4px;
}

/* --- NEW STYLES FOR FLOW INPUT --- */
#flow-drop-zone {
    cursor: pointer;
    border: 2px dashed #8da0cb;
    border-radius: 5px;
    text-align: center;
    transition: border-color 0.3s, background-color 0.3s;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

#flow-drop-zone .fa-project-diagram {
    font-size: 2rem;
    color: #8da0cb;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

#flow-drop-zone.dragover {
    border-color: #5a6a90;
    background-color: #f0f2f5;
}

#flow-drop-zone .form-control-file {
    display: none;
}

#flow-drop-zone:hover .fa-project-diagram {
    opacity: 1;
}

/* --- END OF NEW STYLES --- */

.sidebar-footer {
    text-align: center;
    padding: 15px 0;
    margin-top: 25px;
    font-size: 12px;
    color: #888;
}

/* --- NEW SIDEBAR HEADER --- */
.sidebar-header-info {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    margin-bottom: 20px;
}

.sidebar-header-info i {
    font-size: 1.2rem;
    color: #777;
    cursor: help;
}

.sidebar-header-info .tooltip-text {
    visibility: hidden;
    opacity: 0;
    width: 220px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: fixed;
    /* Changed to fixed to float over the page */
    z-index: 3010;
    transition: opacity 0.3s ease;
    font-size: 13px;
    white-space: normal;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.sidebar-right hr.section-divider {
    margin: 24px 0;
    /* Standardized margin */
    border-top: 1px solid rgba(0, 0, 0, .1);
}

/* Rule to standardize spacing for tool section headers */
.sidebar-right>div>h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

/* --- NEW MODAL STYLES --- */
.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 10px;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

#new-flow-drop-zone {
    cursor: pointer;
    border: 2px dashed #ccc;
    border-radius: 5px;
    text-align: center;
    transition: border-color 0.3s, background-color 0.3s;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

#new-flow-drop-zone .fa-upload {
    font-size: 2rem;
    color: #007bff;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

#new-flow-drop-zone:hover .fa-upload {
    opacity: 1;
}

#new-flow-drop-zone.dragover {
    border-color: #007bff;
    background-color: #f0f8ff;
}

#new-flow-drop-zone .form-control-file {
    display: none;
}

/* --- END OF MODAL STYLES --- */

/* --- THEME TOGGLE STYLES --- */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    margin-left: auto;
    margin-right: 70px;
    /* Space from the right sidebar toggle */
    position: relative;
    top: 3px;
    /* Nudge down for vertical alignment */
}

.theme-switch {
    display: inline-block;
    height: 28px;
    /* Resized */
    position: relative;
    width: 52px;
    /* Resized */
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #444444;
    /* Darker background for sun icon */
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
}

.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 20px;
    /* Resized */
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 20px;
    /* Resized */
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Icon inside the toggle */
.slider.round::after {
    font-family: 'Arial', sans-serif;
    content: '☀️';
    /* Sun icon */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    right: 6px;
    color: transparent;
    text-shadow: 0 0 0 #f39c12;
    transition: all 0.4s;
}

input:checked+.slider {
    background-color: #9b59b6;
    /* Accent Purple */
}

input:checked+.slider:before {
    transform: translateX(24px);
    /* Adjusted for new size */
}

input:checked+.slider.round::after {
    content: '🌙';
    /* Moon icon */
    left: 6px;
    right: auto;
    text-shadow: 0 0 0 #f1c40f;
}

/* --- DARK MODE PALETTE (New Harmonic Theme) --- */
body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode .navbar,
body.dark-mode .sidebar-left,
body.dark-mode .sidebar-down {
    background-color: #2c2c2c;
    color: #e0e0e0;
    border-color: #444;
}

body.dark-mode .navbar-brand {
    color: #f5f5f5;
}

body.dark-mode .sidebar-right {
    background-color: #252525;
    box-shadow: -2px 0 5px rgba(255, 255, 255, 0.05);
}

body.dark-mode .clickable-item:hover,
body.dark-mode .tab:hover {
    background-color: #404040;
}

body.dark-mode .forms {
    background-color: #2c2c2c;
}

body.dark-mode .forms input,
body.dark-mode .forms select,
body.dark-mode .forms textarea {
    background-color: #333;
    /* Light gray on dark background */
    color: #f1f1f1;
    border: 1px solid #555;
}

body.dark-mode .sidebar-header-info>span:first-of-type {
    color: #9b59b6;
    /* Purple Accent for "Tools" title */
}

body.dark-mode .sidebar-right h3 {
    color: #9b59b6 !important;
    /* Purple Accent for all section titles */
}

body.dark-mode .clickable-item strong {
    color: #fd971f;
    /* Orange Accent for function names */
}

body.dark-mode .sidebar-right hr.section-divider {
    border-top: 1px solid rgba(255, 255, 255, .1);
}

body.dark-mode .tab.active {
    background-color: #1a1a1a;
    border-bottom-color: #1a1a1a;
}

body.dark-mode .tab {
    color: #e0e0e0;
    /* Ensuring text on tabs is readable */
}

body.dark-mode #welcome-message p {
    color: #aaa;
}

/* DataTables Dark Mode */
body.dark-mode .dataTables_wrapper,
body.dark-mode .dataTables_length label,
body.dark-mode .dataTables_filter label,
body.dark-mode .dataTables_info,
body.dark-mode .paginate_button {
    color: #e0e0e0 !important;
}

body.dark-mode table.dataTable thead th,
body.dark-mode table.dataTable thead td {
    color: #f0f0f0;
    border-bottom: 1px solid #555;
}

body.dark-mode table.dataTable,
body.dark-mode table.dataTable tbody tr {
    background-color: #2c2c2c;
}

body.dark-mode table.dataTable tbody td {
    color: #e0e0e0;
    border-top: 1px solid #444;
}

body.dark-mode table.dataTable tr.odd {
    background-color: #2c2c2c;
}

body.dark-mode table.dataTable tr.even {
    background-color: #333333;
}

body.dark-mode table.dataTable tr.odd>.sorting_1,
body.dark-mode table.dataTable tr.even>.sorting_1 {
    background-color: #3a3a3a;
}

body.dark-mode .paginate_button.current,
body.dark-mode .paginate_button.current:hover {
    background: #9b59b6 !important;
    /* Purple Accent */
    color: white !important;
    border-color: #9b59b6 !important;
}

body.dark-mode .paginate_button:hover {
    background: #444 !important;
    border-color: #555 !important;
    color: #e0e0e0 !important;
}

body.dark-mode .dt-button {
    background-color: #3c4043;
    color: #f1f1f1;
    box-shadow: none;
}

body.dark-mode .dt-button:hover {
    background: #555;
    color: #fff;
}

body.dark-mode #drop-zone,
body.dark-mode #flow-drop-zone {
    border-color: #555;
}

body.dark-mode #drop-zone.dragover,
body.dark-mode #flow-drop-zone.dragover {
    border-color: #9b59b6;
    /* Purple Accent */
    background-color: #333;
}

/* MODIFIED: Updated Button Colors in Dark Mode */
body.dark-mode .add-branch-btn {
    background-color: #8AB0AB;
    border-color: #8AB0AB;
}

body.dark-mode .add-branch-btn:hover {
    background-color: #799a95;
    border-color: #799a95;
}

body.dark-mode #upload-form .btn-primary {
    background-color: #79458d;
}

body.dark-mode #upload-form .btn-primary:hover {
    background-color: #502d50;
}

/* Modal Dark Mode */
body.dark-mode .modal-content {
    background-color: #2c2c2c;
    border-color: #444;
}

body.dark-mode .modal-content h2,
body.dark-mode .modal-content label,
body.dark-mode .modal-content .form-check-label {
    color: #e0e0e0;
}

body.dark-mode .modal-content .form-control,
body.dark-mode .modal-content .form-check-input {
    background-color: #333;
    color: #f1f1f1;
    border: 1px solid #555;
}

body.dark-mode #new-flow-drop-zone {
    border-color: #555;
}

body.dark-mode #new-flow-drop-zone.dragover {
    border-color: #9b59b6;
    background-color: #333;
}

body.dark-mode .modal-content .btn-success {
    background-color: #79458d;
    border-color: #79458d;
}

body.dark-mode .modal-content .btn-success:hover {
    background-color: #502d50;
    border-color: #502d50;
}

/* --- END OF DARK MODE --- */

