@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background: #0F172A;
    color: #E2E8F0;
    min-height: 100vh;
}

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* ============================================
   HEADER
============================================ */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #1E293B;
    flex-wrap: wrap;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left h1 {
    font-size: clamp(20px, 4vw, 26px);
    font-weight: 700;
    color: #F8FAFC;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left h1 i { 
    color: #4F46E5; 
}

.btn-back {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #1E293B;
    color: #CBD5E1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid #334155;
}

.btn-back:hover {
    background: #334155;
    color: #F1F5F9;
    transform: translateX(-2px);
}

.btn-primary, .btn-secondary {
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
}

.btn-primary {
    background: #4F46E5;
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover { 
    background: #4338CA;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: #1E293B;
    color: #CBD5E1;
    border: 1px solid #334155;
}

.btn-secondary:hover { 
    background: #334155;
    color: #F1F5F9;
}

/* ============================================
   CONTADORES
============================================ */
.contadores {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.contador-card {
    background: #1E293B;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s;
}

.contador-card:hover {
    border-color: #4F46E5;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.contador-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.contador-info {
    flex: 1;
}

.contador-valor {
    font-size: 32px;
    font-weight: 700;
    color: #F8FAFC;
    line-height: 1;
    margin-bottom: 4px;
}

.contador-label {
    font-size: 13px;
    color: #94A3B8;
    font-weight: 500;
}

/* ============================================
   TOOLBAR
============================================ */
.toolbar {
    margin-bottom: 20px;
}

.search-box {
    position: relative;
    max-width: 400px;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748B;
}

.search-box input {
    width: 100%;
    padding: 12px 12px 12px 42px;
    background: #1E293B;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #F8FAFC;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ============================================
   TABELA
============================================ */
.table-wrapper {
    background: #1E293B;
    border: 1px solid #334155;
    border-radius: 12px;
    overflow: hidden;
    overflow-x: auto;
}

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

.data-table th {
    background: #0F172A;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 16px;
    border-top: 1px solid #334155;
    font-size: 14px;
}

.data-table tr {
    transition: background 0.2s;
}

.data-table tr:hover {
    background: rgba(51, 65, 85, 0.5);
}

.data-table tr:first-child td {
    border-top: none;
}

/* ============================================
   BADGES
============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge.ativo {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
}

.badge.inativo {
    background: rgba(107, 114, 128, 0.15);
    color: #9CA3AF;
}

.badge.admin {
    background: rgba(139, 92, 246, 0.15);
    color: #A78BFA;
}

.badge.vendedor {
    background: rgba(59, 130, 246, 0.15);
    color: #60A5FA;
}

.badge.cliente {
    background: rgba(100, 116, 139, 0.15);
    color: #94A3B8;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.ativo {
    background: #10B981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
    animation: pulse 2s infinite;
}

.status-dot.inativo {
    background: #9CA3AF;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.1);
    }
}

/* ============================================
   AVATAR
============================================ */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.avatar.admin {
    background: linear-gradient(135deg, #8B5CF6, #6366F1);
}

.avatar.vendedor {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
}

.funcionario-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.funcionario-dados {
    display: flex;
    flex-direction: column;
}

.funcionario-nome {
    font-weight: 600;
    color: #F8FAFC;
    font-size: 14px;
}

.funcionario-cargo {
    font-size: 12px;
    color: #94A3B8;
    margin-top: 2px;
}

/* ============================================
   BOTÕES DE AÇÃO
============================================ */
.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 14px;
    margin-right: 6px;
}

.btn-icon.edit {
    background: rgba(59, 130, 246, 0.15);
    color: #3B82F6;
}

.btn-icon.edit:hover {
    background: #3B82F6;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-icon.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
}

.btn-icon.danger:hover {
    background: #EF4444;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.acoes-cell {
    display: flex;
    gap: 4px;
}

/* ============================================
   MODAL
============================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active { 
    display: flex;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #1E293B;
    border: 1px solid #334155;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    color: #F8FAFC;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-close {
    background: none;
    border: none;
    color: #64748B;
    font-size: 20px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-close:hover { 
    background: #334155;
    color: #F8FAFC;
    transform: rotate(90deg);
}

#form-funcionario { 
    padding: 24px; 
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #CBD5E1;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px 14px;
    background: #0F172A;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #F8FAFC;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #64748B;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 8px;
    margin-top: 24px;
    border-top: 1px solid #334155;
}

/* ============================================
   TOAST NOTIFICATION
============================================ */
.toast-notif {
    position: fixed;
    top: 24px;
    right: 24px;
    background: #1E293B;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 9999;
    max-width: 400px;
}

.toast-notif.show {
    transform: translateX(0);
}

.toast-success {
    border-color: #10B981;
}

.toast-success i {
    color: #10B981;
}

.toast-error {
    border-color: #EF4444;
}

.toast-error i {
    color: #EF4444;
}

.toast-info {
    border-color: #3B82F6;
}

.toast-info i {
    color: #3B82F6;
}

.toast-notif i {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-notif span {
    color: #F8FAFC;
    font-size: 14px;
    font-weight: 500;
}

/* ============================================
   LOADING
============================================ */
.loading-cell {
    text-align: center;
    padding: 40px 20px;
    color: #94A3B8;
}

.loading-cell i {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
    color: #4F46E5;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94A3B8;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
    color: #475569;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 8px;
}

/* ============================================
   RESPONSIVO
============================================ */
@media (max-width: 768px) {
    .admin-container { 
        padding: 16px; 
    }
    
    .admin-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-left {
        justify-content: space-between;
    }
    
    .btn-primary {
        width: 100%;
        justify-content: center;
    }
    
    .contadores {
        grid-template-columns: 1fr;
    }
    
    .contador-card {
        padding: 16px;
    }
    
    .contador-valor {
        font-size: 28px;
    }
    
    .data-table { 
        font-size: 13px; 
    }
    
    .data-table th, .data-table td { 
        padding: 12px 8px; 
    }
    
    .hide-mobile { 
        display: none; 
    }
    
    .toast-notif {
        left: 16px;
        right: 16px;
        max-width: none;
    }
    
    .avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .funcionario-nome {
        font-size: 13px;
    }
    
    .funcionario-cargo {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        max-height: 100vh;
        border-radius: 0;
    }
    
    #form-funcionario {
        padding: 16px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer button {
        width: 100%;
        justify-content: center;
    }
}