/**
 * Main stylesheet for the Teacher-Student Music Platform
 */

:root {
    --primary-color: #4a6fdc;
    --secondary-color: #5a8dee;
    --accent-color: #ff9900;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Global styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: var(--light-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--secondary-color);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.card {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
    border: none;
}

.card-header {
    background-color: white;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    font-weight: bold;
}

/* Navigation */
.navbar {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    padding: 0.7rem 1rem;
}

.navbar-brand {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.3rem;
}

/* Beta label styling */
.beta-label {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b6b, #ffa500);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 8px;
    vertical-align: top;
    position: relative;
    top: -2px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
    animation: pulse-beta 2s infinite;
}

@keyframes pulse-beta {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* Profile */
.profile-pic {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Profile dropdown in navbar */
.navbar .dropdown-toggle::after {
    display: inline-block;
    margin-left: 0.5rem;
    vertical-align: middle;
    content: "";
    border-top: 0.3em solid;
    border-right: 0.3em solid transparent;
    border-bottom: 0;
    border-left: 0.3em solid transparent;
}

/* Navbar dropdown menu positioning and visibility */
.navbar .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    z-index: 1050;
    min-width: 200px;
    margin-top: 0.125rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.15s ease-in-out;
}

.navbar .dropdown-menu.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    display: block !important;
}

/* Timeline */
.timeline {
    position: relative;
    margin: 40px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 20px;
    width: 3px;
    background: var(--primary-color);
    opacity: 0.3;
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
    padding-left: 45px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 12px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
}

