/* Estilos principais da aplicação */
/* =====================================================
   RESET E VARIÁVEIS
   ===================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --secondary: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    --success: #10B981;
    --dark: #1F2937;
    --light: #F9FAFB;
    --gray: #6B7280;
    --gray-light: #E5E7EB;
    --white: #FFFFFF;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

/* =====================================================
   PÁGINA DE LOGIN
   ===================================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    color: var(--dark);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--gray);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-footer {
    margin-top: 30px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--gray-light);
}

.login-footer p {
    font-size: 13px;
    line-height: 1.8;
}

/* =====================================================
   DASHBOARD LAYOUT
   ===================================================== */
.dashboard-container {
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar main";
    grid-template-columns: 250px 1fr;
    grid-template-rows: 70px 1fr;
    min-height: 100vh;
}

.top-header {
    grid-area: header;
    background: var(--white);
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left h2 {
    font-size: 20px;
    color: var(--dark);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    font-size: 14px;
    color: var(--gray);
}

.sidebar {
    grid-area: sidebar;
    background: var(--dark);
    padding: 20px 0;
    border-right: 1px solid var(--gray-light);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 25px;
    color: #D1D5DB;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--white);
}

.nav-item.active {
    background: rgba(79,70,229,0.1);
    border-left-color: var(--primary);
    color: var(--white);
}

.nav-icon {
    font-size: 20px;
}

.nav-text {
    font-size: 14px;
    font-weight: 500;
}

.main-content {
    grid-area: main;
    padding: 30px;
    overflow-y: auto;
}

/* =====================================================
   COMPONENTES
   ===================================================== */
.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 32px;
    color: var(--dark);
    margin-bottom: 5px;
}

.page-header p {
    color: var(--gray);
    font-size: 14px;
}

.card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--gray-light);
    background: var(--light);
}

.card-header h3 {
    font-size: 18px;
    color: var(--dark);
    font-weight: 600;
}

.card-body {
    padding: 25px;
}

/* =====================================================
   ALERTAS
   ===================================================== */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background: #D1FAE5;
    border-left-color: var(--success);
    color: #065F46;
}

.alert-error {
    background: #FEE2E2;
    border-left-color: var(--danger);
    color: #991B1B;
}

.alert-warning {
    background: #FEF3C7;
    border-left-color: var(--warning);
    color: #92400E;
}

.alert-info {
    background: #DBEAFE;
    border-left-color: var(--info);
    color: #1E40AF;
}

/* =====================================================
   FORMULÁRIOS
   ===================================================== */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
    font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--gray);
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

/* =====================================================
   BOTÕES
   ===================================================== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
    display: block;
}

/* =====================================================
   STATUS DE CONEXÃO
   ===================================================== */
.status-online,
.status-offline {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.status-online {
    background: #D1FAE5;
    color: #065F46;
}

.status-offline {
    background: #FEE2E2;
    color: #991B1B;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-indicator.online {
    background: #10B981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
    animation: pulse 2s infinite;
}

.status-indicator.offline {
    background: #EF4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.ultimo-log {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--gray-light);
}

/* =====================================================
   CARDS DE ESTATÍSTICAS
   ===================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: var(--white);
}

.stat-card.warning {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: var(--white);
}

.stat-card.danger {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: var(--white);
}

.stat-icon {
    font-size: 40px;
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-info p {
    font-size: 13px;
    opacity: 0.9;
}

/* =====================================================
   CARDS DE AÇÃO
   ===================================================== */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.action-card {
    background: var(--white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--dark);
    text-align: center;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.action-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.action-card h4 {
    font-size: 18px;
    margin-bottom: 8px;
}

.action-card p {
    font-size: 14px;
    color: var(--gray);
}

/* =====================================================
   TABELAS
   ===================================================== */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--light);
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-light);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: var(--light);
}

.text-center {
    text-align: center;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-muted {
    color: var(--gray);
}

/* =====================================================
   BADGES
   ===================================================== */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #D1FAE5;
    color: #065F46;
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-danger {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-secondary {
    background: var(--gray-light);
    color: var(--gray);
}

/* =====================================================
   RESPONSIVIDADE
   ===================================================== */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        grid-template-areas:
            "header"
            "main";
        grid-template-columns: 1fr;
        grid-template-rows: 70px 1fr;
    }
    
    .sidebar {
        display: none;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .stats-grid,
    .actions-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px;
    }
}