/*
====================================================
Dashboard IoT
====================================================
*/

*{

    margin:0;
    padding:0;
    box-sizing:border-box;

}

body{

    background:#eef3f8;

    font-family:Arial, Helvetica, sans-serif;

}

header{

    background:#1f2937;

    color:white;

    padding:25px;

    text-align:center;

}

header h1{

    margin-bottom:10px;

}

#estado{

    font-size:18px;

    font-weight:bold;

}

.device{

    width:95%;

    max-width:1000px;

    margin:30px auto;

    background:white;

    border-radius:12px;

    padding:20px;

    box-shadow:0 8px 18px rgba(0,0,0,.10);

}

.device-header{

    display:flex;

    align-items:center;

    justify-content:space-between;

    gap:12px;

    flex-wrap:wrap;

    margin-bottom:20px;

}

.device-actions{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
}

.device-action{
    border:1px solid rgba(0,0,0,.10);
    background:#ffffff;
    border-radius:10px;
    padding:8px 10px;
    cursor:pointer;
    font-weight:bold;
    color:#1f2937;
    box-shadow:0 6px 14px rgba(0,0,0,.08);
    transition:transform .12s ease, filter .12s ease;
}

.device-action:hover{
    transform:translateY(-1px);
    filter:brightness(.98);
}

.device-mac-wrap{
    display:flex;
    gap:14px;
    align-items:center;
    flex-wrap:wrap;
}

.device-mac-wrap h2{
    margin:0;
}

.mac-selector{
    display:inline-flex;
    flex-direction:column;
    gap:4px;
    font-size:12px;
    color:#374151;
}

.mac-selector select{
    min-width:280px;
    padding:8px 10px;
    border-radius:10px;
    border:1px solid rgba(0,0,0,.12);
    background:#ffffff;
    box-shadow:0 6px 14px rgba(0,0,0,.06);
    font-size:13px;
    color:#111827;
}

.modal-link{
    display:inline-flex;
    align-items:center;
    height:32px;
    padding:0 10px;
    border-radius:10px;
    border:1px solid rgba(0,0,0,.10);
    background:white;
    color:#34495e;
    text-decoration:none;
    font-weight:bold;
    font-size:13px;
}

.modal-link:hover{
    background:#f3f4f6;
}

.stats-meta{
    margin-bottom:10px;
    padding:10px 12px;
    border:1px solid rgba(0,0,0,.08);
    background:#ffffff;
    border-radius:12px;
    box-shadow:0 6px 14px rgba(0,0,0,.08);
    font-weight:bold;
    color:#1f2937;
    display:flex;
    justify-content:space-between;
    gap:10px;
    flex-wrap:wrap;
    font-size:13px;
}

.device-header #mac{

    font-size:16px;

    font-weight:bold;

    letter-spacing:1px;

    color:#34495e;

}

.dashboard{

    width:100%;

    max-width:none;

    margin:0;

    display:grid;

    grid-template-columns:repeat(auto-fit,minmax(220px,1fr));

    gap:20px;

}

.card{

    background:white;

    border-radius:12px;

    padding:20px;

    text-align:center;

    box-shadow:0 8px 18px rgba(0,0,0,.15);

    transition:.3s;

    cursor:pointer;

}

.card:hover{

    transform:translateY(-5px);

}

.modal{

    position:fixed;

    inset:0;

    display:none;

    align-items:center;

    justify-content:center;

    padding:18px;

    z-index:999;

}

.modal.is-open{

    display:flex;

}

.modal-overlay{

    position:absolute;

    inset:0;

    background:rgba(0,0,0,.55);

}

.modal-content{

    position:relative;

    width:min(900px, 100%);

    background:white;

    border-radius:14px;

    box-shadow:0 10px 30px rgba(0,0,0,.25);

    overflow:hidden;

}

.modal-header{

    display:flex;

    align-items:center;

    justify-content:space-between;

    gap:12px;

    padding:14px 16px;

    border-bottom:1px solid rgba(0,0,0,.08);

    background:#f7fafc;

}

.modal-header h3{

    font-size:18px;

    font-weight:bold;

    color:#1f2937;

}

.modal-actions{
    display:flex;
    align-items:center;
    gap:6px;
}

.modal-settings-btn{
    border:1px solid rgba(0,0,0,.10);
    background:white;
    border-radius:10px;
    width:38px;
    height:32px;
    cursor:pointer;
    color:#34495e;
    font-size:18px;
    line-height:1;
}

.modal-settings-btn:hover{
    background:#f3f4f6;
}

.modal-close{

    border:none;

    background:transparent;

    font-size:26px;

    line-height:1;

    cursor:pointer;

    color:#34495e;

    padding:2px 8px;

}

