/* ============================================
   STATUS BADGES
   ============================================ */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.status-active {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.status-suspended {
    background: #fee2e2;
    color: #991b1b;
}

/* ============================================
   ADMIN LAYOUT COM MENU LATERAL
   ============================================ */

.admin-layout {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    flex-shrink: 0;
}

.sidebar-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

.sidebar-logo:hover {
    transform: scale(1.05);
}

.sidebar-header h3 {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: visible;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 0;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    flex-shrink: 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left: 4px solid var(--color-yellow);
    font-weight: 600;
}

.nav-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.nav-label {
    flex: 1;
}

.nav-badge {
    background: var(--color-danger);
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.company-code-sidebar {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.company-code-sidebar .code-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.company-code-sidebar .code-value {
    font-size: 16px;
    font-weight: 700;
    color: white;
    font-family: monospace;
    letter-spacing: 2px;
}

.company-code-sidebar .btn-link {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    padding: 4px 0;
}

.company-code-sidebar .btn-link:hover {
    color: white;
}

.sidebar-footer .btn-outline {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 100%;
}

.sidebar-footer .btn-outline:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: 20px 32px;
    border-bottom: 2px solid rgba(225, 172, 59, 0.2);
    box-shadow: 0 4px 16px rgba(0, 28, 40, 0.08), 0 1px 0 rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    min-height: 80px;
}

.admin-header .header-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-header .header-actions-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.admin-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-header h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 32px;
    background: linear-gradient(180deg, var(--color-yellow), var(--color-yellow-dark));
    border-radius: 2px;
    flex-shrink: 0;
}

.header-subtitle {
    margin: 0;
    font-size: 14px;
    color: var(--color-secondary);
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.4;
    text-align: left;
}

.header-subtitle strong {
    color: var(--color-primary);
    font-weight: 600;
}

/* Badge de role */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid;
    transition: all 0.2s ease;
}

.role-badge-admin {
    background: linear-gradient(135deg, rgba(225, 172, 59, 0.15), rgba(225, 172, 59, 0.08));
    color: var(--color-yellow-dark);
    border-color: var(--color-yellow);
}

.role-badge-accountant {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.15), rgba(30, 64, 175, 0.08));
    color: #1e40af;
    border-color: #3b82f6;
}

.role-badge-master {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.08));
    color: #7c3aed;
    border-color: #8b5cf6;
}

/* Info do usuário */
#adminUserInfo,
#accountantUserInfo,
#masterUserInfo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(0, 28, 40, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(0, 28, 40, 0.08);
    transition: all 0.2s ease;
}

#adminUserInfo:hover,
#accountantUserInfo:hover,
#masterUserInfo:hover {
    background: rgba(0, 28, 40, 0.05);
    border-color: rgba(0, 28, 40, 0.12);
}

#adminUserName,
#accountantUserName,
#masterUserName {
    font-weight: 600;
    color: var(--color-primary);
    font-size: 14px;
}

/* Botões de ação do header */
.admin-header .header-actions-right .btn-link {
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(0, 28, 40, 0.03);
    border: 1px solid rgba(0, 28, 40, 0.08);
    color: var(--color-primary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
}

.admin-header .header-actions-right .btn-link:hover {
    background: rgba(225, 172, 59, 0.1);
    border-color: var(--color-yellow);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(225, 172, 59, 0.2);
}

.admin-header .header-actions-right .btn-link:active {
    transform: translateY(0);
}

.admin-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* Admin Pages */
.admin-page {
    display: none !important;
    animation: fadeIn 0.3s ease;
}

.admin-page.active {
    display: block !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards dentro das páginas */
.admin-page .card-block {
    background: white;
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--color-border);
}

.admin-page .card-block__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(0, 28, 40, 0.1);
}

.admin-page .card-block__header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
}

/* Quick Actions */
.admin-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

/* Métricas no Dashboard */
.admin-metrics-wrapper {
    margin-bottom: 32px;
}

