/* ===== BASE ===== */
html {
    font-size: 20px;
}

body {
    font-family: Arial, sans-serif;
    background-color: #747474;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

/* ===== HEADER ===== */
header {
    background-color: #001495;
    color: white;
    padding: 1.1rem 0.8rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.1rem 0.4rem rgba(0, 0, 0, 0.1);
    width: 97%;
    max-width: 22.5rem;
    display: flex;
    justify-content: space-between;
}

#user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#user-info {
    font-size: 1rem;
    font-weight: bold;
    padding: 0.3em 0.3em 0.3em 0em;
}

#user-btn {
    width: 10rem;
    display: flex;
    gap: 0.4rem;
}

/* ===== BOTÕES DE TOPO ===== */
#configBtn, #painelBtn, #logoutBtn {
    background: #ff4444;
    color: white;
    padding: 0.3rem 0.6rem;
    border: none;
    border-radius: 0.3rem;
    cursor: pointer;
    font-size: 0.7rem;
    max-width: 7.5rem;
}

#configBtn:hover,
#painelBtn:hover,
#logoutBtn:hover {
    background: #cc0000;
}
.esp-list {
    flex-wrap: wrap;
    justify-content: center;
}

.esp-tab.active {
    background: #001495;
    font-weight: bold;
}
.esp-tab {
    flex: 1 1 180px;
    max-width: calc(50% - 0.375rem);
    min-width: 120px;
    padding: 0.375rem 0.625rem;
    background: rgb(50 92 237 / 90%);
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    color: white;
    font-size: 0.875rem;
    white-space: nowrap;
    text-align: center;
    transition: 0.2s;
}
.esp-list, .aux-buttons, .comand-buttons {
    display: flex;
    gap: 0.375rem;
    overflow-x: auto;
    padding: 0.3125rem 0;
    scrollbar-width: none;
}

/* ===== ÁREA DE CONTEÚDO ===== */
#json-preview {
    margin-top: 0.75rem;
    background: #f9f9f9;
    padding: 0.6rem;
    border-radius: 0.4rem;
    border: 1px solid #ddd;
    font-family: monospace;
    font-size: 0.65rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.container {
    background: #f1f1f1;
    margin-top: 0.75rem;
    padding: 0.75rem;
    box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.1);
    width: 97%;
    max-width: 22.5rem;
    border-radius: 0.4rem;
}

/* ===== acc ===== */
.acc {
    width: 100%;
    max-width: 22.5rem;
    margin: 0.5rem auto;
}

.acc-title {
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.3rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    font-weight: bold;
    padding: 0.05rem 0.4rem;
    background: #646469;
    margin: 1.5px;
}

.acc-title-inside {
    padding: 0.05rem 0.4rem;
    background: #717275;
    margin: 1.5px;
}

.acc-title-footer {
    padding: 0.05rem 0.4rem;
    background: #3d3d40;
    margin: 1.5px;
}

.acc-title:hover {
    background: #aeafb5;
}

.acc-content {
    display: none;
    margin-top: 0.4rem;
    padding: 0.6rem;
    background: #fff;
    border-radius: 0.3rem;
    border: 1px solid #ddd;
    width: 100%;
    box-sizing: border-box;
}

.acc-content.active {
    display: block;
}

.acc-content label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 0.5rem;
    font-weight: bold;
    color: #333;
    width: 100%;
    font-size: 1rem;
}

.acc-content input,
.acc-content select,
.acc-content textarea {
    width: 100%;
    box-sizing: border-box;
    margin-top: 0.2rem;
}

#horarioLigar, #datas_especificas, #ipsComndos {
    overflow: scroll;
}
#horarioLigar::-webkit-scrollbar, 
#datas_especificas::-webkit-scrollbar,
#ipsComndos::-webkit-scrollbar{
    width: 1.6rem;
    height: 1.4rem;
}
#horarioLigar::-webkit-scrollbar-track, 
#datas_especificas::-webkit-scrollbar-track,
#ipsComndos::-webkit-scrollbar-track {
    background: #acacac;
}

/* ===== TEXTOS E ELEMENTOS ===== */
h2 {
    margin: 0.05rem;
    color: #001495;
}

