@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary-color: #6D28D9; /* Deep Purple */
    --secondary-color: #EC4899; /* Vibrant Pink */
    --accent-color: #10B981; /* Emerald Green */
    --bg-light: #F8FAFC; /* Light Slate */
    --text-primary: #0F172A; /* Slate 900 */
    --text-secondary: #475569; /* Slate 600 */
    --border-color: #CBD5E1;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -2;
    background: linear-gradient(45deg, #e0c3fc, #8ec5fc, #f0e68c, #ff9a9e);
    background-size: 400% 400%;
    animation: gradientBG 25s ease infinite;
}

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

main {
    padding-top: 5rem !important;
}

/* --- Header & Navigation --- */
header {
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-md);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 50;
    transition: all 0.3s ease-in-out;
}

.logo-text {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

nav a {
    position: relative;
    transition: color 0.3s ease;
}

nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 50%;
    background-image: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    transition: all 0.3s ease-out;
}

nav a:hover::after {
    width: 100%;
    left: 0;
}

/* --- Buttons --- */
.btn {
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.65rem 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    transform: translateY(0);
    border: none;
    cursor: pointer;
}
.btn:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn-primary {
    color: white;
    background: linear-gradient(to right, var(--primary-color), #8B5CF6);
}
.btn-secondary {
    color: white;
    background: linear-gradient(to right, var(--secondary-color), #F472B6);
}
.btn-secondary-outline {
    background-color: transparent;
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
}
.btn-secondary-outline:hover {
    background-color: var(--secondary-color);
    color: white;
}
.btn-accent {
    color: white;
    background: linear-gradient(to right, var(--accent-color), #34D399);
}

/* --- Cards & Containers --- */
.content-card {
    background-color: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.note-card {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease-out;
}

.project-card {
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.project-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* --- Forms --- */
.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease-in-out;
    color: var(--text-primary);
}
.form-input-minimal {
    border: 1px solid #e2e8f0;
    padding: 0.5rem 0.75rem;
    background-color: #f8fafc;
    border-radius: 0.375rem;
}
.form-input::placeholder, .form-textarea::placeholder {
    color: #94A3B8;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.2);
}

/* --- File Input & Spinner --- */
.form-input-file {
    display: block;
    width: 100%;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.form-input-file::file-selector-button {
    font-weight: 600;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--primary-color);
    background-color: #EDE9FE;
}
.form-input-file::file-selector-button:hover {
    background-color: #DDD6FE;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #DDD6FE;
    border-bottom-color: var(--primary-color);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}
@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Tag & Contributor Styles --- */
.tag, .contributor-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    line-height: 1.25;
}
.tag {
    background-color: #FBCFE8; /* Pink 200 */
    color: #9D174D; /* Pink 800 */
}
.contributor-tag {
    background-color: #C7D2FE; /* Indigo 200 */
    color: #3730A3; /* Indigo 800 */
}
.tag-suggestion {
    border: 1px solid #A5B4FC;
    color: #4338CA;
    background-color: #E0E7FF;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.tag-suggestion:hover {
    background-color: #C7D2FE;
}

/* --- Animations & Modals --- */
.modal-animated {
    animation: fadeInScale 0.3s cubic-bezier(0.165, 0.840, 0.440, 1.000);
}
@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.card-reveal {
    transition: all 0.7s ease-out;
   
    transform: translateY(20px);
}
.card-reveal.reveal {
    opacity: 1;
    transform: translateY(0);
}

/* SVG logo animations */
.weave-path { stroke-dasharray: 270; stroke-dashoffset: 270; animation: weave 5s ease-in-out infinite; }
.weave-path-2 { animation-delay: -2.5s; }
@keyframes weave { 0% { stroke-dashoffset: 270; } 50% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -270; } }
.center-sparkle { animation: sparkle 3s ease-in-out infinite; transform-origin: center; }
@keyframes sparkle { 0%, 100% { transform: scale(1); opacity: 0.7; } 50% { transform: scale(1.3); opacity: 1; } }


/* --- Auth Pages & Flash Messages --- */
.auth-container {
    max-width: 450px;
    margin: 4rem auto;
}
.auth-container .content-card {
    animation: fadeInScale 0.5s ease-out;
}

.flash-message {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
    font-weight: 500;
}
.flash-success {
    background-color: #D1FAE5;
    color: #065F46;
}
.flash-error {
    background-color: #FEE2E2;
    color: #991B1B;
}

/* --- Note Selection Modal --- */
.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}
.pagination-btn:hover:not(:disabled) {
    background-color: #f1f5f9;
}
.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Flashcard Styles --- */
.flashcard {
    background-color: transparent;
    width: 100%;
    min-height: 150px;
    perspective: 1000px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

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

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid #e2e8f0;
}

.flashcard-front {
    background-color: #f8fafc;
    color: #0f172a;
}

.flashcard-back {
    background-color: #c7d2fe;
    color: #312e81;
    transform: rotateY(180deg);
}

.flashcard-front p, .flashcard-back p {
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
}

/* --- Quiz Option Styling --- */
.quiz-option {
    display: block;
    width: 100%;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}
.quiz-option:hover {
    border-color: #6366f1;
    background-color: #eef2ff;
}
.quiz-option.selected {
    border-color: #6366f1;
    background-color: #e0e7ff;
    font-weight: bold;
}
.quiz-option.correct {
    border-color: #10b981;
    background-color: #d1fae5;
}
.quiz-option.incorrect {
    border-color: #ef4444;
    background-color: #fee2e2;
}

/* --- Utility Classes --- */
.pointer-events-none {
    pointer-events: none;
}

/* --- Prose styles for AI content --- */
.prose h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; }
.prose h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.75rem; }
.prose h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.5rem; }
.prose strong { font-weight: 700; }
.prose ul { list-style-type: disc; margin-left: 1.5rem; }