CareerPal / static /style.css
SpanDone's picture
Fixed Recurring Problem of Mobile UI
fdf1b24
/* General Setup */
html, body {
margin: 0;
padding: 0;
overflow-x: hidden; /* Prevents horizontal scroll */
}
/* General Setup 2*/
body {
font-family: 'Inter', sans-serif;
margin: 0;
transition: background-color 0.3s, color 0.3s;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.main-container {
display: flex;
height: 100vh;
padding: 2rem;
box-sizing: border-box;
gap: 2rem;
}
/* --- Left Column --- */
.left-column {
flex: 0.7;
display: flex;
flex-direction: column;
padding-right: 2rem;
border-right: 1px solid;
}
.logo-container {
width: 100%;
text-align: center;
margin-bottom: 1.5rem;
}
.logo {
max-width: 100%;
height: auto;
}
.intro-paragraph {
text-align: center;
font-size: 1rem;
line-height: 1.6;
font-weight: 400;
margin-bottom: 2rem;
}
.card {
padding: 1.5rem;
border-radius: 12px;
margin-bottom: 1.5rem;
border: 1px solid;
transition: box-shadow 0.3s ease-in-out, transform 0.2s ease-in-out;
}
.card:hover {
transform: translateY(-2px);
}
.card h2 {
margin-top: 0;
margin-bottom: 1.25rem;
font-size: 0.9rem;
font-weight: 600;
letter-spacing: 0.5px;
text-transform: uppercase;
}
.features-list {
list-style: none;
padding: 0;
margin: 0;
}
.features-list li {
display: flex;
align-items: center;
margin-bottom: 1rem;
font-size: 1rem;
font-weight: 500;
padding: 10px;
border-radius: 8px;
transition: background-color 0.2s ease-in-out;
}
.features-list li:hover {
cursor: pointer;
}
.features-list li:last-child {
margin-bottom: 0;
}
.features-list .icon {
display: inline-flex;
align-items: center;
justify-content: center;
margin-right: 1rem;
}
.disclaimer {
font-size: 0.8rem;
text-align: center;
margin-top: auto;
}
.setting-item {
display: flex;
justify-content: space-between;
align-items: center;
font-weight: 500;
}
/* --- Toggle Switch Styles --- */
.toggle-switch {
position: relative;
display: inline-block;
width: 44px;
height: 24px;
}
.toggle-switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0; left: 0; right: 0; bottom: 0;
background-color: #ccc;
transition: .4s;
border-radius: 24px;
}
.slider:before {
position: absolute;
content: "";
height: 18px; width: 18px;
left: 3px; bottom: 3px;
background-color: white;
transition: .4s;
border-radius: 50%;
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
input:checked + .slider:before {
transform: translateX(20px);
}
/* --- Right Column --- */
.right-column {
flex: 2.3;
}
/* Chat Window */
.chat-window {
height: 100%;
display: flex;
flex-direction: column;
border-radius: 16px;
box-shadow: 0 8px 30px rgba(0,0,0,0.08);
overflow: hidden;
}
.chat-header {
display: flex;
align-items: center;
padding: 0.75rem 1.5rem;
font-weight: 600;
font-family: 'Inter', sans-serif;
font-size: 1.2rem;
flex-shrink: 0;
}
.chat-messages {
flex-grow: 1;
padding: 1rem;
overflow-y: auto;
}
.chat-input-form {
display: flex;
padding: 1rem;
border-top: 1px solid;
flex-shrink: 0;
align-items: center;
}
#message-input {
flex-grow: 1;
border: 1px solid;
padding: 12px;
font-size: 1rem;
border-radius: 8px;
font-family: 'Inter', sans-serif;
}
#message-input:focus {
outline: none;
}
.chat-input-form button {
background: none;
border: none;
font-size: 1.5rem;
cursor: pointer;
transition: transform 0.2s ease-in-out;
padding-left: 1rem;
}
.chat-input-form button:hover {
transform: scale(1.1);
}
/* Message Bubbles */
.message {
margin-bottom: 1rem;
display: flex;
align-items: flex-end;
gap: 0.75rem;
}
.bot-avatar {
width: 40px;
height: 40px;
border-radius: 50%;
flex-shrink: 0;
}
.message p {
padding: 0.7rem 1.2rem;
border-radius: 18px;
max-width: 95%;
line-height: 1.6;
margin: 0;
}
.user-message { justify-content: flex-end; }
.bot-message { justify-content: flex-start; }
.user-message p { border-radius: 18px 18px 5px 18px; }
.bot-message p { border-radius: 18px 18px 18px 5px; }
/* Typing Indicator Styles */
.typing-indicator {
display: flex;
align-items: center;
padding: 0.7rem 1.2rem;
}
.typing-indicator span {
height: 8px;
width: 8px;
border-radius: 50%;
margin: 0 2px;
animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1.0); }
}
/* --- LIGHT THEME --- */
body.light {
background-color: #e9ecef;
color: #212529;
}
body.light .logo-dark { display: none; }
body.light .logo-light { display: block; margin: 0 auto; }
body.light .left-column { border-right-color: #ced4da; }
body.light .card { background-color: #ffffff; border-color: #dee2e6; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); }
body.light .features-list li:hover { background-color: #dee2e6; }
body.light .typing-indicator span { background-color: #868e96; }
body.light .chat-window { background: #FFFFFF; }
body.light .chat-header { background: #104E61; color: white; }
body.light .chat-input-form { border-top-color: #dee2e6; }
body.light #message-input { background: #ffffff; color: #495057; border-color: #ced4da; }
body.light .bot-message p { background: #D1D5DB; color: #212529; }
body.light .user-message p { background: #104E61; color: white; }
body.light .chat-input-form button { color: #104E61; }
body.light input:checked + .slider { background-color: #104E61; }
/* --- DARK THEME --- */
body.dark {
background-color: #121212;
color: #e9ecef;
}
body.dark .logo-dark { display: block; margin: 0 auto; }
body.dark .logo-light { display: none; }
body.dark .left-column { border-right-color: #343a40; }
body.dark .card { background-color: #1e1e1e; border-color: #343a40; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
body.dark .features-list li:hover { background-color: #2c2d30; }
body.dark .typing-indicator span { background-color: #adb5bd; }
body.dark .chat-window { background: #1e1e1e; }
body.dark .chat-header { background: #DB2777; color: white; }
body.dark .chat-input-form { border-top-color: #343a40; }
body.dark #message-input { background: #121212; color: #e9ecef; border-color: #343a40;}
body.dark .bot-message p { background: #343a40; color: #f8f9fa; }
body.dark .user-message p { background: #DB2777; color: white; }
body.dark .chat-input-form button { color: #DB2777; }
body.dark input:checked + .slider { background-color: #DB2777; }
/* --- Download Button Styles --- */
.setting-item { margin-bottom: 1rem; }
.setting-item:last-child { margin-bottom: 0; }
.download-button { text-decoration: none; font-weight: 500; font-size: 0.9rem; padding: 6px 14px; border-radius: 6px; transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out; }
body.light .download-button { background-color: #e9ecef; color: #495057; border: 1px solid #dee2e6; }
body.light .download-button:hover { background-color: #dee2e6; }
body.dark .download-button { background-color: #343a40; color: #e9ecef; border: 1px solid #495057; }
body.dark .download-button:hover { background-color: #495057; }
/* --- V6+ Card & Link Styles --- */
.college-card a { text-decoration: none; color: inherit; font-weight: bold; }
.college-card a:hover { text-decoration: underline; }
.recommendation-container, .details-card, .college-card { border: 1px solid; border-radius: 12px; padding: 1rem 1.5rem; margin-top: 1rem; }
.recommendation-container h4, .details-card h3, .college-card h4 { margin-top: 0; margin-bottom: 1rem; font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; }
.recommendation-card { padding: 1rem 0; border-bottom: 1px solid; }
.recommendation-container .recommendation-card:last-child { border-bottom: none; padding-bottom: 0; }
.college-card ul { list-style: none; padding-left: 0; margin: 0; }
.college-card li { padding: 0.75rem 0; border-bottom: 1px solid; }
.college-card li:last-child { border-bottom: none; padding-bottom: 0; }
.college-card li small { opacity: 0.7; }
/* Clickable Card Base Styles */
.clickable-card { cursor: pointer; transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; }
.clickable-card:hover { transform: translateY(-3px); }
.compare-card {
text-align: center;
border-radius: 12px;
margin-top: 1rem;
padding: 1rem;
border-bottom: none;
}
/* Light Theme Cards */
body.light .recommendation-container, body.light .details-card, body.light .college-card { background-color: #f8f9fa; border-color: #dee2e6; }
body.light .recommendation-card, body.light .college-card li { border-color: #e9ecef; }
body.light .primary-card { border-left: 4px solid #104E61; }
body.light .fallback-card { border-left: 4px solid #6c757d; }
body.light .clickable-card:hover { box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08); }
body.light .details-card a { color: #0056b3; }
body.light .compare-card { background-color: #e9ecef; }
body.light .compare-card:hover { background-color: #dee2e6; }
/* Dark Theme Cards */
body.dark .recommendation-container, body.dark .details-card, body.dark .college-card { background-color: #2c2d30; border-color: #343a40; }
body.dark .recommendation-card, body.dark .college-card li { border-color: #343a40; }
body.dark .primary-card { border-left: 4px solid #DB2777; }
body.dark .fallback-card { border-left: 4px solid #adb5bd; }
body.dark .compare-card { background-color: #343a40; }
body.dark .compare-card:hover { background-color: #3e444a; }
body.dark .clickable-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.25); }
body.dark .details-card a { color: #7dd3fc; }
/* Quick Reply Buttons */
.quick-reply-container {
display: flex;
gap: 10px;
margin-top: 12px;
}
.quick-reply-button {
padding: 8px 16px;
border-radius: 18px;
font-weight: 500;
font-size: 0.9rem;
}
body.light .quick-reply-button {
background-color: #e9ecef;
border: 1px solid #dee2e6;
}
body.light .quick-reply-button:hover {
background-color: #dee2e6;
border-color: #ced4da;
}
body.dark .quick-reply-button {
background-color: #343a40;
border: 1px solid #495057;
}
body.dark .quick-reply-button:hover {
background-color: #495057;
border-color: #6c757d;
}
/* --- Mobile Responsiveness --- */
/* Hide the hamburger menu on desktop */
.menu-toggle-button {
display: none;
background: none;
border: none;
color: white;
cursor: pointer;
padding: 0 1rem 0 0;
}
@media (max-width: 768px) {
/* Show the hamburger menu on mobile */
.menu-toggle-button {
display: block;
}
.main-container {
flex-direction: column;
padding: 0;
gap: 0;
}
/* Make the left column a slide-out menu */
.left-column {
position: fixed;
top: 0;
left: 0;
width: 80%;
max-width: 300px;
height: 100%;
background-color: var(--background-color); /* Use theme variables */
z-index: 1000;
transform: translateX(-100%);
transition: transform 0.3s ease-in-out;
border-right: 1px solid;
padding: 1rem;
box-sizing: border-box;
overflow-y: auto;
}
/* This class will be toggled by JavaScript to show the menu */
.left-column.active {
transform: translateX(0);
}
.right-column {
width: 100%;
flex: 1; /* Allow it to take up remaining height */
}
.chat-window {
height: 100vh; /* Full screen height */
border-radius: 0;
box-shadow: none;
}
.chat-header {
border-radius: 0;
}
}
/* Use theme variables for the background of the left column on mobile */
body.light .left-column {
background-color: #e9ecef;
}
body.dark .left-column {
background-color: #121212;
}
/* --- V6+ Mobile Fixes --- */
/* Overlay to cover the chat window when the menu is open */
#page-overlay {
display: none; /* Hidden by default */
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999; /* Below the menu, but above the content */
opacity: 0;
transition: opacity 0.3s ease-in-out;
}
#page-overlay.active {
display: block;
opacity: 1;
}
/* Close button for the slide-out menu */
.close-menu-button {
display: none; /* Hidden on desktop */
position: absolute;
top: 10px;
right: 15px;
background: none;
border: none;
font-size: 2.5rem;
font-weight: 300;
line-height: 1;
cursor: pointer;
}
body.light .close-menu-button {
color: #212529;
}
body.dark .close-menu-button {
color: #e9ecef;
}
/* Fix for syntax error in original file */
body.dark .left-column {
background-color: #121212;
}
@media (max-width: 768px) {
/* Show the close button on mobile */
.close-menu-button {
display: block;
}
/* Prevent body scroll when menu is active */
body.menu-open {
overflow: hidden;
}
.left-column {
padding-top: 4rem;
}
}
/* --- Mobile Menu Elements*/
.menu-toggle-button { display: none; background: none; border: none; color: white; cursor: pointer; padding: 0 1rem 0 0; }
#page-overlay { display: none; }
.close-menu-button { display: none; }
/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
body.menu-open {
overflow: hidden; /* Prevent background from scrolling when menu is open */
}
.main-container {
flex-direction: column;
padding: 0;
gap: 0;
height: 100vh;
}
/* Left Column becomes slide-out menu */
.left-column {
position: fixed;
top: 0;
left: 0;
width: 80%;
max-width: 300px;
height: 100%;
z-index: 1000;
transform: translateX(-100%);
transition: transform 0.3s ease-in-out;
border-right: 1px solid;
padding: 1rem;
padding-top: 4rem; /* Make space for close button */
box-sizing: border-box;
overflow-y: auto;
}
.left-column.active {
transform: translateX(0);
}
body.light .left-column { background-color: #f8f9fa; }
body.dark .left-column { background-color: #1e1e1e; }
/* Right Column takes full width */
.right-column {
width: 100%;
height: 100%;
}
.chat-window {
border-radius: 0;
box-shadow: none;
height: 100%;
}
.chat-header {
border-radius: 0;
}
/* Show Mobile Menu Elements */
.menu-toggle-button {
display: block;
}
#page-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999;
opacity: 0;
transition: opacity 0.3s ease-in-out;
pointer-events: none;
}
#page-overlay.active {
opacity: 1;
pointer-events: auto;
}
.close-menu-button {
display: block;
position: absolute;
top: 10px;
right: 15px;
background: none;
border: none;
font-size: 2.5rem;
font-weight: 300;
line-height: 1;
cursor: pointer;
}
body.light .close-menu-button { color: #212529; }
body.dark .close-menu-button { color: #e9ecef; }
}