.timeline-date {
    display: block;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.timeline-content {
    background: white;
    padding: 18px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.timeline-title {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 1.2rem;
}

/* Lesson Editor */
.lesson-editor {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
}

.lesson-section {
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 20px;
    background: #f9f9f9;
}

.lesson-section-title {
    font-weight: bold;
    margin-bottom: 10px;
}

.lesson-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Upload previews */
.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.upload-item {
    position: relative;
    width: 110px;
    height: 110px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.upload-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-item .upload-type {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
}

.upload-item .upload-remove {
    position: absolute !important;
    bottom: 5px !important;
    right: 5px !important;
    background: rgba(220,53,69,0.9) !important;
    color: white !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    z-index: 20 !important; /* Ensure it's above PDF links */
    box-shadow: 0 0 4px rgba(0,0,0,0.5) !important; /* Add shadow for visibility */
    opacity: 1 !important;
    transition: transform 0.2s ease, opacity 0.2s ease !important;
}

/* Make the X more visible */
.upload-item .upload-remove i {
    font-size: 16px !important;
    font-weight: bold !important;
}

/* Add hover effect for better UX */
.upload-item .upload-remove:hover {
    transform: scale(1.1) !important;
    opacity: 1 !important;
    background: rgba(220,53,69,1) !important;
}

/* Specifically for PDF files, position the delete button better */
.upload-item.pdf-file .upload-remove {
    top: 5px !important;
    right: 5px !important;
    bottom: auto !important;
}

/* Enhanced PDF symbol styling - Full PDF icon replacement */
.upload-item.pdf-file {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #dc3545, #b02a37) !important;
    border: 2px solid #dc3545 !important;
    border-radius: 8px !important;
    overflow: visible !important; /* Allow filename to show below */
    width: 150px !important;
    height: 110px !important;
    margin-bottom: 30px !important; /* Space for filename */
}

.upload-item.pdf-file img {
    display: none !important; /* Hide broken PDF icon image */
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
}

/* Hide the default upload-type badge for PDF files since we have a custom one */
.upload-item.pdf-file .upload-type {
    display: none !important;
}

.upload-item.pdf-file::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 50px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10;
}

.upload-item.pdf-file::after {
    content: "PDF";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: bold;
    color: #dc3545;
    z-index: 11;
    text-align: center;
    line-height: 1;
    pointer-events: none;
}

/* Ensure links inside PDF items are clickable */
.upload-item.pdf-file a {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 12 !important;
    background: transparent !important;
    pointer-events: auto !important;
}

/* Add file name display below PDF icon for teacher portal */
.upload-item.pdf-file .pdf-filename {
    position: absolute !important;
    bottom: -25px !important;
    left: 0 !important;
    right: 0 !important;
    background: rgba(220, 53, 69, 0.9) !important;
    color: white !important;
    padding: 4px 6px !important;
    font-size: 10px !important;
    text-align: center !important;
    border-radius: 0 0 4px 4px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    z-index: 13 !important;
    pointer-events: none !important;
    min-height: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Special handling for archived PDF files */
.upload-item.pdf-file.archived-file {
    background: linear-gradient(135deg, #6c757d, #495057) !important;
    border: 2px solid #6c757d;
    opacity: 0.8;
}

.upload-item.pdf-file.archived-file::before {
    background: rgba(255, 255, 255, 0.9);
}

.upload-item.pdf-file.archived-file::after {
    color: #6c757d;
}

/* Archive icon indicator */
.upload-item.archived-file {
    opacity: 0.7;
    filter: grayscale(0.3);
}

.upload-item.archived-file .upload-type {
    background: rgba(108, 117, 125, 0.8);
}

.upload-item.archived-file::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 8px;
    width: 16px;
    height: 16px;
    background: rgba(108, 117, 125, 0.9);
    border-radius: 2px;
    z-index: 2;
}

.upload-item.archived-file::after {
    content: "📁";
    position: absolute;
    top: 6px;
    left: 9px;
    font-size: 12px;
    z-index: 3;
}

/* File previews */
.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.file-preview-item {
    width: 90px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: var(--transition);
}

.file-preview-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.file-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-type-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Enhanced PDF styling for file previews - Full PDF icon replacement */
.file-preview-item.pdf-file {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #dc3545, #b02a37) !important;
    border: 2px solid #dc3545 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    width: 90px !important;
    height: 90px !important;
}

.file-preview-item.pdf-file img {
    display: none !important; /* Hide broken PDF icon image */
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
}

.file-preview-item.pdf-file::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 38px;
    background: white;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10;
}

.file-preview-item.pdf-file::after {
    content: "PDF";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: bold;
    color: #dc3545;
    z-index: 11;
    text-align: center;
    line-height: 1;
    pointer-events: none;
}

/* Special handling for archived PDF files */
.file-preview-item.pdf-file.archived-file {
    background: linear-gradient(135deg, #6c757d, #495057) !important;
    border: 2px solid #6c757d;
    opacity: 0.8;
}

.file-preview-item.pdf-file.archived-file::before {
    background: rgba(255, 255, 255, 0.9);
}

.file-preview-item.pdf-file.archived-file::after {
    color: #6c757d;
}

/* Archive styling for file previews */
.file-preview-item.archived-file {
    opacity: 0.6;
    filter: grayscale(0.4);
}

.file-preview-item.archived-file .file-type-badge {
    background: rgba(108, 117, 125, 0.8);
}

.file-preview-item.archived-file::before {
    content: "📁";
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 14px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 2px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.archived-label {
    color: #757575; /* Grey color */
    font-style: italic;
    margin-right: 5px;
    font-size: 0.8em; /* Smaller font size */
    display: block; /* Ensure it takes its own line or use inline-block if preferred */
    text-align: center; /* Center if block */
}

/* Enhanced file source badge */
.file-source-badge {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(52, 144, 220, 0.9);
    color: white;
    font-size: 8px;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.file-source-badge.central {
    background: linear-gradient(45deg, #28a745, #20c997);
}

.file-source-badge.lesson {
    background: linear-gradient(45deg, #007bff, #6610f2);
}

/* Trophies */
.trophy-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.trophy-item {
    position: relative;
    width: 80px;
    text-align: center;
    transition: var(--transition);
}

.trophy-item:hover {
    transform: translateY(-2px);
}

.trophy-icon {
    font-size: 32px;
    margin-bottom: 5px;
    color: var(--accent-color);
}

.trophy-title {
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trophy-date {
    font-size: 9px;
    color: #666;
}

/* Student list */
.student-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.student-card {
    display: flex;
    flex-direction: column;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    height: 100%;
}

.student-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.student-card-header {
    padding: 12px 15px;
    background-color: var(--primary-color);
    color: white;
}

.student-card-body {
    padding: 15px;
    background-color: white;
    flex-grow: 1;
}

.student-card-body img.rounded-circle,
.student-profile-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border: 2px solid var(--light-color);
}

.student-card-footer {
    padding: 10px 15px;
    background-color: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Floating Feedback Button */
.floating-feedback-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1050;
    transition: all 0.3s ease;
}

.floating-feedback-btn button {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.floating-feedback-btn button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0, 123, 255, 0.4);
}

.floating-feedback-btn .feedback-text {
    display: inline;
}

/* Hide text on small screens to save space */
@media (max-width: 768px) {
    .floating-feedback-btn {
        bottom: 20px;
        right: 20px;
    }
    
    .floating-feedback-btn button {
        padding: 12px;
        border-radius: 50% !important;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .floating-feedback-btn .feedback-text {
        display: none;
    }
}

/* Feedback Modal Enhancements */
.modal-content {
    border: none;
    border-radius: 15px;
    overflow: hidden;
}

.modal-header.bg-primary {
    border-bottom: none;
}

.text-purple {
    color: #6f42c1 !important;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
}

/* Pulse animation for feedback button */
@keyframes pulse-feedback {
    0% {
        box-shadow: 0 4px 20px rgba(0, 123, 255, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(0, 123, 255, 0.6);
    }
    100% {
        box-shadow: 0 4px 20px rgba(0, 123, 255, 0.3);
    }
}

.floating-feedback-btn button:focus {
    animation: pulse-feedback 1.5s infinite;
}

/* Ensure the button doesn't interfere with other elements */
.floating-feedback-btn {
    pointer-events: auto;
}

.floating-feedback-btn button {
    pointer-events: auto;
}

/* Additional spacing for the footer to avoid overlap */
footer {
    margin-bottom: 80px;
}

@media (max-width: 768px) {
    footer {
        margin-bottom: 70px;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .timeline::before {
        left: 15px;
    }
    
    .timeline-item {
        padding-left: 35px;
    }
    
    .timeline-item::before {
        left: 7px;
    }
    
    .student-list {
        grid-template-columns: 1fr;
    }
    
    .file-preview-item {
        width: 80px;
        height: 80px;
    }
    
    .trophy-list {
        justify-content: center;
    }
    
    .card-body {
        padding: 15px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e6e6e6;
    }
    
    .card, .timeline-content, .lesson-editor {
        background-color: #2a2a2a;
        color: #e6e6e6;
    }
    
    .card-header {
        background-color: #2a2a2a;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .navbar {
        background-color: #2a2a2a;
    }
    
    .student-card-body {
        background-color: #2a2a2a;
    }
    
    .student-card-footer {
        background-color: #333;
    }
}

/* Feedback Category Selection Styles */
.feedback-category {
    cursor: pointer;
    transition: all 0.3s ease;
}

.feedback-category:hover .hover-shadow {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.feedback-category .hover-shadow {
    transition: all 0.3s ease;
    border: 2px solid #dee2e6;
}

.feedback-category:active .hover-shadow {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Form validation styles */
.form-control:invalid {
    border-color: var(--danger-color);
}

.form-control:valid {
    border-color: var(--success-color);
}

/* Character counter styles */
.text-warning {
    color: var(--warning-color) !important;
}

/* Loading spinner */
.fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success and error message improvements */
.alert {
    border-radius: 10px;
    border: none;
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

.alert-info {
    background-color: rgba(23, 162, 184, 0.1);
    color: var(--info-color);
    border-left: 4px solid var(--info-color);
}

/* Modal improvements */
.modal-dialog-lg {
    max-width: 800px;
}

/* Footer spacing improvements */
.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background-color: #f8f9fa;
}

/* Form improvements */
.form-label {
    font-weight: 600;
    color: var(--dark-color);
}

.form-text {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Button improvements */
.btn-outline-danger:hover,
.btn-outline-info:hover,
.btn-outline-success:hover {
    color: white;
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 10px;
    }
    
    .feedback-category .hover-shadow {
        padding: 20px 15px !important;
    }
    
    .feedback-category h6 {
        font-size: 14px;
    }
    
    .feedback-category .small {
        font-size: 12px;
    }
}

/* File name display styles */
.file-name-display {
    font-size: 11px;
    color: #666;
    text-align: center;
    margin-top: 5px;
    padding: 2px 4px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-weight: 500;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.file-name-display:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

/* Dark mode support for file name display */
@media (prefers-color-scheme: dark) {
    .file-name-display {
        background: rgba(255, 255, 255, 0.1);
        color: #ccc;
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    .file-name-display:hover {
        background: rgba(255, 255, 255, 0.2);
        color: #fff;
    }
}

/* Make sure PDF links don't cover the entire item */
.upload-item.pdf-file a.pdf-link {
    display: block !important;
    width: calc(100% - 30px) !important; /* Leave space for delete button */
    height: calc(100% - 30px) !important; /* Leave space for delete button */
    position: relative !important;
    z-index: 15 !important; /* Below the delete button but above other content */
}

/* Glossary Terms Styling */
.glossary-term {
    color: #333;
    text-decoration: underline;
    text-decoration-style: solid;
    text-decoration-color: #ffc107;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 2px 4px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 193, 7, 0.1) 100%);
    border: 1px solid rgba(255, 193, 7, 0.3);
    font-weight: 500;
    position: relative;
    margin: 0 1px;
}

.glossary-term::before {
    content: "📖";
    font-size: 0.8em;
    margin-right: 2px;
    opacity: 0.7;
}

.glossary-term:hover {
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.25) 0%, rgba(255, 193, 7, 0.15) 100%);
    border-color: rgba(255, 193, 7, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
    text-decoration-color: #e0a800;
    color: #333;
}

.glossary-term:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(255, 193, 7, 0.4);
}

.glossary-definition {
    line-height: 1.6;
}

.glossary-definition h6 {
    color: var(--warning-color);
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Responsive adjustments */
