/**
 * ============================================================================
 * BISYONET - Meta Ads Sidebar Styles (Vertical)
 * ============================================================================
 * 
 * Estilos padronizados para o sidebar Meta Ads vertical.
 * Layout: Sidebar à esquerda (280px) + conteúdo à direita
 * 
 * @version 3.0
 * @author BISYONET Team
 * ============================================================================
 */

/* ========================================================================
   SIDEBAR CONTAINER
======================================================================== */
.meta-sidebar {
    width: 280px;
    min-height: 100vh;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex-shrink: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

.meta-sidebar::-webkit-scrollbar {
    width: 6px;
}

.meta-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.meta-sidebar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

/* ========================================================================
   HEADER / LOGO
======================================================================== */
.msb-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
}

.msb-logo-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
}

.msb-logo-icon-wrapper {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #1877f2 0%, #0d65d9 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.25);
    position: relative;
    overflow: hidden;
}

.msb-logo-icon-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
}

.msb-logo-svg {
    width: 28px;
    height: 28px;
    color: #ffffff;
    position: relative;
    z-index: 1;
}

.msb-logo-text-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.msb-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    letter-spacing: -0.02em;
    line-height: 1;
}

.msb-logo-subtitle {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========================================================================
   NAVEGAÇÃO PRINCIPAL
======================================================================== */
.msb-nav {
    padding: 0.5rem 1rem;
    flex: 1;
}

.msb-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.msb-menu-item {
    list-style: none;
}

/* Links diretos (Dashboard) */
.msb-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    width: 100%;
    cursor: pointer;
}

.msb-link:hover {
    background: #f3f4f6;
    color: #374151;
}

.msb-link.active {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
}

/* Grupos colapsáveis */
.msb-group-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    width: 100%;
    cursor: pointer;
}

.msb-group-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.msb-group-btn.active {
    background: #f3f4f6;
    color: #1e40af;
    font-weight: 600;
}

.msb-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: currentColor;
    opacity: 0.75;
}

.msb-link.active .msb-icon,
.msb-group-btn.active .msb-icon {
    opacity: 1;
}

.msb-label {
    flex: 1;
    text-align: left;
}

.msb-chevron {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: currentColor;
    transition: transform 0.2s ease;
}

/* Submenus */
.msb-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    padding-left: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.msb-submenu-item {
    list-style: none;
}

.msb-sublink {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    color: #6b7280;
    transition: all 0.2s ease;
}

.msb-sublink:hover {
    background: #f9fafb;
    color: #374151;
}

.msb-sublink.active {
    background: #eff6ff;
    color: #1e40af;
    font-weight: 500;
}

.msb-subicon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: currentColor;
    opacity: 0.6;
}

.msb-sublink.active .msb-subicon {
    opacity: 1;
}

.msb-sublabel {
    flex: 1;
}

/* ========================================================================
   STATUS SECTION
======================================================================== */
.msb-status-section {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e5e7eb;
}

.msb-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.875rem;
}

.msb-status-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.msb-status-header-icon {
    width: 16px;
    height: 16px;
    color: #9ca3af;
}

.msb-status-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
}

.msb-status-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem;
    border-radius: 10px;
    border: 1.5px solid;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.msb-status-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.msb-status-card:hover::before {
    opacity: 1;
}

.msb-status-card.connected {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #10b981;
}

.msb-status-card.disconnected {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #ef4444;
}

.msb-status-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.msb-status-card:hover .msb-status-icon-wrapper {
    transform: scale(1.1);
}

.msb-status-card.connected .msb-status-icon-wrapper {
    background: rgba(16, 185, 129, 0.2);
}

.msb-status-card.disconnected .msb-status-icon-wrapper {
    background: rgba(239, 68, 68, 0.2);
}

.msb-status-main-icon {
    width: 20px;
    height: 20px;
}

.msb-status-card.connected .msb-status-main-icon {
    color: #065f46;
}

.msb-status-card.disconnected .msb-status-main-icon {
    color: #991b1b;
}

.msb-status-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.msb-status-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.msb-status-card.connected .msb-status-label {
    color: #047857;
}

