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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* Login */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.login-box {
    background: white;
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.login-box h2 {
    margin-bottom: 10px;
    color: #333;
    font-size: 2rem;
}

.login-box p {
    color: #666;
    margin-bottom: 30px;
}

#loginForm input {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

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

#loginForm button {
    width: 100%;
    padding: 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

#loginForm button:hover {
    background: #5568d3;
}

/* Admin Panel */
.admin-panel {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f5f5f5;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-bottom: 3px solid #667eea;
}

.admin-header h1 {
    font-size: 2rem;
    color: #333;
    margin: 0;
}

.admin-header p {
    color: #666;
    margin: 0;
    font-size: 0.9rem;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

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

.admin-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar Navigation */
.admin-nav {
    width: 200px;
    background: white;
    padding: 20px 0;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
}

.nav-btn {
    padding: 15px 20px;
    border: none;
    background: white;
    color: #666;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
    border-left: 4px solid transparent;
}

.nav-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.nav-btn.active {
    background: #f0f0f0;
    color: #667eea;
    border-left-color: #667eea;
    font-weight: bold;
}

/* Main Content */
.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

.tab-content h2 {
    margin-bottom: 25px;
    color: #333;
    font-size: 1.8rem;
}

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

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
}

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

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

.chart-box h3 {
    margin-bottom: 20px;
    color: #333;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.chart-label {
    min-width: 100px;
    color: #666;
    font-size: 0.9rem;
}

.chart-bar-container {
    flex: 1;
    height: 25px;
    background: #f0f0f0;
    border-radius: 5px;
    overflow: hidden;
}

.chart-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 5px;
}

.chart-value {
    min-width: 40px;
    text-align: right;
    font-weight: bold;
    color: #333;
}

/* List Controls */
.list-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input,
.genre-select {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.search-input {
    flex: 1;
    min-width: 200px;
}

.search-input:focus,
.genre-select:focus {
    outline: none;
    border-color: #667eea;
}

.btn-secondary {
    padding: 12px 20px;
    background: #f0f0f0;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #e0e0e0;
    border-color: #667eea;
}

.btn-primary {
    padding: 12px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Questions List */
.questions-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

.question-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.question-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 10px;
}

.question-header h4 {
    flex: 1;
    color: #333;
    font-size: 1.1rem;
    margin: 0;
}

.genre-badge {
    background: #667eea;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    white-space: nowrap;
    font-weight: bold;
}

.answers-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.answer-tag {
    background: #f0f0f0;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.85rem;
    color: #666;
}

.answer-tag.correct {
    background: #10b981;
    color: white;
    font-weight: bold;
}

.question-details {
    border-top: 1px solid #e0e0e0;
    padding-top: 12px;
}

.meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: #999;
}

.question-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.btn-edit,
.btn-delete {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-edit {
    background: #e3f2fd;
    color: #667eea;
    border: 1px solid #667eea;
}

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

.btn-delete {
    background: #fee;
    color: #ef4444;
    border: 1px solid #ef4444;
}

.btn-delete:hover {
    background: #ef4444;
    color: white;
}

.no-data {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 1.1rem;
}

/* Import Section */
.import-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.file-upload {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.trivia-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.file-input {
    display: none;
}

.file-label {
    padding: 15px 25px;
    background: #f0f0f0;
    border: 2px dashed #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    color: #667eea;
    transition: all 0.3s;
}

.file-label:hover {
    background: #f9f9f9;
    border-color: #5568d3;
}

#uploadStatus,
#duplicatesList {
    margin-top: 20px;
}

.upload-result {
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid;
}

.upload-result.success {
    background: #ecfdf5;
    border-color: #10b981;
    color: #065f46;
}

.upload-result.error {
    background: #fef2f2;
    border-color: #ef4444;
    color: #7f1d1d;
}

.duplicates-box {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    color: #92400e;
}

.duplicates-box h4 {
    margin-bottom: 10px;
    color: #d97706;
}

.duplicates-box ul {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

.duplicates-box li {
    padding: 5px 0;
    font-size: 0.9rem;
}

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

.csv-format h3 {
    margin-bottom: 15px;
    color: #333;
}

.csv-format pre {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.85rem;
    color: #666;
}

/* Form Styles */
.question-form {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

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

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

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.answer-input {
    margin-bottom: 10px;
}

#answersContainer,
#editAnswersContainer {
    margin-bottom: 10px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

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

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.close-btn:hover {
    color: #333;
}

#editForm {
    padding: 30px;
    border-radius: 0;
    box-shadow: none;
    background: white;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.modal-buttons button {
    flex: 1;
}

/* Responsive */

/* Request Container */
.request-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

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

.quick-request h3,
.custom-request h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.2rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.preset-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.preset-btn {
    padding: 20px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.preset-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.4);
}

.preset-btn:active {
    transform: translateY(-1px);
}

.preset-emoji {
    font-size: 2rem;
}

.preset-name {
    font-size: 0.9rem;
}

#requestStatus {
    margin-top: 20px;
}

@media (max-width: 1024px) {
    .request-container {
        grid-template-columns: 1fr;
    }
    
    .preset-buttons {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }
    
    .admin-nav {
        width: 100%;
        display: flex;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        overflow-x: auto;
    }
    
    .nav-btn {
        flex: 1;
        border-left: none;
        border-bottom: 4px solid transparent;
    }
    
    .nav-btn.active {
        border-left: none;
        border-bottom-color: #667eea;
    }
    
    .questions-list {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
