/* ==========================================================
   REDAV DASHBOARD - CSS
   ========================================================== */

:root{
    --rd-bg:#f4f7fb;
    --rd-white:#ffffff;
    --rd-dark:#182232;
    --rd-dark-2:#263242;
    --rd-text:#394455;
    --rd-muted:#8a95a7;
    --rd-line:#e3e9f2;
    --rd-primary:#15c8bd;
    --rd-primary-2:#0ea7da;
    --rd-purple:#6477c5;
    --rd-orange:#ffae31;
    --rd-green:#36c27e;
    --rd-danger:#ff375f;
    --rd-blue:#006cff;
    --rd-shadow:0 18px 45px rgba(24,34,50,.08);
    --rd-radius:18px;
    --rd-sidebar:276px;
    --rd-rightbar:48px;
}

*{
    box-sizing:border-box;
    margin:0;
    padding:0;
}

body{
    font-family:'Inter',Arial,sans-serif;
    background:linear-gradient(135deg,#f8fbff 0%,#eef3f9 100%);
    color:var(--rd-text);
    overflow-x:hidden;
}

button,
input{
    font-family:inherit;
}

button{
    cursor:pointer;
    border:0;
    background:none;
}

.rd-layout{
    min-height:100vh;
    display:flex;
}

/* SIDEBAR */
.rd-sidebar{
    width:var(--rd-sidebar);
    min-width:var(--rd-sidebar);
    background:rgba(255,255,255,.93);
    backdrop-filter:blur(18px);
    border-right:1px solid var(--rd-line);
    box-shadow:8px 0 25px rgba(24,34,50,.08);
    position:fixed;
    left:0;
    top:0;
    bottom:0;
    z-index:20;
    padding:18px 20px 30px;
    overflow-y:auto;
    transition:transform .35s ease,width .35s ease;
}

.rd-profile{
    display:flex;
    align-items:center;
    gap:12px;
    padding-bottom:18px;
    border-bottom:1px solid var(--rd-line);
}

.rd-avatar{
    width:50px;
    height:50px;
    border-radius:50%;
    background:linear-gradient(135deg,var(--rd-primary),var(--rd-purple));
    color:white;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:22px;
    box-shadow:0 12px 24px rgba(21,200,189,.25);
    animation:floatAvatar 4s ease-in-out infinite;
}

@keyframes floatAvatar{
    0%,100%{transform:translateY(0)}
    50%{transform:translateY(-5px)}
}

.rd-profile span{
    display:block;
    font-size:13px;
    color:var(--rd-muted);
}

.rd-profile strong{
    display:block;
    font-size:14px;
    color:var(--rd-dark);
}

.rd-profile-arrow{
    margin-left:auto;
    font-size:11px;
    color:var(--rd-muted);
}

.rd-mini-stats{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:8px;
    padding:18px 0;
}

.rd-mini-stats small{
    font-size:11px;
    color:var(--rd-muted);
}

.rd-mini-stats strong{
    display:block;
    margin-top:2px;
    font-weight:500;
    color:var(--rd-dark);
}

.rd-menu-tabs{
    height:38px;
    display:grid;
    grid-template-columns:1.5fr 1fr 1fr 1fr;
    align-items:center;
    background:var(--rd-dark-2);
    border-radius:22px;
    padding:3px;
    margin-bottom:18px;
}

.rd-menu-tabs button{
    height:32px;
    border-radius:18px;
    color:#97a2b5;
    transition:.25s ease;
}

.rd-menu-tabs button.active{
    color:var(--rd-primary);
    background:rgba(255,255,255,.08);
}

.rd-menu-tabs button span{
    margin-left:7px;
}

.rd-menu{
    display:flex;
    flex-direction:column;
    gap:5px;
}

.rd-menu-item{
    border-radius:16px;
    transition:.25s ease;
}

.rd-menu-item.open{
    border:1px solid rgba(21,200,189,.6);
    background:linear-gradient(180deg,rgba(21,200,189,.08),rgba(100,119,197,.03));
    padding:3px 0 10px;
    box-shadow:0 12px 30px rgba(21,200,189,.08);
}

.rd-menu-link{
    width:100%;
    min-height:48px;
    padding:0 16px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    color:#485365;
    font-size:15px;
    border-radius:14px;
    transition:.25s ease;
}

.rd-menu-link span{
    display:flex;
    align-items:center;
    gap:14px;
}

.rd-menu-link i:first-child{
    width:18px;
    text-align:center;
}

.rd-menu-link:hover,
.rd-menu-item.open>.rd-menu-link{
    color:var(--rd-primary);
    transform:translateX(3px);
}

.rd-caret{
    font-size:10px;
    transition:transform .28s ease;
}

.rd-menu-item.open .rd-caret{
    transform:rotate(90deg);
}

.rd-submenu{
    max-height:0;
    overflow:hidden;
    opacity:0;
    transform:translateY(-8px);
    transition:max-height .42s ease,opacity .3s ease,transform .3s ease;
}

.rd-menu-item.open .rd-submenu{
    max-height:430px;
    opacity:1;
    transform:translateY(0);
}

.rd-submenu a{
    display:block;
    padding:7px 20px 7px 48px;
    text-decoration:none;
    color:#606a7d;
    font-size:14px;
    transition:.22s ease;
}

.rd-submenu a:hover,
.rd-submenu a.selected{
    color:var(--rd-dark);
    font-weight:700;
    transform:translateX(4px);
}

/* RIGHT BAR */
.rd-rightbar{
    position:fixed;
    right:0;
    top:0;
    bottom:0;
    width:var(--rd-rightbar);
    background:#fff;
    border-left:1px solid var(--rd-line);
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:25px;
    padding-top:26px;
    color:#2d3746;
    z-index:19;
}

.rd-rightbar i{
    font-size:14px;
    transition:.25s ease;
}

.rd-rightbar i:hover{
    color:var(--rd-primary);
    transform:scale(1.18);
}

/* MAIN */
.rd-main{
    flex:1;
    margin-left:var(--rd-sidebar);
    margin-right:var(--rd-rightbar);
    padding:22px 28px 36px;
    transition:margin .35s ease;
}

.rd-topbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:28px;
}

