/* ======================================
   Portal de Automação - Estilos Customizados
   Paleta de Cores Harmoniosa
   ====================================== */

:root {
    /* Cores Principais - Tons de Azul/Roxo Profissional */
    --primary-dark: #1e293b;      /* Azul escuro profundo */
    --primary-main: #3b82f6;      /* Azul principal */
    --primary-light: #60a5fa;     /* Azul claro */
    --primary-lighter: #dbeafe;   /* Azul muito claro */
    
    /* Cores Secundárias - Tons de Roxo/Índigo */
    --secondary-dark: #4c1d95;    /* Roxo escuro */
    --secondary-main: #7c3aed;    /* Roxo principal */
    --secondary-light: #a78bfa;   /* Roxo claro */
    
    /* Cores de Acento */
    --accent-orange: #f97316;     /* Laranja vibrante */
    --accent-teal: #14b8a6;       /* Verde-azulado */
    --accent-pink: #ec4899;       /* Rosa */
    
    /* Cores de Status */
    --success: #10b981;           /* Verde sucesso */
    --warning: #f59e0b;           /* Amarelo alerta */
    --error: #ef4444;             /* Vermelho erro */
    --info: #3b82f6;              /* Azul informação */
    
    /* Tons Neutros */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Fundo e Texto */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    
    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-bg: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    --sidebar-text: #e2e8f0;
    --sidebar-hover: rgba(59, 130, 246, 0.15);
    --sidebar-active: #3b82f6;
}

/* Reset e Configurações Gerais */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ======================================
   Layout com Sidebar
   ====================================== */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

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

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

/* Logo/Header da Sidebar */
.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sidebar-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.sidebar-logo i {
    color: var(--primary-light);
    font-size: 1.8rem;
}

.sidebar-subtitle {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

/* Menu de Navegação */
.sidebar-nav {
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin: 0.25rem 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.nav-link:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
    transform: translateX(3px);
}

.nav-link.active {
    background-color: var(--sidebar-active);
    color: #ffffff;
    font-weight: 600;
}

.nav-link i {
    width: 20px;
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

.nav-badge {
    margin-left: auto;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    background-color: var(--accent-orange);
    color: white;
    border-radius: 1rem;
}

/* Footer da Sidebar */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-main), var(--secondary-main));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.user-details {
    flex: 1;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--sidebar-text);
}

