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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f5f6fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links a {
    color: #bdc3c7;
    text-decoration: none;
    margin-left: 2rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    color: white;
    background: #34495e;
}

/* Container */
.container {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: #bdc3c7;
    text-align: center;
    padding: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2980b9;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Detection Page */
.detection-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.upload-section,
.result-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.upload-section h2,
.result-section h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.upload-area {
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    margin-bottom: 1rem;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #3498db;
    background: #f8f9fa;
}

.upload-placeholder {
    color: #7f8c8d;
}

.upload-placeholder svg {
    margin-bottom: 1rem;
}

.preview-image {
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
}

.result-image-container {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.result-image {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.result-placeholder {
    color: #7f8c8d;
}

.result-info {
    margin-top: 1rem;
}

.process-time {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 1rem;
}

/* Tables */
.detection-table,
.logs-table {
    width: 100%;
    border-collapse: collapse;
}

.detection-table th,
.detection-table td,
.logs-table th,
.logs-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.detection-table th,
.logs-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

/* Badges */
.class-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-right: 0.25rem;
}

.class-close_button {
    background: #fde8e8;
    color: #c0392b;
}

.class-action_button {
    background: #e8f8f0;
    color: #27ae60;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge.success {
    background: #e8f8f0;
    color: #27ae60;
}

.status-badge.error {
    background: #fde8e8;
    color: #c0392b;
}

/* Logs Page */
.logs-container {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.logs-header h2 {
    color: #2c3e50;
}

.filter-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-section select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.empty-row {
    text-align: center;
    color: #7f8c8d;
    padding: 2rem !important;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.page-link {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #2c3e50;
    text-decoration: none;
    transition: all 0.3s;
}

.page-link:hover,
.page-link.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.page-ellipsis {
    padding: 0.5rem;
}

/* Dashboard */
.dashboard-container {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.dashboard-container h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card:nth-child(4) {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.chart-container {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.chart-container h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.chart-container canvas {
    height: 250px !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .detection-container {
        grid-template-columns: 1fr;
    }

    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links a {
        margin-left: 1rem;
    }

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