/* Fun and Engaging Study Assistant Styles */

/* Global Enhancements */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

/* Animated Background Particles */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 107, 107, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(78, 205, 196, 0.3) 0%, transparent 50%);
    z-index: -2;
    animation: backgroundPulse 8s ease-in-out infinite;
}

@keyframes backgroundPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* Floating Animation */
@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(2deg); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% { transform: translateY(0); }
    40%, 43% { transform: translateY(-15px); }
    70% { transform: translateY(-5px); }
}

/* 3D Flashcard Flip Animation */
.flashcard-container {
    perspective: 1000px;
}

.flashcard {
    position: relative;
    width: 100%;
    min-height: 350px;
    transform-style: preserve-3d;
    transition: transform 0.6s ease-in-out;
    cursor: pointer;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    min-height: 350px;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.flashcard-back {
    transform: rotateY(180deg);
}

/* Ensure the card content is properly aligned */
.flashcard-front h3,
.flashcard-back h3 {
    text-align: left !important;
    direction: ltr !important;
    font-size: 1.3rem !important;
    line-height: 1.5 !important;
    font-weight: normal !important;
}

/* Main Content Area */
main {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px 25px 0 0;
    box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.8s ease-out;
}

/* Enhanced Navbar */
.navbar {
    backdrop-filter: blur(20px);
    animation: fadeInUp 0.6s ease-out;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.navbar:hover {
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

/* Enhanced Navbar Brand */
.navbar-brand {
    font-weight: 700 !important;
    font-size: 1.5rem !important;
    text-decoration: none !important;
    transition: all 0.3s ease;
    position: relative;
}

.navbar-brand:hover {
    transform: scale(1.05);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.navbar-brand i {
    font-size: 1.3rem;
    margin-right: 0.5rem;
    animation: bounce 2s infinite;
}

/* Enhanced Nav Links */
.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    margin: 0 0.1rem;
    padding: 0.5rem 0.7rem !important;
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
    backdrop-filter: blur(5px);
    border: 1px solid transparent;
    font-size: 0.9rem;
    white-space: nowrap;
}

.navbar-nav .nav-link:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.navbar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff !important;
}

.navbar-nav .nav-link i {
    margin-right: 0.5rem;
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.navbar-nav .nav-link:hover i {
    transform: scale(1.1);
}

/* Dropdown Menu Styling */
.dropdown-menu {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    animation: fadeInUp 0.3s ease;
}

.dropdown-item {
    color: #333 !important;
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    margin: 0.2rem;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea !important;
    transform: translateX(5px);
}

.dropdown-item i {
    margin-right: 0.5rem;
    width: 20px;
    text-align: center;
}

/* Navbar Toggle Button */
.navbar-toggler {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.5rem;
    transition: all 0.3s ease;
}

.navbar-toggler:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* User Profile Dropdown */
.navbar-nav .dropdown-toggle::after {
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
}

.navbar-nav .dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

/* Timer Indicator Special Styling */
#timerIndicator .nav-link {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #ffc107 !important;
}

/* Responsive adjustments for better fit */
@media (max-width: 1200px) {
    .navbar-nav .nav-link {
        padding: 0.5rem 0.5rem !important;
        font-size: 0.85rem;
    }
    
    .navbar-nav .nav-link i {
        font-size: 1rem;
        margin-right: 0.3rem;
    }
}

@media (max-width: 991px) {
    .navbar-nav {
        background: rgba(0, 0, 0, 0.1);
        border-radius: 15px;
        padding: 1rem;
        margin-top: 1rem;
        backdrop-filter: blur(10px);
    }
    
    .navbar-nav .nav-link {
        margin: 0.2rem 0;
        padding: 0.7rem 1rem !important;
        font-size: 0.9rem;
    }
}

/* Better alignment for navbar items */
.navbar-nav {
    align-items: center;
}

.navbar-collapse {
    align-items: center;
}

/* Compact dropdown styling */
.navbar-nav .dropdown-menu {
    min-width: 200px;
}

.navbar-nav .dropdown-toggle {
    padding: 0.5rem 0.6rem !important;
}

.navbar-brand {
    animation: bounce 2s infinite;
}

.navbar-nav .nav-link {
    position: relative;
    transition: all 0.3s ease;
    border-radius: 20px;
    margin: 0 5px;
}

.navbar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Fun Button Styles */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border-radius: 25px !important;
    font-weight: 600;
    text-transform: none;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Animated Cards */
.card {
    transition: all 0.3s ease;
    border-radius: 20px !important;
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.8s ease-out;
}

.card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15) !important;
}

/* Disable hover effects for flashcard container */
.flashcard-container:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Ensure flashcard only responds to click, not hover */
.flashcard:hover {
    transform: none !important;
}

/* Remove any potential transitions that might trigger on hover */
.flashcard.flipped:hover {
    transform: rotateY(180deg) !important;
}

/* Ensure no pointer events interfere with click behavior */
.flashcard * {
    pointer-events: none;
}

