/* Custom CSS for Content Management Platform */

/* Dark mode variables */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --accent-color: #3b82f6;
}

[data-theme="dark"] {
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border-color: #374151;
    --accent-color: #60a5fa;
}

/* Loading animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0,0,0);
    }
    40%, 43% {
        transform: translate3d(0,-30px,0);
    }
    70% {
        transform: translate3d(0,-15px,0);
    }
    90% {
        transform: translate3d(0,-4px,0);
    }
}

/* Utility classes */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

.pulse-animation {
    animation: pulse 2s infinite;
}

.bounce-animation {
    animation: bounce 2s infinite;
}

/* Custom components */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease-in-out;
}

.card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.btn {
    @apply px-4 py-2 rounded-lg font-medium transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2;
}

.btn-primary {
    @apply bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500;
}

.btn-secondary {
    @apply bg-gray-200 text-gray-900 hover:bg-gray-300 focus:ring-gray-500;
}

.btn-success {
    @apply bg-green-600 text-white hover:bg-green-700 focus:ring-green-500;
}

.btn-danger {
    @apply bg-red-600 text-white hover:bg-red-700 focus:ring-red-500;
}

.btn-warning {
    @apply bg-yellow-600 text-white hover:bg-yellow-700 focus:ring-yellow-500;
}

/* Form elements */
.form-input {
    @apply block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500;
}

.form-select {
    @apply block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500;
}

.form-textarea {
    @apply block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500;
}

/* Dark mode form elements */
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea {
    @apply bg-gray-700 border-gray-600 text-white placeholder-gray-400;
}

/* Navigation */
.nav-link {
    transition: all 0.2s ease-in-out;
}

.nav-link:hover {
    transform: translateX(4px);
}

.nav-link.active {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
}

/* Charts container */
.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

/* Progress bars */
.progress-bar {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    height: 8px;
    border-radius: 4px;
    transition: width 0.5s ease-in-out;
}

/* Badges */
.badge {
    @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
}

.badge-success {
    @apply bg-green-100 text-green-800;
}

.badge-warning {
    @apply bg-yellow-100 text-yellow-800;
}

.badge-danger {
    @apply bg-red-100 text-red-800;
}

.badge-info {
    @apply bg-blue-100 text-blue-800;
}

/* Dark mode badges */
[data-theme="dark"] .badge-success {
    @apply bg-green-900 text-green-300;
}

[data-theme="dark"] .badge-warning {
    @apply bg-yellow-900 text-yellow-300;
}

[data-theme="dark"] .badge-danger {
    @apply bg-red-900 text-red-300;
}

[data-theme="dark"] .badge-info {
    @apply bg-blue-900 text-blue-300;
}

/* Tables */
.table {
    @apply min-w-full divide-y divide-gray-200;
}

.table th {
    @apply px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider;
}

.table td {
    @apply px-6 py-4 whitespace-nowrap text-sm text-gray-900;
}

[data-theme="dark"] .table th {
    @apply bg-gray-800 text-gray-300;
}

[data-theme="dark"] .table td {
    @apply text-gray-300;
}

/* Modals */
.modal-overlay {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    animation: fadeIn 0.3s ease-out;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 12px 16px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    min-width: 300px;
    max-width: 500px;
    animation: slideInRight 0.3s ease-out;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.notification.info {
    background-color: #3b82f6;
}

.notification.success {
    background-color: #10b981;
}

.notification.warning {
    background-color: #f59e0b;
}

.notification.error {
    background-color: #ef4444;
}

/* Skeleton loading */
.skeleton {
    @apply bg-gray-200 rounded;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

[data-theme="dark"] .skeleton {
    @apply bg-gray-700;
}

/* Achievement badges */
.achievement-badge {
    position: relative;
    display: inline-block;
    padding: 1rem;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    animation: bounce 2s infinite;
}

.achievement-badge::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #fbbf24, #f59e0b, #fbbf24);
    border-radius: 50%;
    z-index: -1;
    animation: spin 3s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Leaderboard */
.leaderboard-item {
    transition: all 0.3s ease;
}

.leaderboard-item:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.rank-1 {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
}

.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #e5e5e5);
}

.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #daa520);
}

