/* Quiz Admin Portal Styles */

/* Reset & Base */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; 
    background: #f5f5f5; 
}

#app { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 20px; 
}

/* Header */
.header { 
    background: white; 
    padding: 20px; 
    border-radius: 8px; 
    margin-bottom: 20px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

.header h1 { 
    color: #333; 
    margin-bottom: 10px; 
}

.user-info { 
    color: #666; 
    font-size: 14px; 
}

.logout-btn { 
    float: right; 
    padding: 8px 16px; 
    background: #dc3545; 
    color: white; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
}

.logout-btn:hover { 
    background: #c82333; 
}

/* Login */
.login-container { 
    max-width: 400px; 
    margin: 100px auto; 
    background: white; 
    padding: 40px; 
    border-radius: 8px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); 
}

.login-container h2 { 
    margin-bottom: 30px; 
    color: #333; 
    text-align: center; 
}

/* Forms */
.form-group { 
    margin-bottom: 20px; 
}

.form-group label { 
    display: block; 
    margin-bottom: 5px; 
    color: #555; 
    font-weight: 500; 
}

.form-group input { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #ddd; 
    border-radius: 4px; 
    font-size: 14px; 
}

.form-group input:focus { 
    outline: none; 
    border-color: #007bff; 
}

/* Buttons */
.btn { 
    width: 100%; 
    padding: 12px; 
    background: #007bff; 
    color: white; 
    border: none; 
    border-radius: 4px; 
    font-size: 16px; 
    cursor: pointer; 
}

.btn:hover { 
    background: #0056b3; 
}

.btn:disabled { 
    background: #ccc; 
    cursor: not-allowed; 
}

.btn-small { 
    padding: 6px 12px; 
    font-size: 14px; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
}

.btn-primary { 
    background: #007bff; 
    color: white; 
}

.btn-success { 
    background: #28a745; 
    color: white; 
}

.btn-danger { 
    background: #dc3545; 
    color: white; 
}

.btn-small:hover { 
    opacity: 0.9; 
}

/* Messages */
.error { 
    color: #dc3545; 
    font-size: 14px; 
    margin-top: 10px; 
}

.success { 
    color: #28a745; 
    font-size: 14px; 
    margin-top: 10px; 
}

/* Tabs */
.tabs { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 20px; 
}

.tab { 
    padding: 10px 20px; 
    background: white; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
    font-size: 14px; 
}

.tab.active { 
    background: #007bff; 
    color: white; 
}

/* Content */
.content { 
    background: white; 
    padding: 20px; 
    border-radius: 8px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

/* Lists */
.template-list { 
    list-style: none; 
}

.template-item { 
    padding: 15px; 
    border-bottom: 1px solid #eee; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.template-item:last-child { 
    border-bottom: none; 
}

.template-actions { 
    display: flex; 
    gap: 10px; 
}

/* Modal */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.5); 
    z-index: 1000; 
}

.modal.active { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.modal-content { 
    background: white; 
    padding: 30px; 
    border-radius: 8px; 
    max-width: 500px; 
    width: 90%; 
    max-height: 80vh; 
    overflow-y: auto; 
}

.modal-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
}

.modal-close { 
    background: none; 
    border: none; 
    font-size: 24px; 
    cursor: pointer; 
    color: #999; 
}

/* QR Code */
.qr-code { 
    text-align: center; 
    margin: 20px 0; 
}

.qr-code img { 
    max-width: 300px; 
    border: 2px solid #ddd; 
    border-radius: 8px; 
}

.session-code { 
    font-size: 32px; 
    font-weight: bold; 
    color: #007bff; 
    text-align: center; 
    margin: 20px 0; 
    letter-spacing: 4px; 
}

/* Drag & Drop */
.template-item.dragging {
    opacity: 0.5;
    background: #f0f0f0;
}

.template-item[draggable="true"]:hover {
    background: #f8f9fa;
}


/* Admin Management Styles */
.admin-management {
    padding: 20px;
}

.admin-list table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.admin-list th,
.admin-list td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.admin-list th {
    background-color: #f5f5f5;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 4px;
}

.badge-primary {
    background-color: #007bff;
    color: white;
}

.badge-danger {
    background-color: #dc3545;
    color: white;
}

.badge-success {
    background-color: #28a745;
    color: white;
}

.badge-warning {
    background-color: #ffc107;
    color: #000;
}

.badge-secondary {
    background-color: #6c757d;
    color: white;
}

/* Category Manager Styles */
.category-manager {
    padding: 20px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.category-card {
    background: white;
    border: 1px solid #ddd;
    border-left: 4px solid #007bff;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.2s;
}

.category-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.category-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}

