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

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

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

header {
    text-align: center;
    padding: 60px 20px;
    color: white;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.hero {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    margin-bottom: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #667eea;
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    color: #666;
}

#actionBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    font-weight: 600;
}

#actionBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.database-actions {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 15px;
    margin-bottom: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.database-actions h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 30px;
    color: #667eea;
}

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

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

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.stat-card h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    opacity: 0.9;
    font-weight: 500;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    display: block;
}

.stat-time {
    font-size: 1.1rem;
    font-weight: 600;
    display: block;
}

.db-controls {
    margin-bottom: 30px;
}

.form-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.form-group input {
    flex: 1;
    min-width: 200px;
    padding: 12px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

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

/* Search Controls */
.search-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

#searchInput {
    flex: 2;
    min-width: 250px;
    padding: 12px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: #667eea;
}

#sortSelect {
    padding: 12px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

#sortSelect:focus {
    outline: none;
    border-color: #667eea;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-buttons button, #addUserBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    font-weight: 600;
}

.action-buttons button:hover, #addUserBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

#clearUsersBtn {
    background: linear-gradient(135deg, #f56565 0%, #ed64a6 100%);
}

#exportBtn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

#themeToggle {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

/* Dark Mode */
body.dark-mode {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
}

body.dark-mode .database-actions,
body.dark-mode .hero,
body.dark-mode .feature {
    background: rgba(45, 55, 72, 0.95);
    color: #e2e8f0;
}

body.dark-mode .form-group input,
body.dark-mode #searchInput,
body.dark-mode #sortSelect {
    background: rgba(26, 32, 44, 0.8);
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .user-item {
    background: rgba(74, 85, 104, 0.3);
    border-left-color: #667eea;
}

body.dark-mode .user-item:hover {
    background: rgba(74, 85, 104, 0.5);
}

body.dark-mode .no-users {
    background: rgba(102, 126, 234, 0.2);
    color: #cbd5e0;
}

body.dark-mode header h1,
body.dark-mode .hero h2,
body.dark-mode .database-actions h2,
body.dark-mode .feature h3 {
    color: #667eea;
}

body.dark-mode .user-info strong {
    color: #e2e8f0;
}

body.dark-mode .user-email,
body.dark-mode .user-date {
    color: #a0aec0;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-item {
    animation: fadeIn 0.3s ease;
}

.stat-card {
    animation: fadeIn 0.5s ease;
}

/* Charts Section */
.charts-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.charts-section h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #667eea;
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    justify-content: center;
}

.charts-container canvas {
    max-width: 100%;
    height: auto;
}

/* Import/Export Controls */
.import-export-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

#perPageSelect {
    padding: 12px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

#perPageSelect:focus {
    outline: none;
    border-color: #667eea;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.pagination button {
    padding: 8px 12px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.pagination button:hover {
    background: #667eea;
    color: white;
}

.pagination button.active {
    background: #667eea;
    color: white;
}

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

/* Edit Mode */
.user-item.edit-mode {
    background: rgba(102, 126, 234, 0.1);
    border-left-color: #48bb78;
}

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

.edit-input {
    padding: 4px 8px;
    border: 1px solid #667eea;
    border-radius: 4px;
    font-size: 0.9rem;
}

.edit-btn, .save-btn, .cancel-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
}

.edit-btn {
    background: #48bb78;
    color: white;
}

.save-btn {
    background: #38a169;
    color: white;
}

.cancel-btn {
    background: #e53e3e;
    color: white;
}

/* Dark mode for charts */
body.dark-mode .charts-section {
    background: rgba(45, 55, 72, 0.95);
    color: #e2e8f0;
}

body.dark-mode .charts-section h3 {
    color: #667eea;
}

body.dark-mode .pagination button {
    border-color: #667eea;
    color: #667eea;
}

body.dark-mode .pagination button:hover {
    background: #667eea;
    color: white;
}

body.dark-mode .edit-input {
    background: rgba(26, 32, 44, 0.8);
    border-color: #667eea;
    color: #e2e8f0;
}

/* Activity indicators */
.user-item.new-user {
    animation: pulse 2s ease-in-out;
}

@keyframes pulse {
    0% { background: rgba(72, 187, 120, 0.3); }
    50% { background: rgba(72, 187, 120, 0.6); }
    100% { background: rgba(72, 187, 120, 0.3); }
}

.users-list {
    margin-top: 30px;
}

.users-list h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #667eea;
    font-size: 1.5rem;
}

.no-users {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 10px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s ease;
}

.user-item:hover {
    transform: translateX(5px);
    background: rgba(102, 126, 234, 0.1);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.user-info strong {
    color: #333;
    font-size: 1.1rem;
}

.user-email {
    color: #666;
    font-size: 0.9rem;
}

.user-date {
    color: #999;
    font-size: 0.8rem;
}

.delete-btn {
    background: linear-gradient(135deg, #f56565 0%, #ed64a6 100%);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.delete-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(245, 101, 101, 0.3);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.feature {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

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

.feature h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #667eea;
}

.feature p {
    color: #666;
    font-size: 1rem;
}

footer {
    text-align: center;
    padding: 20px;
    color: white;
    opacity: 0.8;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .hero h2 {
        font-size: 2rem;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
}
