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

:root {
    --primary-color: #1867C0;
    --secondary-color: #48A9A6;
    --success-color: #27AE60;
    --warning-color: #F39C12;
    --danger-color: #E74C3C;
    --light-bg: #F5F6F9;
    --dark-text: #333;
    --border-color: #E0E0E0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--dark-text);
    line-height: 1.5;
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.auth-card h2 {
    color: var(--primary-color);
    margin-bottom: 8px;
}

.auth-subtitle {
    color: #666;
    margin-bottom: 16px;
    font-size: 14px;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-card label {
    font-size: 14px;
    font-weight: 600;
}

.auth-submit {
    margin-top: 8px;
}

.auth-error {
    color: var(--danger-color);
    min-height: 20px;
    font-size: 13px;
}

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

/* ========== HEADER ========== */
header.header {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-content h1 {
    font-size: 28px;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.header-content .subtitle {
    color: #666;
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: 20px;
    align-items: center;
}

.health-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--light-bg);
    border-radius: 20px;
    font-size: 14px;
}

.health-status .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ccc;
    animation: pulse 2s infinite;
}

.health-status.connected .dot {
    background-color: var(--success-color);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========== BUTTONS ========== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #1565B8;
    box-shadow: var(--shadow);
}

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

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

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

/* ========== SECTIONS ========== */
.stats-section,
.search-section,
.auctions-section,
.chart-section {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

.stats-section h2,
.search-section h2,
.auctions-section h2,
.chart-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 20px;
    border-bottom: 2px solid var(--light-bg);
    padding-bottom: 15px;
}

/* ========== STATS GRID ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.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: 32px;
    font-weight: bold;
    margin-bottom: 10px;
}

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

/* ========== SEARCH & FILTERS ========== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(24, 103, 192, 0.1);
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    align-items: center;
}

.filter-select,
.filter-input,
.limit-select {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.filter-select:focus,
.filter-input:focus,
.limit-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(24, 103, 192, 0.1);
}

/* ========== CONTROLS & PAGINATION ========== */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

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

#pageInfo {
    min-width: 80px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
}

/* ========== TABLE ========== */
.table-responsive {
    overflow-x: auto;
}

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

.auctions-table thead {
    background-color: var(--light-bg);
}

.auctions-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
}

.auctions-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

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

.auctions-table tbody tr:hover {
    background-color: var(--light-bg);
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

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

.status-badge.completed {
    background-color: #cfe2ff;
    color: #084298;
}

.status-badge.upcoming {
    background-color: #fff3cd;
    color: #664d03;
}

.text-center {
    text-align: center;
}

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

.btn-small-view {
    padding: 6px 12px;
    font-size: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small-view:hover {
    background-color: #1565B8;
}

/* ========== CHARTS ========== */
.chart-section {
    display: grid;
    grid-template-columns: 1fr;
}

.chart-placeholder {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-bg);
    border-radius: 8px;
    position: relative;
}

canvas {
    max-height: 300px;
}

/* ========== 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 ease;
}

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

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

.close:hover,
.close:focus {
    color: var(--dark-text);
}

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

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    header.header {
        flex-direction: column;
        text-align: center;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
    }

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

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

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .auctions-table {
        font-size: 13px;
    }

    .auctions-table th,
    .auctions-table td {
        padding: 10px;
    }

    .modal-content {
        width: 95%;
        margin: 20% auto;
    }
}

/* ========== UTILITIES ========== */
.text-muted {
    color: #6c757d;
}

.font-small {
    font-size: 12px;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid #f5c6cb;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid #c3e6cb;
}

/* ========== AUTH SWITCH LINK ========== */
.auth-switch {
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    color: #666;
}
.auth-switch a { color: var(--primary-color); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* ========== ADMIN PANEL ========== */
.admin-panel {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 28px;
    overflow: hidden;
}

.admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    background: var(--light-bg);
}

.admin-tab {
    background: none;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.admin-tab:hover  { color: var(--primary-color); }
.admin-tab.active { color: var(--primary-color); border-bottom-color: var(--primary-color); background: white; }

.admin-tab-content { padding: 20px; }

.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}
.admin-section-header h3 { margin: 0; font-size: 16px; }

/* ========== INVITE CODE ========== */
code.invite-code {
    font-family: 'Courier New', monospace;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 2px;
    background: #f0f4ff;
    color: var(--primary-color);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #c5d0f5;
}