.category-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.category-info h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #333;
}

.category-info p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

.category-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.color-picker {
    display: flex;
    gap: 10px;
    align-items: center;
}

.form-control-color {
    width: 60px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state i {
    color: #ccc;
    margin-bottom: 20px;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.modal-sm {
    max-width: 400px;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
}

.form-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

textarea.form-control {
    resize: vertical;
    font-family: inherit;
}

select.form-control {
    cursor: pointer;
}

/* Alert Styles */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Button Styles */
.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

.btn-warning {
    background-color: #ffc107;
    color: #000;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading i {
    font-size: 24px;
    margin-right: 10px;
}

/* Text Utilities */
.text-muted {
    color: #6c757d;
}

/* Tab Icons */
.tabs .tab i {
    margin-right: 8px;
}


/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

/* Category Badge */
.category-badge {
    display: inline-block;
    padding: 4px 10px;
    margin-left: 10px;
    background: #007bff;
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* Tag Manager Styles */
.tag-manager {
    padding: 20px;
}

.tag-manager .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tag-manager .header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.tag-card {
    background: white;
    border: 1px solid #ddd;
    border-left: 4px solid #28a745;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tag-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.tag-info {
    flex: 1;
}

.tag-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.tag-name i {
    color: #28a745;
    margin-right: 8px;
}

.tag-meta {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 14px;
    color: #666;
}

.tag-count i {
    margin-right: 5px;
}

.tag-actions {
    display: flex;
    gap: 8px;
}

/* Question Pool Manager Styles */
.pool-manager {
    padding: 20px;
}

.pool-manager .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.pool-manager .header h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.filter-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.filter-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.tag-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.tag-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag-checkbox input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.tag-checkbox label {
    cursor: pointer;
    margin: 0;
    font-weight: normal;
    color: #555;
}

.tag-checkbox label i {
    color: #28a745;
    margin-right: 5px;
}

.questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.question-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.2s;
}

.question-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.difficulty-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.difficulty-easy {
    background-color: #d4edda;
    color: #155724;
}

.difficulty-medium {
    background-color: #fff3cd;
    color: #856404;
}

.difficulty-hard {
    background-color: #f8d7da;
    color: #721c24;
}

.question-text {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.5;
}

.question-options {
    margin-bottom: 15px;
}

.question-options .option {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
    color: #555;
}

.question-options .option.correct {
    background: #d4edda;
    color: #155724;
    font-weight: 500;
}

.question-options .option i {
    margin-right: 8px;
}

.question-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.tag-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #28a745;
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.tag-badge i {
    margin-right: 5px;
}

.question-meta {
    font-size: 12px;
    color: #999;
    margin-top: 10px;
}

.question-actions {
    display: flex;
    gap: 8px;
}

/* Answer Option Input */
.answer-option {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.answer-option input[type="checkbox"] {
    width: auto;
    flex-shrink: 0;
}

.answer-option input[type="text"] {
    flex: 1;
}

/* Tag Selection */
.tag-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

/* Modal Large */
.modal-large {
    max-width: 800px;
}

/* Error Message */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 15px;
    border: 1px solid #f5c6cb;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}


/* ========================================================================
   RESPONSIVE / MOBILE STYLES - Clean rebuild based on desktop
   ======================================================================== */

@media (max-width: 768px) {
    #app {
        padding: 10px;
    }

    .header {
        padding: 15px;
    }

    .header h1 {
        font-size: 22px;
    }

    .user-info {
        font-size: 13px;
    }

    .logout-btn {
        padding: 8px 16px;
        font-size: 14px;
    }

    .login-container {
        margin: 20px auto;
        padding: 25px;
        width: 95%;
    }

    .tabs {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .tab {
        padding: 12px 10px;
        font-size: 14px;
    }

    .content {
        padding: 15px;
    }

    .section-header {
        flex-direction: column;
        gap: 12px;
    }

    .section-header .btn {
        width: 100%;
    }

    .template-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .template-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .category-grid {
        grid-template-columns: 1fr;
    }

    .questions-grid {
        grid-template-columns: 1fr;
    }

    .tags-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        max-width: none;
        padding: 20px;
        margin: 10px;
    }

    .modal-footer {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px; /* Prevents iOS zoom */
    }

    .qr-code img {
        max-width: 280px;
        width: 100%;
    }

    .session-code {
        font-size: 32px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 20px;
    }

    .tabs {
        grid-template-columns: 1fr;
    }

    .tab {
        font-size: 15px;
    }

    .modal-content {
        padding: 15px;
    }

    .qr-code img {
        max-width: 240px;
    }

    .session-code {
        font-size: 28px;
    }
}