/* File Upload Styles */
.file-drop-zone {
    position: relative;
    transition: all 0.3s ease;
}

.file-drop-zone.dragover {
    border-color: #3b82f6 !important;
    background-color: rgba(59, 130, 246, 0.05) !important;
    transform: scale(1.02);
}

.file-drop-zone:hover {
    border-color: #6b7280;
}

.file-preview-item {
    animation: fadeIn 0.3s ease-out;
}

.file-preview-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.dark .file-preview-item:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.file-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-progress {
    animation: fadeIn 0.3s ease-out;
}

.progress-bar {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    border-radius: inherit;
}

.file-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 0.375rem;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.file-attachment:hover {
    background-color: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.file-thumbnail {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 0.25rem;
}

/* File type specific colors */
.file-type-image { color: #3b82f6; }
.file-type-video { color: #10b981; }
.file-type-audio { color: #8b5cf6; }
.file-type-pdf { color: #ef4444; }
.file-type-doc { color: #2563eb; }
.file-type-default { color: #6b7280; }

/* Image preview modal */
.image-preview-modal {
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease-out;
}

.image-preview-content {
    animation: slideInRight 0.3s ease-out;
    max-width: 90vw;
    max-height: 90vh;
}

/* File management in submissions */
.submission-files {
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
    padding-top: 1rem;
}

.submission-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Mobile responsive adjustments for file uploads */
@media (max-width: 768px) {
    .file-drop-zone {
        padding: 1.5rem;
    }
    
    .file-preview-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .submission-file-list {
        flex-direction: column;
    }
    
    .file-attachment {
        justify-content: flex-start;
    }
}

/* Enhanced hover effects for interactive elements */
.file-action-btn {
    transition: all 0.2s ease;
    opacity: 0.7;
}

.file-action-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Loading states for file operations */
.file-loading {
    position: relative;
    overflow: hidden;
}

.file-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Success and error states for file uploads */
.upload-success {
    border-color: #10b981;
    background-color: rgba(16, 185, 129, 0.05);
}

.upload-error {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.05);
}

.upload-success .file-icon,
.upload-error .file-icon {
    animation: bounce 0.6s ease-out;
}

/* Responsive design */
@media (max-width: 768px) {
    .card {
        margin: 0.5rem;
    }
    
    .notification {
        @apply left-4 right-4 max-w-none;
    }
    
    .modal-content {
        @apply mx-4;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Focus states for accessibility */
.focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .card {
        break-inside: avoid;
    }
}

/* Loading states */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Enhanced loading states */
.app-loading {
    backdrop-filter: blur(2px);
    background-color: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .app-loading {
    background-color: rgba(31, 41, 55, 0.8);
}

/* Better Font Awesome loading indicator */
.fa-loading::before {
    content: "⚠️";
    color: #f59e0b;
}

/* Tailwind CSS Fallback Classes */
.bg-blue-500 {
    background-color: #3b82f6 !important;
}

.bg-blue-600 {
    background-color: #2563eb !important;
}

.bg-white {
    background-color: #ffffff !important;
}

.bg-gray-50 {
    background-color: #f9fafb !important;
}

.bg-gray-100 {
    background-color: #f3f4f6 !important;
}

.text-white {
    color: #ffffff !important;
}

.text-gray-900 {
    color: #111827 !important;
}

.text-gray-600 {
    color: #4b5563 !important;
}

.p-4 {
    padding: 1rem !important;
}

.p-6 {
    padding: 1.5rem !important;
}

.p-8 {
    padding: 2rem !important;
}

.rounded-lg {
    border-radius: 0.5rem !important;
}

.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
}

.shadow-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

.mb-4 {
    margin-bottom: 1rem !important;
}

.mb-6 {
    margin-bottom: 1.5rem !important;
}

.mx-auto {
    margin-left: auto !important;
    margin-right: auto !important;
}

.container {
    width: 100% !important;
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

.flex {
    display: flex !important;
}

.items-center {
    align-items: center !important;
}

.justify-between {
    justify-content: space-between !important;
}

.space-x-4 > * + * {
    margin-left: 1rem !important;
}

.h-16 {
    height: 4rem !important;
}

.min-h-screen {
    min-height: 100vh !important;
}