.flashcard {
    pointer-events: auto;
}

/* Glowing Effect for Important Elements */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 20px rgba(102, 126, 234, 0.5); }
    to { box-shadow: 0 0 30px rgba(102, 126, 234, 0.8); }
}

/* Enhanced Stats Cards */
.stats-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.4s ease;
}

.stats-card:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    transform: translateY(-10px) scale(1.05);
}

/* Floating Icons */
.floating-icon {
    animation: float 3s ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

/* Text Gradient Effects */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.rainbow-text {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #f9ca24, #f0932b, #eb4d4b);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbow 3s ease infinite;
}

@keyframes rainbow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(102, 126, 234, 0.1);
    border-left-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Progress Bar Enhancements */
.progress {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shine 2s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Footer Enhancement */
footer {
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), transparent);
    z-index: 1;
}

footer * {
    position: relative;
    z-index: 2;
}

/* Alert Enhancements */
.alert {
    border-radius: 15px;
    border: none;
    backdrop-filter: blur(10px);
    animation: slideInDown 0.5s ease-out;
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Form Enhancements */
.form-control, .form-select {
    border-radius: 15px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

/* Quiz Enhancements */
.quiz-question {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.8s ease-out;
}

.choice-option {
    transition: all 0.3s ease;
    border-radius: 15px;
    margin: 8px 0;
}

.choice-option:hover {
    transform: translateX(10px);
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

/* Flashcard Enhancements */
.flashcard {
    perspective: 1000px;
    animation: fadeInUp 0.8s ease-out;
}

.flashcard-inner {
    /* Removed transition for instant answer display */
    transform-style: preserve-3d;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
    backface-visibility: hidden;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
}

.flashcard-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, rgba(33, 37, 41, 0.95), rgba(52, 58, 64, 0.9)) !important;
}

.flashcard-back p,
.flashcard-back h5,
.flashcard-back small {
    color: white !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .display-3 {
        font-size: 2.5rem;
    }
    
    .card {
        margin-bottom: 20px;
    }
    
    .btn-lg {
        font-size: 1rem;
        padding: 12px 25px;
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 10px;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
}

/* Interactive Elements */
.interactive-hover {
    cursor: pointer;
    transition: all 0.3s ease;
}

.interactive-hover:hover {
    transform: scale(1.05) rotate(1deg);
    filter: brightness(1.1);
}

/* Success/Error States */
.success-pulse {
    animation: successPulse 1s ease-in-out;
}

.error-shake {
    animation: errorShake 0.5s ease-in-out;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); background-color: #28a745; }
    100% { transform: scale(1); }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 10px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Enhanced flashcard back styling (no animation) */
.flashcard-container.flipped .flashcard-back {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Removed answer box transition for instant display */

.flashcard-back .answer-box {
    background: linear-gradient(145deg, rgba(255,255,255,0.2), rgba(255,255,255,0.1)) !important;
    border: 2px solid rgba(255,255,255,0.4) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2) !important;
    backdrop-filter: blur(8px) !important;
    position: relative !important;
    overflow: hidden !important;
    border-radius: 1rem !important;
    /* Removed transition for instant display */
}

.flashcard-back .answer-box:before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, rgba(102, 126, 234, 0.6), rgba(118, 75, 162, 0.6), rgba(102, 126, 234, 0.6));
    border-radius: inherit;
    z-index: -1;
    /* Removed glow animation for instant display */
}

.flashcard-back .answer-box p {
    color: #ffffff !important;
    font-size: 1.4rem !important;
    line-height: 1.5 !important;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7) !important;
    font-weight: bold !important;
    letter-spacing: 0.3px !important;
    position: relative !important;
    z-index: 1 !important;
}

@keyframes borderGlow {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.01);
    }
}

.flashcard-back .answer-box:hover {
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.3);
    transform: translateY(-2px);
}

/* Form Input Styling - Ensure Black Text on White Background */
.form-control, 
.form-select, 
input[type="text"], 
input[type="email"], 
input[type="password"], 
input[type="number"], 
input[type="url"], 
input[type="search"], 
textarea {
    color: black !important;
    background-color: white !important;
}

.form-control:focus, 
.form-select:focus, 
input[type="text"]:focus, 
input[type="email"]:focus, 
input[type="password"]:focus, 
input[type="number"]:focus, 
input[type="url"]:focus, 
input[type="search"]:focus, 
textarea:focus {
    color: black !important;
    background-color: white !important;
}

.form-control::placeholder, 
textarea::placeholder, 
input::placeholder {
    color: #6c757d !important;
}

/* Ensure all text in forms is black */
.form-label, 
label {
    color: black !important;
}

/* Special styling for collaborative notes editor */
#note-content {
    color: black !important;
    background-color: white !important;
}

/* Ensure text in modals and cards with forms is black */
.modal-body input, 
.modal-body textarea, 
.modal-body select,
.card-body input, 
.card-body textarea, 
.card-body select {
    color: black !important;
    background-color: white !important;
}