.modal-settings{
    display:none;
    margin-bottom:12px;
    background:#f7fafc;
    border:1px solid rgba(0,0,0,.08);
    border-radius:12px;
    padding:12px;
}

.modal-settings.is-open{
    display:block;
}

.modal-settings-grid{
    display:grid;
    grid-template-columns:repeat(3, minmax(0, 1fr));
    gap:10px;
    align-items:end;
}

.modal-settings-field{
    display:flex;
    flex-direction:column;
    gap:6px;
    font-size:13px;
    color:#374151;
}

.modal-settings-field span{
    font-weight:bold;
}

.modal-settings-field select,
.modal-settings-field input{
    border:1px solid rgba(0,0,0,.12);
    border-radius:10px;
    padding:8px 10px;
    background:white;
    font-size:13px;
}

.modal-settings-field.is-hidden{
    display:none;
}

.card.is-hidden{
    display:none;
}

.modal-settings-cta{
    display:flex;
    justify-content:flex-end;
}

.modal-settings-apply{
    border:1px solid rgba(25,118,210,.35);
    background:linear-gradient(180deg, #1b7fe5, #1976d2);
    color:white;
    border-radius:10px;
    padding:10px 14px;
    font-weight:bold;
    cursor:pointer;
    box-shadow:0 8px 18px rgba(25,118,210,.25);
    transition:transform .12s ease, box-shadow .12s ease, filter .12s ease;
    font-size:14px;
}

.modal-settings-apply:hover{
    filter:brightness(.98);
    transform:translateY(-1px);
    box-shadow:0 10px 22px rgba(25,118,210,.30);
}

.modal-settings-apply:active{
    transform:translateY(0);
    box-shadow:0 6px 14px rgba(25,118,210,.22);
}

.modal-tabs{

    display:none;

    gap:10px;

    padding:12px 16px 0 16px;

    flex-wrap:wrap;

}

.modal-tabs.is-visible{

    display:flex;

}

.modal-tab{

    border:1px solid rgba(25,118,210,.35);

    background:rgba(25,118,210,.08);

    color:#1976d2;

    padding:8px 10px;

    border-radius:999px;

    font-weight:bold;

    cursor:pointer;

    font-size:13px;

}

.modal-tab.is-active{

    background:#1976d2;

    color:white;

    border-color:#1976d2;

}

.modal-body{

    padding:14px 16px 16px 16px;

}

.modal-chart-card{
    background:#ffffff;
    border:1px solid rgba(0,0,0,.08);
    border-radius:12px;
    box-shadow:0 8px 18px rgba(0,0,0,.10);
    padding:10px 10px 6px 10px;
    height:min(260px, 45vh);
    position:relative;
}

#modalCanvas{

    width:100%;

    height:100%;

    display:block;

}

.modal-empty{

    display:none;
    position:absolute;
    inset:0;

    padding:18px 10px;

    text-align:center;

    font-weight:bold;

    color:#6b7280;

    background:rgba(255,255,255,.88);
    backdrop-filter:blur(2px);
    align-items:center;
    justify-content:center;
}

.modal-empty.is-visible{

    display:flex;

}

.modal-list{
    margin-top:12px;
    border-top:1px solid rgba(0,0,0,.08);
    padding-top:10px;
    max-height:230px;
    overflow:auto;
}

.modal-list table{
    width:100%;
    border-collapse:collapse;
    font-size:13px;
}

.modal-list th,
.modal-list td{
    text-align:left;
    padding:8px 10px;
    border-bottom:1px solid rgba(0,0,0,.06);
}

.modal-list th{
    position:sticky;
    top:0;
    background:#ffffff;
    font-weight:bold;
    color:#374151;
    z-index:1;
}

.modal-list td:last-child{
    text-align:right;
    font-variant-numeric:tabular-nums;
}

.modal-list tr.is-latest td{
    background:rgba(25,118,210,.06);
    font-weight:bold;
}

.card h2{

    margin-bottom:20px;

    color:#34495e;

}

.valor{

    font-size:48px;

    font-weight:bold;

    color:#1976d2;

}

.valor small{

    font-size:22px;

}

.valor-doble{

    display:flex;

    flex-direction:column;

    gap:10px;

}

.valor-doble .linea{

    font-size:38px;

    font-weight:bold;

    color:#1976d2;

}

.valor-doble .linea small{

    font-size:18px;

}

#fecha,
#hora{

    font-size:28px;

    font-weight:bold;

    color:#2c3e50;

}

footer{

    margin-top:30px;

    padding:20px;

    text-align:center;

    color:#555;

}