.rd-brand-area{
    display:flex;
    align-items:center;
    gap:10px;
}

.rd-sidebar-toggle{
    color:#6f7888;
    font-size:20px;
}

.rd-logo{
    font-size:23px;
    color:var(--rd-dark);
    font-weight:400;
}

.rd-logo span{
    font-weight:900;
    background:linear-gradient(135deg,var(--rd-primary),var(--rd-primary-2));
    -webkit-background-clip:text;
    color:transparent;
}

.rd-top-actions{
    display:flex;
    align-items:center;
    gap:12px;
}

.rd-search{
    width:290px;
    height:38px;
    display:flex;
    align-items:center;
    gap:10px;
    padding:0 14px;
    border:1px solid transparent;
    background:rgba(255,255,255,.75);
    border-radius:20px;
    transition:.25s ease;
}

.rd-search:focus-within{
    border-color:rgba(21,200,189,.55);
    box-shadow:0 0 0 4px rgba(21,200,189,.12);
}

.rd-search input{
    flex:1;
    border:0;
    outline:0;
    background:transparent;
    color:var(--rd-text);
}

.rd-top-actions button{
    color:#303b4c;
    font-size:16px;
    width:36px;
    height:36px;
    border-radius:50%;
    transition:.25s ease;
}

.rd-top-actions button:hover{
    background:#fff;
    color:var(--rd-primary);
    box-shadow:var(--rd-shadow);
}

.rd-page-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:24px;
}

.rd-page-header h1{
    font-size:20px;
    color:var(--rd-primary);
    font-weight:500;
    margin-bottom:9px;
}

.rd-page-header p{
    color:var(--rd-muted);
    font-size:13px;
}

.rd-page-buttons{
    display:flex;
    gap:8px;
}

.rd-btn{
    height:36px;
    padding:0 16px;
    color:#fff;
    border-radius:6px;
    font-weight:600;
    transition:.25s ease;
}

