* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 10px;
    font-size: 24px;
}

.login-box h2 {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 18px;
    font-weight: normal;
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #667eea;
    font-size: 28px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Sections */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    color: #333;
    font-size: 22px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.search-input {
    width: 300px;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.pop-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    transition: transform 0.3s, box-shadow 0.3s;
}

.pop-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.pop-card h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 18px;
}

.pop-card .pop-info {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
}

.pop-card .pop-devices {
    color: #28a745;
    font-weight: 600;
    margin: 10px 0;
}

.pop-card .card-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

table th,
table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap;
}

/* Larguras mínimas por coluna */
table th:nth-child(1), table td:nth-child(1) { width: 40px; min-width: 40px; } /* Checkbox */
table th:nth-child(2), table td:nth-child(2) { width: 60px; min-width: 60px; } /* ID */
table th:nth-child(3), table td:nth-child(3) { min-width: 120px; } /* Hostname */
table th:nth-child(4), table td:nth-child(4) { min-width: 120px; } /* SysName */
table th:nth-child(5), table td:nth-child(5) { min-width: 100px; } /* IP */
table th:nth-child(6), table td:nth-child(6) { min-width: 150px; } /* Hardware */
table th:nth-child(7), table td:nth-child(7) { min-width: 80px; } /* SO */
table th:nth-child(8), table td:nth-child(8) { width: 70px; text-align: center; } /* Portas */
table th:nth-child(9), table td:nth-child(9) { width: 90px; text-align: center; } /* Fonte */
table th:nth-child(10), table td:nth-child(10) { width: 80px; text-align: center; } /* Status */
table th:nth-child(11), table td:nth-child(11) { width: 100px; text-align: center; } /* Ações */

table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

table td {
    font-size: 13px;
}

table tr:hover {
    background: #f8f9fa;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

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

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover,
.close:focus {
    color: #000;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Inventory */
.inventory-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.inventory-pop {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.inventory-pop h3 {
    color: #28a745;
    margin-bottom: 15px;
    font-size: 18px;
}

.inventory-devices {
    display: grid;
    gap: 10px;
}

.device-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e0e0e0;
}

.device-info {
    color: #666;
    font-size: 14px;
}

.device-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

/* Error Message */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
    border: 1px solid #f5c6cb;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 6px;
    margin-top: 15px;
    border: 1px solid #c3e6cb;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-online {
    background: #d4edda;
    color: #155724;
}

.status-offline {
    background: #f8d7da;
    color: #721c24;
}

.source-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #90caf9;
}

.port-count {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffb74d;
}

.device-type-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #81c784;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
    }

    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .search-input {
        width: 100%;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 12px;
    }

    table th,
    table td {
        padding: 8px;
    }
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 350px;
}

.toast {
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: 500;
    animation: slideInRight 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.toast-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.toast-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: white;
    font-size: 16px;
    margin-top: 20px;
    text-align: center;
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    gap: 5px;
    background: #f0f0f0;
    padding: 4px;
    border-radius: 8px;
}

.btn-filter {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}

.btn-filter:hover {
    background: #e0e0e0;
    color: #333;
}

.btn-filter.active {
    background: #667eea;
    color: white;
    font-weight: 600;
}

/* Device Table Improvements */
tr.device-offline {
    background-color: #fff5f5 !important;
    opacity: 0.85;
}

tr.device-offline:hover {
    background-color: #ffe5e5 !important;
}

table tbody tr {
    transition: background-color 0.2s;
}

table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Dashboard */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transition: transform 0.3s;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.metric-icon {
    font-size: 36px;
    line-height: 1;
}

.metric-content {
    flex: 1;
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
}

.metric-label {
    font-size: 13px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.dashboard-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dashboard-card h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 18px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.type-bar {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.type-name {
    min-width: 80px;
    font-weight: 600;
    color: #555;
}

.type-bar-container {
    flex: 1;
    background: #f0f0f0;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.type-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    padding: 0 10px;
    color: white;
    font-weight: 600;
    font-size: 13px;
    transition: width 0.5s ease;
}

.top-pop-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.top-pop-name {
    font-weight: 600;
    color: #333;
    flex: 1;
}

.top-pop-stats {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: #666;
}

.top-pop-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}