.msb-status-card.disconnected .msb-status-label {
    color: #b91c1c;
}

.msb-status-value {
    font-size: 0.875rem;
    font-weight: 700;
}

.msb-status-card.connected .msb-status-value {
    color: #065f46;
}

.msb-status-card.disconnected .msb-status-value {
    color: #991b1b;
}

.msb-status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.msb-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: relative;
}

.msb-status-card.connected .msb-status-dot {
    background: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.3);
}

.msb-status-card.connected .msb-status-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid #10b981;
    animation: pulse-status 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-status {
    0%, 100% {
        opacity: 0;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.8);
    }
}

.msb-status-card.disconnected .msb-status-dot {
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.3);
}

/* ========================================================================
   ACCOUNTS SECTION
======================================================================== */
.msb-accounts-section {
    padding: 1rem 1.25rem 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.msb-accounts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.875rem;
    gap: 8px;
}

.msb-accounts-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.msb-accounts-icon {
    width: 16px;
    height: 16px;
    color: #9ca3af;
    flex-shrink: 0;
}

.msb-accounts-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
}

.msb-accounts-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 11px;
    border: 1px solid #e5e7eb;
}

.msb-accounts-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 500px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
    padding-right: 4px;
}

.msb-accounts-list::-webkit-scrollbar {
    width: 4px;
}

.msb-accounts-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.msb-accounts-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Account Item */
.msb-account-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.875rem;
    border-radius: 10px;
    text-decoration: none;
    border: 1.5px solid #e5e7eb;
    background: #ffffff;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.msb-account-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #3b82f6;
    transform: scaleY(0);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.msb-account-item:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateX(2px);
}

.msb-account-item:hover::before {
    transform: scaleY(1);
}

.msb-account-item.active {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.msb-account-item.active::before {
    transform: scaleY(1);
}

/* Account Icon Wrapper */
.msb-account-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #f3f4f6;
    border-radius: 8px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.msb-account-item:hover .msb-account-icon-wrapper {
    background: #e5e7eb;
}

.msb-account-item.active .msb-account-icon-wrapper {
    background: #3b82f6;
}

.msb-account-icon-main {
    width: 20px;
    height: 20px;
    color: #6b7280;
    transition: color 0.2s ease;
}

.msb-account-item.active .msb-account-icon-main {
    color: #ffffff;
}

/* Account Content */
.msb-account-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.msb-account-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.msb-account-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    line-height: 1.4;
}

.msb-account-item.active .msb-account-name {
    color: #1e40af;
}

.msb-account-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
}

.msb-account-status-dot.active {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.msb-account-status-dot.active::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 2px solid #10b981;
    animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
    0%, 100% {
        opacity: 0;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.5);
    }
}

.msb-account-status-dot.inactive {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.msb-account-id-text {
    font-size: 0.75rem;
    color: #9ca3af;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.msb-account-item.active .msb-account-id-text {
    color: #6b7280;
}

/* Selected Indicator */
.msb-account-selected-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.msb-account-check-icon {
    width: 22px;
    height: 22px;
    color: #3b82f6;
    filter: drop-shadow(0 1px 2px rgba(59, 130, 246, 0.3));
}

/* Empty State */
.msb-accounts-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #9ca3af;
}

.msb-accounts-empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    color: #d1d5db;
}

.msb-accounts-empty-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.msb-accounts-empty-hint {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* ========================================================================
   LOGO ICON
======================================================================== */
/* Removido - agora usa SVG inline no header */

/* ========================================================================
   RESPONSIVE DESIGN
======================================================================== */
@media (max-width: 1024px) {
    .meta-sidebar {
        width: 260px;
    }
}

@media (max-width: 768px) {
    .meta-sidebar {
        width: 240px;
    }

    .msb-header {
        padding: 1rem;
    }

    .msb-section {
        padding: 0.875rem 1rem 0.625rem;
    }

    .msb-menu-item {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }

    .msb-account-item {
        padding: 0.625rem 0.75rem;
        font-size: 0.8125rem;
    }
}

@media (max-width: 640px) {
    .meta-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
        width: 280px;
    }

    .meta-sidebar.is-open {
        left: 0;
    }
}
