/* v2/css/app-shell.css */

/* Layout Principal */
#app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar V2 */
.sidebar-v2 {
    width: 280px;
    background: #004696; /* Azul Institucional do Modelo de Gestão */
    margin: 20px 0 20px 20px;
    border-radius: var(--radius-lg, 24px);
    box-shadow: var(--shadow-soft, 0 10px 40px -10px rgba(0, 70, 150, 0.15));
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    color: white;
}

.sidebar-v2.collapsed {
    width: 80px;
}

.sidebar-brand {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    height: auto;
    min-height: 80px;
    flex-shrink: 0;
}

.sidebar-brand img {
    height: 36px;
    margin-bottom: 5px;
    filter: brightness(0) invert(1); /* Deixa a logo branca se for a escura */
}

.sidebar-brand .brand-full {
    font-weight: 800;
    font-size: 16px;
    color: white;
}

.sidebar-brand .brand-sub {
    font-size: 10px;
    opacity: 0.6;
    font-weight: 400;
    line-height: 1.2;
}

.sidebar-v2.collapsed .sidebar-brand { align-items: center; }
.sidebar-v2.collapsed .brand-full,
.sidebar-v2.collapsed .brand-sub { display: none; }
.sidebar-v2:not(.collapsed) .brand-mini { display: none; }

.nav-groups-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.nav-groups-container::-webkit-scrollbar { width: 4px; }
.nav-groups-container::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.1); border-radius: 10px; }

/* Grupos de Menu */
.nav-group {
    margin-bottom: 15px;
}

.nav-group-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: white;
    opacity: 0.4;
    margin-bottom: 8px;
    padding-left: 15px;
    font-weight: 800;
    transition: all 0.2s ease;
}