h3 {
    margin: 0.05rem;
}

hr {
    border: none;
    height: 0.1rem;
    background-color: #ff4444;
    margin: 0.25rem 0;
}

input, select, textarea, button {
    padding: 0.4rem;
    font-size: 1rem;
    border-radius: 0.3rem;
    border: 1px solid #ccc;
}

input:focus {
    border-color: #0078d7;
    outline: none;
}

button {
    background-color: #001495;
    color: white;
    padding: 0.5rem;
    border: none;
    border-radius: 0.3rem;
    cursor: pointer;
    width: 100%;
    margin-top: 0.1rem;
    font-size: 1rem;
    font-weight: bold;
}

button:hover {
    background-color: #218838;
}

/* ===== INFO BOX ===== */
.info {
    margin-top: 0.5rem;
    background: #f9f9f9;
    padding: 0.5rem;
    border-radius: 0.3rem;
    border: 1px solid #ddd;
    word-wrap: break-word;
    font-size: 1rem;
    overflow-wrap: anywhere;
}

/* ===== FOOTER ===== */
footer {
    background: #f1f1f1;
    margin-top: 0.25rem;
    padding: 0.75rem;
    box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.1);
    width: 97%;
    max-width: 22.5rem;
    border-radius: 0.4rem;
}

/* ===== OUTROS ===== */
.hidden { display: none; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.btn-group button {
    flex: 1;
}

/* ===== AJUDA ===== */
.help-btn {
    margin-top: 0.2rem;
    border: none;
    background: #001495;
    color: white;
    border-radius: 50%;
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    line-height: 1;
}

.help-text {
    display: none;
    background: #f2f2f2;
    color: #000;
    padding: 0.3rem 0.5rem;
    border-radius: 0.3rem;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    width: 100%;
    box-sizing: border-box;
    font-weight: normal;
}

.help-text.show {
    display: block;
}

.disabled-buttons button {
    pointer-events: none;
    opacity: 0.5;
    filter: grayscale(80%);
    cursor: not-allowed;
}

.font-size-slider {
    text-align: center;
    background: #e9e9e9;
    padding: 0.8rem 1rem;
    border-radius: 0.6rem;
    margin-top: 0.5rem;
    box-shadow: 0 0.15rem 0.3rem rgba(0, 0, 0, 0.1);
}

.font-size-slider label {
    font-weight: bold;
    display: block;
    margin-bottom: 0.4rem;
    color: #001495;
}

#fontSizeSlider {
    width: 90%;
    appearance: none;
    height: 0.6rem;
    border-radius: 0.3rem;
    outline: none;
    cursor: pointer;
}

#fontSizeSlider::-webkit-slider-thumb {
    appearance: none;
    width: 1.2rem;
    height: 1.2rem;
    background: #001495;
    border-radius: 50%;
    transition: background 0.2s;
}

#fontSizeSlider::-webkit-slider-thumb:hover {
    background: #005fa3;
}

#fontSizeValue {
    display: block;
    margin-top: 0.4rem;
    font-weight: bold;
    color: #001495;
}


/* ===== Logs ===== */
.grafico-wrapper,
.grafico-mensal-wrapper {
    width: 100%;
    max-width: 28rem;
    text-align: center;
    line-height: 0.1;
}

/* === Gráficos === */
.grafico-24h,
.semana-grafico {
    position: relative;
    background: #f3f3f3;
    border-radius: 0.375rem;
    overflow: hidden;
    padding: 4px;
}

.grafico-24h {
    height: 3rem;
    background: #eee;
    margin-bottom: 0.1875rem;
    border-bottom: 1px solid red;
}

.semana-grafico {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 60px;
}

