/**
 * Admin panel styles
 */

/* Admin Layout */
.admin-container {
    min-height: 100vh;
    background-color: #f5f5f7;
}

/* Admin Navigation */
.admin-nav {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e5e7;
    padding: 0;
}

.admin-nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    gap: 2rem;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0;
    color: #666;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.admin-nav-link:hover {
    color: #333;
}

.admin-nav-link.active {
    color: #1890ff;
    border-bottom-color: #1890ff;
}

.admin-nav-link svg {
    width: 20px;
    height: 20px;
}

.admin-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e5e5e7;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.admin-header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.admin-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.breadcrumbs a {
    color: #7c3aed;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-card h3 {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 0 0 0.25rem 0;
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

/* Filters Section */
.filters-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 300px;
}

.filter-group {
    display: flex;
    gap: 1rem;
}

/* Table Styles */
.table-container {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

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

.admin-table th {
    background-color: #f9fafb;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.admin-table td {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.admin-table tbody tr:hover {
    background-color: #f9fafb;
}

.task-row {
    transition: background-color 0.2s;
}

.task-row:hover {
    background-color: #f3f4f6;
}

/* Task specific styles */
.task-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 0.25rem;
}

.task-thumb-placeholder {
    width: 50px;
    height: 50px;
    background-color: #e5e7eb;
    border-radius: 0.25rem;
}

.task-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.task-description {
    font-size: 0.875rem;
    color: #6b7280;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-points {
    background-color: #ddd6fe;
    color: #6d28d9;
}

.badge-photo {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-video {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-text {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-any {
    background-color: #e5e7eb;
    color: #374151;
}

/* AI Tools */
.ai-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    max-width: 200px;
}

.ai-tool-tag {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    background-color: #f3f4f6;
    color: #4b5563;
    border-radius: 0.25rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 0.25rem;
    border: 1px solid #e5e7eb;
    background: white;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background-color: #f9fafb;
    color: #111827;
}

.btn-icon-danger:hover {
    background-color: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}

/* Forms */
.form-container {
    max-width: 800px;
    margin: 0 auto;
}

.admin-form {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-section {
    padding: 2rem;
    border-bottom: 1px solid #e5e7eb;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

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

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-label.required::after {
    content: ' *';
    color: #ef4444;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

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

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.form-checkbox span {
    font-weight: 500;
}

/* Tag Input */
.tag-input-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background-color: #e0e7ff;
    color: #4338ca;
    border-radius: 9999px;
    font-size: 0.875rem;
}

.tag-remove {
    background: none;
    border: none;
    color: #6366f1;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
}

/* Image Upload */
.image-upload-container {
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    overflow: hidden;
}

.image-upload-area {
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.image-upload-area:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

.image-upload-area.drag-over {
    background-color: #e0e7ff;
    border-color: #6366f1;
}

.image-upload-area svg {
    margin: 0 auto 1rem;
    color: #9ca3af;
}

.image-preview {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.image-preview img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
}

.image-preview .btn {
    position: static;
    align-self: center;
}

/* Button styles for admin panel */
.btn-danger {
    background-color: #dc2626;
    color: white;
    border: 1px solid #dc2626;
}

.btn-danger:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
    transform: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Metadata */
.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.metadata-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metadata-label {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

.metadata-value {
    font-size: 0.875rem;
    color: #111827;
}

/* Form Actions */
.form-actions {
    padding: 1.5rem 2rem;
    background-color: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-radius: 0 0 0.5rem 0.5rem;
}

/* States */
.loading-state,
.empty-state,
.error-state {
    text-align: center;
    padding: 4rem 2rem;
}

.loading-state svg,
.empty-state svg,
.error-state svg {
    margin: 0 auto 1rem;
    color: #9ca3af;
}

.empty-state h3,
.error-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.empty-state p,
.error-state p {
    color: #6b7280;
    margin: 0 0 1.5rem 0;
}

.empty-state-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
}

.modal-content p {
    color: #6b7280;
    margin: 0 0 1.5rem 0;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(1rem);
    transition: all 0.3s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    border-left: 4px solid #10b981;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

/* Loading state for buttons */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #e5e7eb;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .admin-header h1 {
        font-size: 1.25rem;
    }
    
    .admin-header-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-card h3 {
        font-size: 0.625rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .filters-section {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-table {
        font-size: 0.875rem;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}