.rd-btn.primary{
    background:linear-gradient(135deg,var(--rd-primary),#41d7c8);
}

.rd-btn.secondary{
    background:linear-gradient(135deg,var(--rd-purple),#5367b3);
}

.rd-btn:hover{
    transform:translateY(-2px);
    box-shadow:0 12px 24px rgba(24,34,50,.16);
}

/* CARDS / GRIDS */
.rd-grid{
    display:grid;
    gap:28px;
    margin-bottom:28px;
}

.rd-grid-kpi{
    grid-template-columns:1fr 1fr 1fr 1fr;
}

.rd-grid-middle{
    grid-template-columns:1.7fr 1.35fr 1fr;
}

.rd-grid-lists{
    grid-template-columns:repeat(3,1fr);
}

.rd-card{
    background:rgba(255,255,255,.86);
    border:1px dashed #d7e0ec;
    border-radius:var(--rd-radius);
    padding:22px;
    box-shadow:0 10px 25px rgba(24,34,50,.03);
    transition:.28s ease;
    position:relative;
    overflow:hidden;
}

.rd-card::before{
    content:"";
    position:absolute;
    inset:0;
    background:radial-gradient(circle at top right,rgba(21,200,189,.12),transparent 34%);
    opacity:0;
    transition:.3s ease;
    pointer-events:none;
}

.rd-card:hover{
    transform:translateY(-5px);
    box-shadow:var(--rd-shadow);
    border-color:rgba(21,200,189,.4);
}

.rd-card:hover::before{
    opacity:1;
}

.rd-kpi-card{
    min-height:196px;
}

.rd-kpi-card span{
    font-size:13px;
    color:#3f4a5c;
}

.rd-kpi-card h2{
    color:#303b4c;
    font-size:24px;
    margin:12px 0 4px;
    font-weight:500;
}

.rd-kpi-card small{
    font-size:13px;
}

.rd-kpi-card p{
    color:var(--rd-muted);
    font-size:11px;
}

/* MINI CHARTS */
.mini-chart{
    height:95px;
    position:absolute;
    left:0;
    right:0;
    bottom:0;
    display:flex;
    align-items:flex-end;
    gap:0;
    padding:0;
}

.mini-chart i{
    flex:1;
    clip-path:polygon(0 100%,100% 100%,100% 0,0 45%);
    animation:growChart .9s ease forwards;
    transform-origin:bottom;
}

@keyframes growChart{
    from{transform:scaleY(0)}
    to{transform:scaleY(1)}
}

.mini-chart.teal i{
    background:linear-gradient(180deg,rgba(21,200,189,.88),rgba(21,200,189,.52));
}

.mini-chart.orange i{
    background:linear-gradient(180deg,rgba(255,174,49,.9),rgba(255,174,49,.55));
}

.mini-chart.green i{
    background:linear-gradient(180deg,rgba(54,194,126,.84),rgba(54,194,126,.52));
}

/* SECURITY */
.rd-security-card{
    padding:0;
    min-height:196px;
}

.rd-security-row{
    height:50%;
    min-height:98px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:22px;
    border-bottom:1px solid var(--rd-line);
}

.rd-security-row:last-child{
    border-bottom:0;
}

.rd-security-row h3{
    font-size:15px;
    font-weight:400;
    margin-bottom:5px;
}

.rd-security-row span{
    font-size:11px;
}

.outline{
    height:36px;
    padding:0 14px;
    border-radius:6px;
    background:#fff;
    font-size:13px;
    transition:.25s ease;
}

.outline.danger{
    border:1px solid var(--rd-danger);
    color:var(--rd-danger);
}

.outline.success{
    border:1px solid var(--rd-green);
    color:var(--rd-green);
}

.outline:hover{
    transform:scale(1.05);
}

/* MIDDLE */
.rd-card-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:24px;
}

.rd-card-header h3{
    font-size:16px;
    font-weight:500;
    color:#06101f;
}

.rd-card-header i{
    color:#9aa4b5;
    font-size:11px;
}

.rd-chart-card{
    min-height:313px;
}

.bar-chart{
    height:190px;
    display:grid;
    grid-template-columns:repeat(12,1fr);
    align-items:end;
    gap:10px;
    padding:22px 0 0;
    border-bottom:1px solid #dfe6ee;
}

.bar-month{
    height:100%;
    display:flex;
    flex-direction:column;
    justify-content:flex-end;
    align-items:center;
    gap:8px;
}

.bars{
    height:150px;
    width:100%;
    display:flex;
    justify-content:center;
    align-items:flex-end;
    gap:3px;
}

.bars i{
    width:6px;
    min-height:2px;
    display:block;
    animation:barGrow .9s ease forwards;
    transform-origin:bottom;
}

@keyframes barGrow{
    from{transform:scaleY(0)}
    to{transform:scaleY(1)}
}

.bar-month small{
    font-size:10px;
    color:#8390a4;
}

.b-electricity{
    background:#61cec7;
}

.b-water{
    background:#2cb5b7;
}

.b-gas{
    background:#247fba;
}

.rd-legend{
    display:flex;
    justify-content:center;
    gap:13px;
    margin-top:12px;
    font-size:13px;
}

.rd-legend span{
    display:flex;
    align-items:center;
    gap:6px;
}

.rd-legend i{
    width:9px;
    height:9px;
    display:inline-block;
}

.rd-devices-card{
    display:flex;
    flex-direction:column;
    justify-content:space-around;
    gap:22px;
}

.device-row{
    display:grid;
    grid-template-columns:48px 1fr auto;
    align-items:start;
    gap:12px;
}

.device-row>i{
    font-size:28px;
    color:#777;
    width:38px;
    text-align:center;
}

.device-row h3{
    font-size:15px;
    font-weight:500;
    margin-bottom:10px;
}

.device-row p{
    font-size:13px;
    margin-bottom:8px;
}

.device-status{
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    gap:9px;
    font-size:13px;
}

.success{
    color:#14a54a;
}

.danger{
    color:var(--rd-danger);
}

.orange-text{
    color:var(--rd-orange);
}

.blue-text{
    color:var(--rd-blue);
}

/* DONUT */
.rd-donut-card{
    min-height:313px;
}

.donut{
    width:164px;
    height:164px;
    border-radius:50%;
    margin:30px auto 18px;
    background:conic-gradient(#59c9c4 0 65%,#6477b8 65% 100%);
    position:relative;
    animation:rotateIn .9s ease;
}

@keyframes rotateIn{
    from{transform:rotate(-70deg) scale(.85);opacity:.3}
    to{transform:rotate(0) scale(1);opacity:1}
}

.donut-inner{
    width:98px;
    height:98px;
    background:#fff;
    border-radius:50%;
    position:absolute;
    left:50%;
    top:50%;
    transform:translate(-50%,-50%);
    box-shadow:inset 0 0 0 1px #eef2f7;
}

.donut-label{
    position:absolute;
    color:#fff;
    font-size:12px;
    font-weight:700;
}

.label-night{
    right:24px;
    top:78px;
}

.label-day{
    left:27px;
    top:57px;
}

.night{
    background:#59c9c4;
}

.day{
    background:#6477b8;
}

/* SWITCH LISTS */
.rd-list-card{
    padding:22px;
}

.rd-switch-list{
    border:1px solid #e1e5ec;
    border-radius:6px;
    overflow:hidden;
}

.rd-switch-list>div{
    min-height:48px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 20px;
    border-bottom:1px solid #e1e5ec;
    background:#fff;
    transition:.22s ease;
}

.rd-switch-list>div:hover{
    background:#f9fcff;
    padding-left:24px;
}

.rd-switch-list>div:last-child{
    border-bottom:0;
}

.rd-switch-list span{
    font-size:15px;
}

.rd-switch-list em{
    color:var(--rd-danger);
    font-style:normal;
    font-size:13px;
}

.switch{
    width:51px;
    height:24px;
    display:inline-block;
    position:relative;
}

.switch input{
    display:none;
}

.switch b{
    position:absolute;
    inset:0;
    border:1px solid #d9dee6;
    border-radius:4px;
    background:#fff;
    transition:.25s ease;
}

.switch b::before{
    content:"";
    position:absolute;
    width:18px;
    height:18px;
    top:2px;
    left:3px;
    border-radius:4px;
    background:#dcdfe4;
    transition:.25s ease;
}

.switch input:checked+b{
    border-color:var(--rd-primary);
}

.switch input:checked+b::before{
    transform:translateX(25px);
    background:var(--rd-primary);
}

/* REVEAL ANIMATION */
.reveal{
    opacity:0;
    transform:translateY(20px);
    transition:opacity .65s ease, transform .65s ease;
}

.reveal.visible{
    opacity:1;
    transform:translateY(0);
}

/* COLLAPSED SIDEBAR */
body.sidebar-collapsed .rd-sidebar{
    transform:translateX(-100%);
}

body.sidebar-collapsed .rd-main{
    margin-left:0;
}

/* RESPONSIVE */
@media (max-width:1400px){
    .rd-grid-kpi{
        grid-template-columns:repeat(2,1fr);
    }

    .rd-grid-middle{
        grid-template-columns:1fr 1fr;
    }

    .rd-donut-card{
        grid-column:span 2;
    }

    .rd-grid-lists{
        grid-template-columns:1fr;
    }
}

@media (max-width:900px){
    :root{
        --rd-rightbar:0px;
    }

    .rd-sidebar{
        transform:translateX(-100%);
    }

    body.sidebar-mobile-open .rd-sidebar{
        transform:translateX(0);
    }

    .rd-main{
        margin-left:0;
        margin-right:0;
        padding:18px;
    }

    .rd-rightbar{
        display:none;
    }

    .rd-topbar,
    .rd-page-header{
        align-items:flex-start;
        flex-direction:column;
        gap:16px;
    }

    .rd-search{
        width:100%;
    }

    .rd-top-actions{
        width:100%;
    }

    .rd-grid-kpi,
    .rd-grid-middle,
    .rd-grid-lists{
        grid-template-columns:1fr;
    }

    .rd-donut-card{
        grid-column:auto;
    }

    .rd-page-buttons{
        flex-wrap:wrap;
    }
}

@media (max-width:520px){
    .rd-mini-stats{
        grid-template-columns:1fr;
    }

    .bar-chart{
        gap:4px;
    }

    .bars i{
        width:4px;
    }

    .device-row{
        grid-template-columns:36px 1fr;
    }

    .device-status{
        grid-column:2;
        align-items:flex-start;
    }
}