.user-role {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* ======================================
   Conteúdo Principal
   ====================================== */

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header/Topbar */
.topbar {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-600);
    cursor: pointer;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-box {
    position: relative;
}

.search-input {
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    width: 250px;
    font-size: 0.9rem;
}

.search-box i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

.topbar-icons {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    position: relative;
    background: none;
    border: none;
    padding: 0.5rem;
    color: var(--gray-600);
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.icon-btn:hover {
    background-color: var(--gray-100);
    color: var(--primary-main);
}

.icon-btn .badge {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background-color: var(--error);
    color: white;
    font-size: 0.65rem;
    padding: 0.125rem 0.375rem;
    border-radius: 1rem;
}

/* Conteúdo */
.content {
    flex: 1;
    padding: 2rem;
}

/* ======================================
   Cards e Componentes
   ====================================== */

.card {
    background-color: var(--bg-primary);
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-main);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background-color: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background-color: var(--gray-300);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background-color: var(--error);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* Badges de Status */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 1rem;
}

.status-badge.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-badge.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.status-badge.info {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.status-badge.pending {
    background-color: rgba(156, 163, 175, 0.1);
    color: var(--gray-600);
}

/* Alinhamento de ícones em spans com inline-flex */
span.inline-flex {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Garante alinhamento de ícones em badges circulares (rounded-full) */
span.rounded-full {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Espaçamento para ícones dentro de badges */
span.inline-flex i,
span.rounded-full i {
    display: inline-flex;
    align-items: center;
}

/* Tabelas */
.table-container {
    overflow-x: auto;
    border-radius: 0.5rem;
    border: 1px solid var(--gray-200);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.data-table thead {
    background-color: var(--gray-50);
}

.data-table th {
    padding: 0.6rem 0.4rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.data-table td {
    padding: 0.6rem 0.4rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--text-primary);
    vertical-align: middle;
    font-size: 0.85rem;
}

.data-table tbody tr:hover {
    background-color: var(--gray-50);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    background-color: var(--bg-primary);
    transition: all 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-main);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Footer */
.footer {
    background-color: var(--bg-primary);
    border-top: 1px solid var(--gray-200);
    padding: 1.5rem 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ======================================
   Responsividade
   ====================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .search-input {
        width: 150px;
    }
    
    .content {
        padding: 1rem;
    }
}

/* ======================================
   Animações e Efeitos
   ====================================== */

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

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Hover Effects */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--gray-200);
    border-top: 3px solid var(--primary-main);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ======================================
   Estilos Específicos - Empresas
   ====================================== */

/* Stat Cards */
.stat-card {
    position: relative;
    padding: 1.5rem;
    border-radius: 1rem;
    color: white;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.9;
    margin-bottom: 0.75rem;
}

.stat-content {
    position: relative;
    z-index: 1;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.95;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1;
}

/* Hover Row Effect */
.hover-row {
    transition: all 0.2s ease;
}

.hover-row:hover {
    background-color: var(--gray-50) !important;
}

/* Icon Buttons */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background-color: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-icon:hover {
    background-color: currentColor;
    color: white !important;
    transform: scale(1.1);
}

/* Badge Enhancements */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Alinhamento universal para badges com Tailwind */
.px-2.inline-flex,
.px-3.inline-flex {
    display: flex !important;
    align-items: center !important;
    gap: 0.25rem;
}

/* Ícones dentro de badges */
.px-2.inline-flex i,
.px-3.inline-flex i,
.badge i {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

/* Success Lighter (for badges) */
:root {
    --success-lighter: #d1fae5;
}

/* Table Enhancements for Companies */
.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table code {
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

/* Animation delays for stat cards */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0;
}

.fade-in:nth-child(1) { animation-delay: 0s; }
.fade-in:nth-child(2) { animation-delay: 0.1s; }
.fade-in:nth-child(3) { animation-delay: 0.2s; }
.fade-in:nth-child(4) { animation-delay: 0.3s; }

/* Empty state improvements */
.data-table tbody tr td[colspan] {
    background-color: var(--bg-secondary);
}

/* Responsive adjustments for empresas */
@media (max-width: 1024px) {
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .card-header > div:last-child {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
    }
}

/* ======================================
   Sistema de Notificações Popup
   ====================================== */

/* Container das notificações */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    width: 100%;
    pointer-events: none;
}

/* Notificação individual */
.notification {
    position: relative;
    margin-bottom: 10px;
    padding: 16px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.05);
    border-left: 5px solid;
    min-height: 60px;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

/* Animações de entrada */
.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.hide {
    opacity: 0;
    transform: translateX(100%);
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    min-height: 0;
}

/* Ícones das notificações */
.notification-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: white;
}

/* Conteúdo da notificação */
.notification-content {
    flex-grow: 1;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-primary);
    word-wrap: break-word;
}

/* Botão de fechar */
.notification-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.notification-close:hover {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
}

/* Barra de progresso */
.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0 0 12px 12px;
    transition: width linear;
    width: 0%;
}

/* Tipos de notificação */
.notification.success {
    border-left-color: var(--success);
}

.notification.success .notification-icon {
    background: var(--success);
}

.notification.success .notification-progress {
    background: var(--success);
}

.notification.error,
.notification.danger {
    border-left-color: var(--error);
}

.notification.error .notification-icon,
.notification.danger .notification-icon {
    background: var(--error);
}

.notification.error .notification-progress,
.notification.danger .notification-progress {
    background: var(--error);
}

.notification.warning {
    border-left-color: var(--warning);
}

.notification.warning .notification-icon {
    background: var(--warning);
}

.notification.warning .notification-progress {
    background: var(--warning);
}

.notification.info {
    border-left-color: var(--info);
}

.notification.info .notification-icon {
    background: var(--info);
}

.notification.info .notification-progress {
    background: var(--info);
}

/* Responsividade das notificações */
@media (max-width: 768px) {
    .notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .notification {
        margin-bottom: 8px;
        padding: 14px 16px;
        border-radius: 10px;
    }
    
    .notification-content {
        font-size: 13px;
    }
}

/* Efeito hover sutil */
.notification:hover {
    transform: translateX(-2px);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15), 0 6px 20px rgba(0, 0, 0, 0.08);
}