/* Responsividade */
@media (max-width: 1024px) {
    .admin-sidebar {
        width: 220px;
    }

    .admin-main {
        margin-left: 220px;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        width: 70px;
        overflow: visible;
    }

    .sidebar-header h3,
    .nav-label,
    .company-code-sidebar,
    .sidebar-footer .btn-outline span {
        display: none;
    }

    .sidebar-header {
        justify-content: center;
        padding: 20px 12px;
        min-height: 120px;
    }

    .sidebar-logo {
        width: 100px;
        height: 100px;
    }

    .nav-item {
        justify-content: center;
        padding: 14px;
    }

    .nav-icon {
        font-size: 24px;
    }

    .admin-main {
        margin-left: 70px;
    }

    .admin-content {
        padding: 20px 16px;
    }

    .admin-header {
        padding: 16px 20px;
    }

    .admin-header h2 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .admin-sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100vh;
        z-index: 10001;
        transition: left 0.3s ease;
        width: 260px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .admin-sidebar.mobile-open {
        left: 0;
    }
    
    /* Overlay quando sidebar está aberta - usar elemento separado */
    .admin-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 10000;
        backdrop-filter: blur(2px);
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }
    
    .admin-sidebar-overlay.active {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-header {
        min-height: 180px;
        padding: 24px 20px;
    }

    .sidebar-logo {
        width: 140px;
        height: 140px;
    }

    .admin-main {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    /* Botão hambúrguer no header */
    .admin-header {
        padding: 10px 12px !important;
        position: relative;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        flex-wrap: nowrap !important;
        min-height: 56px;
    }
    
    .admin-mobile-menu-btn {
        display: block !important;
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        background: var(--color-primary);
        color: white;
        border: none;
        border-radius: var(--radius-sm);
        padding: 6px 10px;
        font-size: 18px;
        cursor: pointer;
        z-index: 10002;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        flex-shrink: 0;
    }
    
    .admin-mobile-menu-btn:active {
        transform: translateY(-50%) scale(0.95);
    }
    
    .admin-header .header-content {
        margin-left: 45px !important;
        padding-right: 50px !important;
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }
    
    .admin-header .header-content h2 {
        font-size: 16px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin: 0 0 2px 0 !important;
        line-height: 1.2;
    }
    
    .admin-header .header-content .header-subtitle {
        font-size: 11px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin: 0 !important;
        line-height: 1.2;
    }

    .admin-content {
        padding: 12px !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
    
    .admin-page {
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        padding: 0 !important;
    }

    .admin-page .card-block {
        padding: 12px !important;
        margin-bottom: 12px;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
    
    /* Tabelas responsivas */
    .admin-page .table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
        margin: 0 -12px;
        padding: 0 12px;
    }
    
    .admin-page .table {
        min-width: 600px;
        font-size: 11px;
    }
    
    .admin-page .table th,
    .admin-page .table td {
        padding: 6px 4px;
        white-space: nowrap;
        font-size: 11px;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }

    .admin-quick-actions {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    /* Formulários em mobile */
    .admin-page .form-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    /* Header actions em mobile - compacto */
    .admin-header .header-actions-right {
        flex-wrap: nowrap !important;
        gap: 8px !important;
        flex-shrink: 0;
    }
    
    .admin-header .header-actions-right .btn-link {
        padding: 8px 10px !important;
        font-size: 16px !important;
        min-width: 40px !important;
        height: 40px !important;
    }
    
    #adminUserInfo {
        padding: 6px 12px !important;
        gap: 8px !important;
    }
    
    .role-badge {
        padding: 4px 10px !important;
        font-size: 10px !important;
    }
    
    #adminUserName {
        font-size: 12px !important;
    }
    
    /* Card block header em mobile */
    .card-block__header {
        flex-wrap: wrap;
        gap: 10px;
        padding-bottom: 12px;
        margin-bottom: 12px;
    }
    
    .card-block__header h3 {
        flex: 1 1 100%;
        font-size: 16px !important;
    }
    
    .card-block__header > div {
        flex: 1 1 100%;
        justify-content: flex-start;
    }
    
    /* Garantir que admin views não cortam */
    #companyAdminView,
    #accountantView,
    #masterView {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }
    
    #companyAdminView .admin-layout,
    #accountantView .admin-layout,
    #masterView .admin-layout {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    #companyAdminView *,
    #accountantView *,
    #masterView * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Tabelas com scroll horizontal */
    .admin-page .table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
        margin: 0 -12px;
        padding: 0 12px;
    }
    
    .admin-page .table {
        min-width: 600px;
        font-size: 11px;
    }
    
    .admin-page .table th,
    .admin-page .table td {
        padding: 6px 4px;
        white-space: nowrap;
        font-size: 11px;
    }
    
    /* Formulários em coluna única */
    .admin-page .form-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    /* Métricas em 2 colunas */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
    
    /* Botões compactos */
    .admin-page .btn {
        padding: 8px 12px !important;
        font-size: 12px !important;
        white-space: nowrap;
    }
    
    .admin-page .btn-small {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }
}

/* Scrollbar para sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

