/* assets/style.css */ /* Custom CSS for TriviaVerse Enhanced */ /* Import Google Fonts */ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap'); /* Global Variables */ :root { --primary-color: #6A057F; /* Deeper purple */ --secondary-color: #8C1C8C; /* Lighter purple */ --background-color: #F8F8F8; /* Light gray background */ --text-color: #333333; /* Darker text for contrast */ --border-radius: 12px; --transition: all 0.3s ease; --card-background: #FFFFFF; /* White card background */ --shadow-light: 0 4px 15px rgba(0, 0, 0, 0.05); --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.1); } /* Dark mode variables */ [data-theme="dark"] { --primary-color: #BB86FC; /* Lighter purple for dark mode */ --secondary-color: #3700B3; /* Darker purple for dark mode */ --background-color: #121212; /* Dark background */ --text-color: #E0E0E0; /* Light text */ --card-background: #1E1E1E; /* Dark card background */ --shadow-light: 0 4px 15px rgba(0, 0, 0, 0.3); --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.4); } /* Global Styles */ * { box-sizing: border-box; } body { font-family: 'Poppins', sans-serif; line-height: 1.6; color: var(--text-color); background-color: var(--background-color); margin: 0; padding: 0; } /* Smooth scrolling */ html { scroll-behavior: smooth; } /* Custom scrollbar */ ::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-track { background: var(--background-color); border-radius: 10px; } ::-webkit-scrollbar-thumb { background: var(--primary-color); border-radius: 10px; } ::-webkit-scrollbar-thumb:hover { background: var(--secondary-color); } /* Animations */ @keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } @keyframes slideInLeft { from { opacity: 0; transform: translateX(-50px); } to { opacity: 1; transform: translateX(0); } } @keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.02); /* Slightly less aggressive pulse */ } 100% { transform: scale(1); } } @keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: calc(200px + 100%) 0; } } @keyframes popIn { 0% { opacity: 0; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1); } } /* Utility Classes */ .fade-in { animation: fadeIn 0.5s ease-out forwards; } .slide-in-left { animation: slideInLeft 0.5s ease-out forwards; } .pulse { animation: pulse 2s ease-in-out infinite; } .pop-in { animation: popIn 0.4s ease-out forwards; } /* Loading skeleton */ .skeleton { background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200px 100%; animation: shimmer 1.5s ease-in-out infinite; } /* Card hover effects */ .hover-lift { transition: transform 0.3s ease, box-shadow 0.3s ease; } .hover-lift:hover { transform: translateY(-5px); box-shadow: var(--shadow-medium); } /* Flashcard Component */ .flashcard-container { perspective: 1000px; min-height: 300px; cursor: pointer; box-shadow: var(--shadow-medium); /* Apply consistent shadow */ border-radius: var(--border-radius); overflow: hidden; /* Ensure rounded corners for internal faces */ } .flashcard { width: 100%; min-height: 300px; border-radius: var(--border-radius); padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: white; transition: transform 0.6s; transform-style: preserve-3d; } .flashcard.front { background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%); } .flashcard.back { background: var(--card-background); /* Use card background variable */ color: var(--text-color); /* Use text color variable */ } .flashcard p { font-size: 1.2rem; } .flip-instruction { margin-top: 30px; opacity: 0.8; font-style: italic; color: var(--text-color); /* Ensure visibility in dark mode */ } /* Streamlit specific overrides and enhancements */ .stButton>button { border-radius: var(--border-radius); padding: 10px 20px; font-weight: 600; transition: var(--transition); border: none; background-color: var(--primary-color); color: white; box-shadow: var(--shadow-light); } .stButton>button:hover { background-color: var(--secondary-color); box-shadow: var(--shadow-medium); transform: translateY(-2px); } .stRadio>div>label { padding: 10px; border-radius: var(--border-radius); background-color: var(--card-background); border: 1px solid #e0e0e0; /* Light border for options */ margin-bottom: 8px; transition: var(--transition); box-shadow: var(--shadow-light); } .stRadio>div>label:hover { border-color: var(--primary-color); box-shadow: var(--shadow-medium); } /* Metric cards */ [data-testid="stMetric"] { background-color: var(--card-background); border-radius: var(--border-radius); padding: 20px; box-shadow: var(--shadow-light); transition: var(--transition); animation: popIn 0.5s ease-out forwards; /* Initial pop-in animation */ } [data-testid="stMetric"]:hover { transform: translateY(-3px); box-shadow: var(--shadow-medium); } /* Expander styling */ [data-testid="stExpander"] { background-color: var(--card-background); border-radius: var(--border-radius); padding: 15px; box-shadow: var(--shadow-light); transition: var(--transition); } [data-testid="stExpander"]:hover { box-shadow: var(--shadow-medium); } /* Text input styling */ .stTextInput>div>div>input { border-radius: var(--border-radius); border: 1px solid #e0e0e0; padding: 10px; transition: var(--transition); } .stTextInput>div>div>input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2); /* Needs RGB conversion */ } /* Selectbox styling */ .stSelectbox>div>div { border-radius: var(--border-radius); border: 1px solid #e0e0e0; transition: var(--transition); } .stSelectbox>div>div:hover { border-color: var(--primary-color); } /* Responsive Typography */ h1 { font-size: clamp(1.8rem, 4vw, 3rem); /* Larger headings */ font-weight: 700; color: var(--primary-color); /* Headings in primary color */ text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.05); } h2 { font-size: clamp(1.5rem, 3.5vw, 2.5rem); font-weight: 600; color: var(--primary-color); } h3 { font-size: clamp(1.2rem, 3vw, 2rem); font-weight: 600; color: var(--text-color); } p { font-size: clamp(0.9rem, 2vw, 1.1rem); } /* Mobile-first responsive design */ @media (max-width: 768px) { /* Mobile styles */ .main .block-container { padding: 1rem 0.5rem !important; max-width: 100% !important; } /* Stack columns on mobile */ .row-widget.stHorizontal { flex-direction: column !important; } .row-widget.stHorizontal>div { width: 100% !important; margin-bottom: 1rem; } /* Full-width buttons on mobile */ .stButton>button { width: 100% !important; min-height: 50px; font-size: 16px !important; } /* Larger touch targets */ .stRadio>div>label { padding: 15px !important; margin: 5px 0 !important; } /* Responsive cards */ .card { padding: 15px !important; margin: 10px 0 !important; } /* Hide sidebar by default on mobile */ section[data-testid="stSidebar"] { transform: translateX(-100%); transition: transform 0.3s ease; } section[data-testid="stSidebar"][aria-expanded="true"] { transform: translateX(0); } /* Adjust font sizes for mobile */ .score-display { font-size: 24px !important; } /* Responsive quiz container */ .quiz-container { padding: 20px !important; margin: 15px 0 !important; } } /* Tablet styles */ @media (min-width: 769px) and (max-width: 1024px) { .main .block-container { max-width: 95%; padding: 2rem 1rem; } .row-widget.stHorizontal>div { flex: 1; } } /* Desktop styles */ @media (min-width: 1025px) { .main .block-container { max-width: 1200px; padding: 3rem 2rem; } } /* Print styles */ @media print { .stButton, section[data-testid="stSidebar"], .stRadio { display: none !important; } .main { padding: 0 !important; } .card { break-inside: avoid; page-break-inside: avoid; } } /* Accessibility improvements */ .stButton>button:focus, .stRadio>div>label:focus { outline: 3px solid var(--primary-color); outline-offset: 2px; } /* High contrast mode support */ @media (prefers-contrast: high) { :root { --primary-color: #00AA00; --background-color: #000000; --text-color: #FFFFFF; } } /* Reduced motion support */ @media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; } } /* Custom tooltip */ .tooltip { position: relative; display: inline-block; } .tooltip .tooltiptext { visibility: hidden; width: 200px; background-color: #555; color: #fff; text-align: center; border-radius: 6px; padding: 5px; position: absolute; z-index: 1; bottom: 125%; left: 50%; margin-left: -100px; opacity: 0; transition: opacity 0.3s; } .tooltip:hover .tooltiptext { visibility: visible; opacity: 1; }