.nav-group-title:hover {
    opacity: 0.8;
    color: var(--abaete-yellow, #FFEE9D);
}

.group-arrow-icon {
    margin-right: 15px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.nav-group.group-collapsed .group-arrow-icon {
    transform: rotate(-90deg);
}

.nav-group-items-wrapper {
    transition: max-height 0.3s ease-out;
}

.sidebar-v2.collapsed .nav-group-title {
    display: none !important;
}

.nav-item-v2 {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
    margin-bottom: 2px;
}

.nav-item-v2:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.nav-item-v2.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 700;
}

.nav-item-v2 .material-icons-outlined {
    font-size: 20px;
}

.sidebar-v2.collapsed .nav-item-v2 {
    justify-content: center;
    padding: 12px;
}

.sidebar-v2.collapsed .nav-item-v2 span.text {
    display: none;
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
}

.topbar-v2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg, 24px);
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft, 0 10px 40px -10px rgba(0, 70, 150, 0.15));
    flex-shrink: 0;
    height: 70px;
    position: relative;
    z-index: 150;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toggle-btn {
    background: white;
    border: none;
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--abaete-blue, #004696);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.desktop-only-btn { display: flex; }
.desktop-only-text { display: block; }

.toggle-btn:hover {
    background: var(--abaete-yellow, #FFEE9D);
    transform: scale(1.05);
}

.page-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--abaete-blue, #004696);
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar-v2 .btn-role-toggle {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    height: 40px;
    box-sizing: border-box;
}

.topbar-v2 .btn-role-toggle:hover {
    background: #e2e8f0;
}

.topbar-v2 .btn-role-toggle .material-icons-outlined {
    font-size: 18px;
    color: var(--abaete-blue, #004696);
}

.topbar-v2 .btn-role-toggle .btn-role-text {
    font-size: 11px;
    font-weight: 800;
    color: var(--abaete-blue, #004696);
    text-transform: uppercase;
}

.profile-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.profile-wrapper:hover {
    background: #f1f5f9;
}


.content-area {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg, 24px);
    box-shadow: var(--shadow-soft, 0 10px 40px -10px rgba(0, 70, 150, 0.15));
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    padding: 25px;
    width: 100%;
    box-sizing: border-box;
    z-index: 10;
}

/* Transições do Vue Router (Fade) */
.route-fade-enter-active,
.route-fade-leave-active {
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.route-fade-enter-from {
  opacity: 0;
  transform: translateY(10px);
}
.route-fade-leave-to {
  opacity: 0;
  transform: translateY(-10px);
}

/* ==========================================================================
   MOBILE RESPONSIVENESS (OFF-CANVAS SIDEBAR)
   ========================================================================== */
@media (max-width: 768px) {
    .desktop-only-text { display: none !important; }
    
    #app { flex-direction: column; }
    
    .sidebar-v2 {
        position: fixed;
        top: 0; left: -100%; bottom: 0;
        width: 280px; height: 100vh;
        margin: 0; border-radius: 0;
        flex-direction: column;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }

    .sidebar-v2.mobile-open {
        left: 0;
    }

    /* Restore sidebar elements for mobile since it's a full drawer now */
    .sidebar-brand { display: flex; height: 70px; padding: 15px; }
    .nav-group-title { display: block; }
    
    .nav-groups-container {
        display: block;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 15px;
        height: auto;
    }
    
    .nav-group { display: block; margin-bottom: 20px; }
    
    .nav-item-v2 { 
        flex-direction: row; 
        font-size: 14px; 
        padding: 10px 12px; 
        gap: 12px; 
        text-align: left;
        margin-bottom: 4px;
        min-width: auto;
    }
    
    .nav-item-v2 .material-icons-outlined { font-size: 24px; margin: 0; }
    .nav-item-v2 span.text { display: block; white-space: normal; }
    
    .sidebar-footer { display: block; padding-bottom: calc(15px + env(safe-area-inset-bottom)); }

    .main-wrapper { 
        padding: 10px; 
        padding-bottom: 20px; 
    }

    .topbar-v2 {
        height: 60px;
        padding: 10px 12px;
        border-radius: 16px;
    }

    .topbar-left {
        gap: 8px;
    }

    .page-title {
        font-size: 15px;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 35vw;
    }

    .topbar-right {
        gap: 10px;
    }

    .topbar-v2 .btn-role-toggle {
        padding: 0;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        justify-content: center;
        gap: 0;
        border: 1px solid #e2e8f0;
    }

    .topbar-v2 .btn-role-toggle .btn-role-text {
        display: none !important;
    }

    .profile-wrapper {
        padding: 0;
        border-radius: 50%;
    }

    .content-area {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .page-title {
        max-width: 24vw;
        font-size: 13px;
    }
    
    .topbar-right {
        gap: 4px;
    }
    
    .topbar-left {
        gap: 4px;
    }

    .topbar-right .icon-btn, 
    .topbar-v2 .btn-role-toggle,
    .toggle-btn {
        width: 34px !important;
        height: 34px !important;
    }
    
    .topbar-right .icon-btn .material-icons-outlined,
    .topbar-v2 .btn-role-toggle .material-icons-outlined,
    .toggle-btn .material-icons-outlined {
        font-size: 20px !important;
    }
    
    .profile-wrapper div:last-child {
        width: 34px !important;
        height: 34px !important;
        font-size: 12px !important;
    }
    
    .topbar-v2 {
        padding: 10px 8px;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */
@media print {
    #app {
        display: block;
        height: auto !important;
        overflow: visible !important;
    }

    .sidebar-v2, 
    .topbar-v2 .topbar-right, 
    .toggle-btn,
    .no-print,
    button {
        display: none !important;
    }

    .main-wrapper {
        display: block;
        padding: 0;
        margin: 0;
        height: auto !important;
        overflow: visible !important;
    }

    .topbar-v2 {
        box-shadow: none;
        border-bottom: 2px solid var(--abaete-blue);
        border-radius: 0;
        margin-bottom: 20px;
        background: white !important;
    }

    .content-area {
        display: block;
        padding: 0;
        box-shadow: none;
        border-radius: 0;
        height: auto !important;
        overflow: visible !important;
        background: white !important;
    }

    .card, .stat-card {
        box-shadow: none !important;
        border: 1px solid #eee !important;
        break-inside: avoid;
    }

    /* Cores de fundo forçadas para o gráfico e cards se necessário */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* Animação para Toasts */
.toast-slide-enter-active,
.toast-slide-leave-active {
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast-slide-enter-from {
  opacity: 0;
  transform: translateX(100px) scale(0.9);
}
.toast-slide-leave-to {
  opacity: 0;
  transform: translateX(100px) scale(0.9);
}

/* Animação Pulse para o Sino Ativo */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Estilo responsivo para dropdown de notificações */
@media (max-width: 480px) {
  .notifications-dropdown {
    width: 290px !important;
    right: -60px !important;
  }
  .page-title {
    max-width: 28vw;
    font-size: 14px;
  }
  .topbar-right {
    gap: 6px;
  }
}

/* Ajustes de layout para AplicacaoPortal */
.portal-top-bar {
    background: white;
    padding: 12px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin: -25px -25px 20px -25px;
    border-top-left-radius: var(--radius-lg, 24px);
    border-top-right-radius: var(--radius-lg, 24px);
    z-index: 10;
}

.setup-bottom-bar {
    position: sticky;
    bottom: -25px;
    margin-left: -25px;
    margin-right: -25px;
    margin-bottom: -25px;
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 15px 25px;
    display: flex;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.05);
}

@media (max-width: 768px) {
    .portal-top-bar {
        margin: -15px -15px 15px -15px;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        padding: 10px 15px;
    }
    .setup-bottom-bar {
        bottom: -15px;
        margin-left: -15px;
        margin-right: -15px;
        margin-bottom: -15px;
        padding: 15px;
    }
}