/* Global Styles */
body {
    font-family: Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f5f5f5;
    font-size: 13px;
}

.container {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
}

h2 {
    color: #555;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 16px;
}

/* Navigation */
.nav-links {
    margin-top: 20px;
    margin-bottom: 30px;
    padding: 15px;
    background-color: #e9f5ff;
    border-radius: 4px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.nav-link-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-link-item a {
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    padding: 5px 0;
}

.nav-link-item a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #007bff;
    transition: width 0.3s ease;
}

.nav-link-item a:hover {
    color: #0056b3;
    transform: translateY(-1px);
}

.nav-link-item a:hover::after {
    width: 100%;
}

.nav-link-count {
    background-color: #007bff;
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
    display: inline-block;
    transition: all 0.3s ease;
}

.nav-link-item a:hover .nav-link-count {
    background-color: #0056b3;
    transform: scale(1.1);
}

/* Query Form */
.query-form {
    margin-bottom: 20px;
    padding: 20px;
    background-color: #e9f5ff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.query-form input[type="text"],
.query-form select {
    padding: 8px;
    width: 180px;
    margin-right: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    height: 32px;
    box-sizing: border-box;
}

.query-form input[type="submit"],
.clear-filter {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    margin-left: 8px;
    height: 32px;
    box-sizing: border-box;
    vertical-align: middle;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.query-form input[type="submit"]:hover,
.clear-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2);
    background-color: #0056b3;
}

.query-form input[type="submit"]:active,
.clear-filter:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

.clear-filter {
    background-color: #6c757d;
    padding: 8px 12px;
}

.clear-filter:hover {
    background-color: #5a6268;
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.2);
}

.query-form input[type="text"]:focus,
.query-form select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    transform: translateY(-1px);
}

/* Unblock Button */
.unblock-btn {
    padding: 6px 12px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    height: 28px;
    box-sizing: border-box;
}

.unblock-btn:hover {
    background-color: #218838;
}

/* Status Labels */
.status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
    text-align: center;
}

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

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

/* Status Codes */
.status-code {
    font-weight: bold;
}

.status-code.success {
    color: #28a745;
}

.status-code.error {
    color: #dc3545;
}

/* User Agent Column */
.user-agent {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Request Time Column */
td:nth-child(7), th:nth-child(7) {
    width: 160px;
    min-width: 160px;
    text-align: center;
}

/* Query IP Column */
td:nth-child(4), th:nth-child(4) {
    width: 120px;
    min-width: 120px;
}

/* Status Code Column */
td:nth-child(5), th:nth-child(5) {
    width: 80px;
    min-width: 80px;
    text-align: center;
}

/* Response Time Column */
td:nth-child(6), th:nth-child(6) {
    width: 100px;
    min-width: 100px;
    text-align: center;
}

/* No Data Message */
.no-data {
    text-align: center;
    color: #6c757d;
    padding: 20px;
}

/* Info Items */
.info-item {
    margin: 15px 0;
    padding: 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.info-item:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.label {
    font-weight: bold;
    color: #555;
    display: inline-block;
    width: 100px;
}

/* IP Info Layout */
.ip-info {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    padding: 0;
    background-color: transparent;
    border-radius: 0;
    flex-wrap: wrap;
    align-items: stretch;
}

.ip-info-left {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    justify-content: stretch;
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ip-info-right {
    flex: 2;
    min-width: 350px;
    display: flex;
    flex-direction: column;
    justify-content: stretch;
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Map Container */
.map-container {
    height: 100%;
    min-height: 300px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex: 1;
    margin-top: 15px;
}

/* Top Queries Styles */
.top-queries {
    margin-top: 20px;
}

.top-queries table {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .ip-info {
        flex-direction: column;
    }
    
    .ip-info-left,
    .ip-info-right {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .query-form input[type="text"],
    .query-form select {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .query-form input[type="submit"],
    .clear-filter {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
    }
    
    .nav-links {
        flex-direction: column;
        gap: 10px;
    }
    
    .map-container {
        min-height: 200px;
    }
    
    table {
        font-size: 11px;
    }
    
    th, td {
        padding: 8px;
    }
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    font-size: 13px;
    margin-top: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

th, td {
    padding: 15px 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

th {
    background-color: #007bff;
    color: white;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr {
    transition: all 0.2s ease;
}

tr:hover {
    background-color: #e9f5ff !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
    cursor: pointer;
}

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

/* Map Container */
.map-container {
    height: 200px;
    margin: 15px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Loading States */
.loading-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 123, 255, 0.3);
    border-radius: 50%;
    border-top-color: #007bff;
    animation: spin 1s ease-in-out infinite;
}

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

.loading-container {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background-color: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    margin-bottom: 10px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success { background-color: #28a745; }
.toast.error { background-color: #dc3545; }
.toast.warning { background-color: #ffc107; color: #333; }

/* Return to Top Button */
.return-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #007bff;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.return-to-top.show {
    opacity: 1;
    visibility: visible;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}

.pagination {
    display: flex;
    gap: 5px;
    align-items: center;
}

.pagination a, .pagination span {
    padding: 8px 12px;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #007bff;
    background-color: white;
    transition: all 0.2s ease;
    font-size: 13px;
}

.pagination a:hover {
    background-color: #e9f5ff;
    border-color: #007bff;
}

.pagination span.current-page {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: bold;
}

.pagination-info {
    font-size: 13px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 10px;
    order: -1;
}

.pagination-info span {
    font-weight: bold;
    color: #007bff;
}

.pagination-settings {
    display: flex;
    align-items: center;
    gap: 15px;
}

.per-page-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.per-page-selector select {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.per-page-selector select:hover {
    border-color: #007bff;
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-size-info {
    font-size: 13px;
    color: #666;
}

/* Enhanced Form Elements */
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
