/*
 * Integração OmniMax sobre a estrutura visual original Max Rebrands.
 * O template principal permanece em max-rebrands-panel.css.
 */

#sidebar-wrapper.max-sidebar{
    position:sticky;
    top:0;
    height:100vh;
    display:flex;
    flex-direction:column;
}
#sidebar-wrapper .max-menu{
    flex:1 1 auto;
    overflow-y:auto;
    overflow-x:hidden;
    padding-bottom:18px;
}
.sidebar-footer-card{
    position:relative;
    left:auto;
    right:auto;
    bottom:auto;
    flex:0 0 auto;
    margin:8px 15px 16px;
}
.max-sidebar-overlay{display:none;}
.max-flash-alert{
    display:flex;
    align-items:center;
    gap:10px;
    margin:0 0 20px!important;
    padding:14px 16px!important;
}

/* Componentes funcionais do painel novo dentro do template original. */
.panel-card{
    margin-bottom:22px;
    color:var(--max-text)!important;
    background:linear-gradient(180deg,var(--max-card),rgba(10,10,14,.94))!important;
    border:1px solid var(--max-line-red)!important;
    border-radius:24px!important;
    box-shadow:var(--max-shadow)!important;
    overflow:hidden;
}
.panel-card-head{
    display:flex;
    align-items:center;
    gap:14px;
    padding:18px 20px;
    background:linear-gradient(135deg,rgba(255,27,45,.32),rgba(255,255,255,.06)),linear-gradient(135deg,#171820,#09090d)!important;
    border-bottom:1px solid var(--max-line-red)!important;
}
.panel-card-head h2{
    margin:0!important;
    font-family:'Orbitron',sans-serif!important;
    font-size:1.05rem!important;
    font-weight:800!important;
    letter-spacing:.025em;
    color:#fff!important;
}
.panel-card-head p{margin:5px 0 0;color:var(--max-muted);font-size:.9rem;line-height:1.45;}
.panel-card-icon{
    display:flex;
    align-items:center;
    justify-content:center;
    flex:0 0 46px;
    width:46px;
    height:46px;
    border-radius:15px;
    background:linear-gradient(135deg,var(--max-red),var(--max-red-2));
    box-shadow:0 10px 24px rgba(255,27,45,.22);
}
.panel-card-body{padding:20px;}

.form-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:17px;
    padding:20px;
}
.form-field{display:grid;gap:7px;min-width:0;}
.form-field.field-wide{grid-column:1/-1;}
.form-field label{margin:0;color:#f3f4fb!important;font-weight:800;}
.form-field small{color:var(--max-muted);line-height:1.4;}
.form-field input,.form-field select,.form-field textarea,.search-input{
    width:100%;
    min-height:47px;
    padding:11px 13px;
    color:#fff!important;
    background:rgba(4,4,8,.72)!important;
    border:1px solid rgba(255,255,255,.12)!important;
    border-radius:14px!important;
    outline:none;
}
.form-field textarea{resize:vertical;}
.form-field input:focus,.form-field select:focus,.form-field textarea:focus,.search-input:focus{
    border-color:var(--max-red)!important;
    box-shadow:0 0 0 .2rem rgba(255,27,45,.18)!important;
}
.form-actions{
    position:sticky;
    bottom:12px;
    z-index:10;
    display:flex;
    justify-content:flex-end;
    flex-wrap:wrap;
    gap:10px;
    margin:0 0 24px;
    padding:14px;
    border-radius:18px;
    background:rgba(8,8,12,.90);
    border:1px solid var(--max-line);
    backdrop-filter:blur(14px);
}
.button{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    min-height:43px;
    padding:10px 15px;
    border-radius:14px;
    border:1px solid rgba(255,255,255,.10);
    color:#fff!important;
    background:#242630;
    font-weight:800;
    text-decoration:none!important;
    transition:.18s ease;
}
.button:hover{transform:translateY(-1px);}
.button.primary,.button.success{background:linear-gradient(135deg,var(--max-red),var(--max-red-2));border-color:rgba(255,27,45,.55);box-shadow:0 12px 24px rgba(255,27,45,.18);}
.button.danger{background:linear-gradient(135deg,#3b1114,#d31022);border-color:rgba(255,27,45,.52);}
.button.ghost{background:rgba(255,255,255,.08);}

.stats-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin-bottom:22px;}
.stat-card{
    padding:18px;
    border-radius:22px;
    background:linear-gradient(180deg,var(--max-card),rgba(8,8,12,.95));
    border:1px solid var(--max-line);
    box-shadow:var(--max-shadow);
}
.stat-card .stat-icon{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border-radius:14px;margin-bottom:15px;background:linear-gradient(135deg,var(--max-red),var(--max-red-2));}
.stat-card span{display:block;color:var(--max-muted);font-size:.84rem;}.stat-card strong{display:block;margin-top:4px;font:800 1.8rem 'Orbitron',sans-serif;}
.dashboard-grid{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(300px,.7fr);gap:20px;}
.quick-links{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:20px;}
.quick-link{display:flex;align-items:center;gap:12px;padding:14px;border-radius:16px;background:rgba(255,255,255,.045);border:1px solid var(--max-line);color:#fff!important;font-weight:800;}
.quick-link i{color:#ff5360;}.quick-link:hover{border-color:var(--max-line-red);background:rgba(255,27,45,.1);}

.table-wrap{overflow:auto;padding:0 20px 20px;}
.data-table{width:100%;border-collapse:separate;border-spacing:0 8px;min-width:800px;color:#ecedf5;}
.data-table th{padding:14px;text-align:left;border:0;color:#fff;background:linear-gradient(135deg,rgba(255,27,45,.30),rgba(255,255,255,.045));font-weight:800;text-transform:uppercase;font-size:.78rem;letter-spacing:.08em;}
.data-table td{padding:13px 14px;vertical-align:middle;background:rgba(255,255,255,.045);border-top:1px solid rgba(255,255,255,.055);border-bottom:1px solid rgba(255,255,255,.035);color:#dfe2eb;}
.data-table tbody tr:hover td{background:rgba(255,27,45,.11);}.data-table code,.code-box code{color:#9be8f3;word-break:break-all;}
.table-actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px;}.table-actions form{margin:0;}

.badge{display:inline-flex;align-items:center;gap:6px;padding:5px 9px;border-radius:999px;border:1px solid var(--max-line);font-size:.76rem;font-weight:800;}
.badge.online,.badge.active{color:#8ff1b9;border-color:rgba(39,219,131,.4);background:rgba(39,219,131,.1);}
.badge.offline,.badge.inactive{color:#ffafb7;border-color:rgba(255,62,76,.4);background:rgba(255,62,76,.1);}
.badge.pending{color:#ffe194;border-color:rgba(255,204,77,.4);background:rgba(255,204,77,.1);}
.muted{color:var(--max-muted)!important;}
.empty-state{padding:34px;text-align:center;color:var(--max-muted);}.empty-state i{display:block;margin-bottom:12px;font-size:2rem;color:#ff5360;}

.code-list{display:grid;gap:12px;padding:20px;}.code-box{padding:14px;border-radius:16px;background:rgba(0,0,0,.25);border:1px solid var(--max-line);}.code-box strong{display:block;margin-bottom:6px;color:#fff;}.code-box p{margin:8px 0 0;}
.split-grid{display:grid;grid-template-columns:minmax(320px,.75fr) minmax(0,1.25fr);gap:20px;}

@media(max-width:1180px){.stats-grid{grid-template-columns:repeat(2,1fr);}.dashboard-grid,.split-grid{grid-template-columns:1fr;}}
@media(max-width:767px){
    #sidebar-wrapper.max-sidebar{position:fixed;left:0;top:0;bottom:0;height:100vh;z-index:20010;margin-left:-18rem;}
    #wrapper.toggled #sidebar-wrapper.max-sidebar{margin-left:0;}
    .max-sidebar-overlay{position:fixed;inset:0;z-index:20000;background:rgba(0,0,0,.70);backdrop-filter:blur(2px);}
    .max-sidebar-overlay.show{display:block;}
    body.max-menu-open{overflow:hidden;}
    #page-content-wrapper.max-content{min-width:100vw;width:100%;}
}
@media(max-width:680px){
    .panel-card-head{align-items:flex-start;padding:16px;}.panel-card-head h2{font-size:.96rem!important;}.panel-card-head p{font-size:.82rem;}
    .panel-card-icon{width:42px;height:42px;flex-basis:42px;border-radius:14px;}
    .form-grid,.stats-grid,.quick-links{grid-template-columns:1fr;}.form-grid{padding:16px;}.form-actions{position:static;}
    .table-wrap{padding:0 12px 14px;}.data-table{min-width:720px;}.panel-card-body{padding:16px;}
}
@media(max-height:760px){.sidebar-brand-block{padding-top:14px;padding-bottom:12px;}.brand-orbit{width:76px;height:76px;}.sidebar-logo{width:68px;height:68px;}.max-menu .list-group-item{margin:3px 0;padding:9px 12px;}.max-menu .list-group-item i{width:31px;height:31px;}.sidebar-footer-card{display:none;}}

.max-card-title{display:flex;align-items:center;gap:14px;}
.max-card-title-icon{display:flex;align-items:center;justify-content:center;flex:0 0 46px;width:46px;height:46px;border-radius:15px;background:linear-gradient(135deg,var(--max-red),var(--max-red-2));box-shadow:0 10px 24px rgba(255,27,45,.22);}
.max-card-title h2{font-size:1.05rem!important;}.max-card-title p{margin:5px 0 0;color:var(--max-muted);font-size:.9rem;line-height:1.4;}
.omnimax-config-card .form-group{margin-bottom:18px;}.omnimax-config-card .text-muted{color:var(--max-muted)!important;line-height:1.4;}
@media(max-width:575px){.max-card-title{align-items:flex-start;}.max-card-title-icon{width:42px;height:42px;flex-basis:42px;}.max-card-title h2{font-size:.95rem!important;}.max-card-title p{font-size:.8rem;}}

.dashboard-stat-card .card-body{padding:18px!important;}.dashboard-stat-icon{display:flex;align-items:center;justify-content:center;width:46px;height:46px;border-radius:15px;margin-bottom:15px;background:linear-gradient(135deg,var(--max-red),var(--max-red-2));box-shadow:0 12px 26px rgba(255,27,45,.22);}.dashboard-stat-card span{display:block;color:var(--max-muted);font-size:.86rem;}.dashboard-stat-card strong{display:block;margin-top:5px;font:800 1.85rem 'Orbitron',sans-serif;color:#fff;}.dashboard-table-wrap{margin:0!important;border:0!important;border-radius:0!important;padding:12px 16px 16px!important;background:transparent!important;}.dashboard-table-wrap code{color:#9be8f3;word-break:break-all;}.max-quick-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}.max-quick-link{display:flex;align-items:center;gap:10px;padding:14px;border-radius:16px;background:rgba(255,255,255,.045);border:1px solid var(--max-line);color:#fff!important;font-weight:800;}.max-quick-link i{color:#ff5360;}.max-quick-link:hover{border-color:var(--max-line-red);background:rgba(255,27,45,.1);}.dashboard-status-box{margin-top:18px;padding:16px;border-radius:18px;background:rgba(0,0,0,.24);border:1px solid var(--max-line);}.dashboard-status-box p{margin-bottom:12px;}@media(max-width:575px){.max-quick-grid{grid-template-columns:1fr;}.dashboard-table-wrap{padding:8px!important;}}

/* Correção mobile V3: o overlay deve escurecer somente o conteúdo,
   permanecendo atrás do menu lateral aberto. */
#wrapper{z-index:auto!important;}
@media(max-width:767px){
    #sidebar-wrapper.max-sidebar{
        z-index:30010!important;
        visibility:visible;
        opacity:1;
        filter:none!important;
        -webkit-filter:none!important;
    }
    .max-sidebar-overlay{
        display:block;
        z-index:30000!important;
        background:rgba(0,0,0,.46)!important;
        backdrop-filter:none!important;
        -webkit-backdrop-filter:none!important;
        opacity:0;
        visibility:hidden;
        pointer-events:none;
        transition:opacity .22s ease, visibility .22s ease;
    }
    .max-sidebar-overlay.show{
        opacity:1;
        visibility:visible;
        pointer-events:auto;
    }
}