/* === Barras === */
.barra-24h,
.barra-dia,
.barra-total-semana {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.barra-24h {
    position: absolute;
    background: #4caf50;
}

.barra-dia {
    position: relative;
    width: calc((100% - 16%) / 7);
    background: #4caf50;
}

.barra-total-semana {
    position: relative;
    width: 12%;
    background: #54dfd1;
    margin-left: 4px;
}

.barra-24h:hover,
.barra-dia:hover,
.barra-total-semana:hover {
    background: #45a049;
}

/* === Escalas e Labels === */
.escala-horas,
.semana-labels {
    display: flex;
    justify-content: space-between;
    margin: 0.125rem 0;
    font-size: 0.6rem;
    color: #555;
    line-height: 1;
}

.semana-labels {
    align-items: flex-start;
    margin-top: 0.4rem;
    padding: 0 4px;
}

.semana-labels span {
    flex: 1;
    max-width: calc((100% - 16%) / 7);
    text-align: center;
    font-size: 0.7rem;
    text-decoration: underline solid 0.05rem;
    color: #001495;
}

.semana-labels .label-total {
    flex: 0 0 12%;
    font-weight: bold;
    color: #005;
}

/* === Títulos e blocos === */
.semana-bloco {
    padding-top: 0.2rem;
    background: #f3f3f3;
    border-top: 1px solid red;
}

.titulo-semana {
    color: #005;
    margin: 0.35rem 0.35rem 0.35rem 0.1rem;
    text-align: left;
    font-size: 0.7rem;
}

/* === Tooltips (24h e semanal) === */
.tooltip-area,
.tooltip-semana,
.tooltip-anual {
    margin-top: 0.25rem;
    padding: 0.5rem;
    background: rgb(243 243 243);
    color: #030000;
    border-radius: 0.3125rem;
    font-size: 0.9rem;
    display: inline-block;
    min-width: 55%;
    max-width: 90%;
    transition: opacity 0.3s ease;
}

.tooltip-area {
    background: rgb(249 249 249);
}

/* === Gráfico Anual === */
.grafico-anual-wrapper {
    width: 100%;
    max-width: 28rem;
    text-align: center;
    border-top: 1px solid red;
}

.anual-bloco {
    background: #f3f3f3;
    border-radius: 0.375rem;
    padding: 6px;
}

.ano-grafico {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 80px;
    position: relative;
    overflow: hidden;
    gap: 2px;
}

.barra-mes {
    flex: 1;
    background: #4caf50;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.barra-mes:hover {
    background: #45a049;
    transform: scale(1.05);
}

.barra-total-ano {
    flex: 0 0 8%;
    background: #007bff;
    border-radius: 0.375rem;
    margin-left: 3px;
}

.ano-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.8rem;
    font-size: 0.7rem;
    gap: 0px;
}

.ano-labels span {
    text-decoration: underline solid 0.05rem;
    white-space: nowrap;
    transform: rotate(270deg) translateY(4px);
    transform-origin: bottom;
    color: #001495;
}

.label-mes-anual {
    flex: 1;
    text-align: center;
    cursor: pointer;
    max-width: calc((100% - 8%) / 12);
}

.label-total {
    flex: 0 0 8%;
    font-weight: bold;
    color: #005;
    text-align: center;
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 28rem) { /* 450px */
    body { padding: 0.25rem; }
    
    #user-info, input, select, textarea, button, h2, h3, footer {
        font-size: 0.9rem;
    }
    
    #configBtn, #painelBtn, #logoutBtn {
        padding: 0.1rem 0.2rem;
    }
    
    #json-preview {
        padding: 0.4rem;
    }
    
    .acc-content label {
        font-size: 0.8rem;
    }
    
    .acc-title {
        padding: 0.35rem 0.4rem;
    }
    
    .acc-content {
        padding: 0.4rem;
    }
    
    input, select, textarea, button {
        padding: 0.3rem;
    }
    
    .info {
        padding: 0.15rem;
        font-size: 0.8rem;
    }
    
    .help-text {
        padding: 0.1rem 0.15rem;
    }
}
.log-item{
    padding:10px;
    border-bottom:1px solid #444;
    word-break:break-word;
}

.log-hora{
    font-weight:bold;
    color:#000000;
    margin-bottom:4px;
}

.log-msg {
    color: #200505;
    overflow-wrap: anywhere;
    white-space: normal;
    max-width: 100%;
}

.logs-download-area{
    display:flex;
    justify-content:center;
    margin-top:1rem;
    padding:.1rem;
}

.btn-download-logs{
    border:none;
    padding:.1rem .1rem;
    border-radius:.5rem;
    cursor:pointer;
    font-size:1rem;
}