AutoML / frontend /style.css
Al1Abdullah's picture
Implement unified sidebar toggle and refine mobile UI
1ffd5bd
:root {
--primary-color: #6A5ACD;
--secondary-color: #20B2AA;
--sidebar-bg: #2c3e50;
--text-color-dark: #34495e;
--text-color-light: #ecf0f1;
--hover-color: #7B68EE;
}
body {
font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
margin: 0;
padding: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.app-layout {
display: flex;
height: 100vh;
overflow: hidden;
}
.sidebar {
width: 260px;
background-color: var(--sidebar-bg);
height: 100%;
position: fixed;
top: 0;
left: 0;
padding: 1.5rem;
transition: width 0.3s ease, transform 0.3s ease;
z-index: 10;
box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}
.sidebar.collapsed {
width: 80px;
}
.sidebar-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
}
.sidebar-header h2 {
margin: 0;
font-weight: 700;
font-size: 1.8rem;
color: var(--text-color-light);
transition: opacity 0.3s ease;
}
.sidebar.collapsed .sidebar-header h2 {
opacity: 0;
}
/* Unified sidebar toggle button */
#sidebar-toggle {
background: transparent;
border: none;
color: var(--text-color-light);
font-size: 1.2rem;
cursor: pointer;
transition: transform 0.3s ease;
position: fixed; /* Fixed position for both desktop and mobile */
top: 1rem;
left: 1rem;
z-index: 1001; /* Ensure it's above other content */
background-color: var(--primary-color);
border-radius: 50%;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
#sidebar-toggle:hover {
color: var(--hover-color);
}
/* Desktop specific toggle behavior */
@media (min-width: 769px) {
#sidebar-toggle {
position: absolute; /* Position relative to sidebar on desktop */
top: 1.5rem;
right: 1.5rem;
left: auto; /* Reset left position */
background: transparent; /* Reset background */
box-shadow: none; /* Reset shadow */
}
.sidebar.collapsed #sidebar-toggle {
transform: rotate(180deg);
}
}
.sidebar-nav {
display: flex;
flex-direction: column;
gap: 1rem;
}
.sidebar-nav .nav-link {
display: flex;
align-items: center;
gap: 1rem;
padding: 0.8rem 1rem;
border-radius: 8px;
color: var(--text-color-light);
font-weight: 500;
text-decoration: none;
transition: background-color 0.2s, transform 0.2s;
}
.sidebar-nav .nav-link:hover {
background-color: rgba(255, 255, 255, 0.1);
transform: translateX(5px);
}
.sidebar-nav .nav-link.active {
background-color: var(--primary-color);
font-weight: 700;
box-shadow: 0 4px 15px rgba(106, 90, 205, 0.3);
}
.sidebar-nav .nav-link .nav-text {
opacity: 1;
transition: opacity 0.3s ease;
}
.sidebar.collapsed .nav-link .nav-text {
opacity: 0;
width: 0;
overflow: hidden;
}
.sidebar.collapsed .nav-link {
justify-content: center;
}
.main-content {
margin-left: 260px;
width: calc(100% - 260px);
height: 100%;
transition: margin-left 0.3s ease, width 0.3s ease;
background-image: url('BGround.png');
background-size: cover;
background-position: center;
position: relative;
overflow-y: auto;
}
.main-content.collapsed {
margin-left: 80px;
width: calc(100% - 80px);
}
.container {
width: 100%;
min-height: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 2.5rem;
box-sizing: border-box;
}
.page {
display: none;
width: 100%;
max-width: 900px;
}
.page.active {
display: block;
animation: fadeIn 0.5s;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.card {
background: rgba(0, 0, 0, 0.3);
border-radius: 16px;
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
padding: 2.5rem;
color: var(--text-color-light);
margin-bottom: 2rem;
}
.card h2 {
color: var(--text-color-light);
font-weight: 700;
margin-bottom: 1.5rem;
text-align: center;
}
.card p, .card label {
color: var(--text-color-light);
font-weight: 500;
margin-bottom: 0.5rem;
display: block;
}
.file-upload-wrapper {
position: relative;
display: inline-block;
width: 100%;
margin-bottom: 1rem;
}
#csv-upload {
display: none;
}
.file-upload-wrapper label {
display: block;
padding: 1rem;
background: rgba(255, 255, 255, 0.2);
border: 2px dashed rgba(255, 255, 255, 0.5);
border-radius: 8px;
text-align: center;
cursor: pointer;
transition: background-color 0.2s, border-color 0.2s;
}
.file-upload-wrapper label:hover {
background: rgba(255, 255, 255, 0.3);
border-color: var(--primary-color);
}
select, input[type="text"], button {
width: 100%;
padding: 1rem;
margin-bottom: 1rem;
border-radius: 8px;
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
color: var(--text-color-light);
font-size: 1rem;
box-sizing: border-box;
}
select option {
background: #fff;
color: var(--text-color-dark);
}
select:focus, input:focus {
background: rgba(255, 255, 255, 0.2);
box-shadow: 0 0 0 3px rgba(106, 90, 205, 0.3);
outline: none;
}
button {
background-color: var(--primary-color);
cursor: pointer;
transition: background-color 0.2s, transform 0.2s;
}
button:hover {
background-color: var(--hover-color);
transform: translateY(-3px);
box-shadow: 0 6px 20px rgba(106, 90, 205, 0.4);
}
#plot-output {
background: rgba(0, 0, 0, 0.2);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 8px;
padding: 1rem;
margin-top: 1rem;
min-height: 200px;
display: flex;
align-items: center;
justify-content: center;
}
#plot-img {
max-width: 100%;
max-height: 100%;
border-radius: 8px;
}
#train-output, #ai-answer, #upload-status, #plot-error {
background-color: rgba(0, 0, 0, 0.2);
border: 1px solid rgba(255, 255, 255, 0.2);
color: var(--text-color-light);
padding: 1rem;
border-radius: 8px;
margin-top: 1rem;
min-height: 50px;
white-space: pre-wrap;
word-wrap: break-word;
cursor: pointer;
}
.loader {
border: 4px solid #f3f3f3;
border-top: 4px solid var(--primary-color);
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
display: none;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.nav-text {
animation: fadeInText 0.5s forwards;
}
@keyframes fadeInText {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.sidebar.collapsed .nav-text {
animation: none;
}
/* Overlay for when sidebar is active */
.overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 999; /* Below sidebar, above content */
}
.overlay.active {
display: block;
}
/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
/* Hide desktop toggle on mobile */
#desktop-sidebar-toggle {
display: none;
}
/* Show mobile toggle */
#sidebar-toggle {
display: flex;
}
.app-layout {
flex-direction: column;
height: auto; /* Allow content to dictate height */
min-height: 100vh; /* Ensure it takes at least full viewport height */
}
.sidebar {
width: 250px; /* Slightly narrower sidebar for mobile */
height: 100vh; /* Full viewport height */
position: fixed; /* Keep it fixed for overlay effect */
top: 0;
left: 0;
padding: 1.5rem;
transform: translateX(-100%); /* Hide sidebar by default */
transition: transform 0.3s ease;
z-index: 1000; /* Ensure it's on top of everything */
box-shadow: 2px 0 10px rgba(0,0,0,0.1);
overflow-y: auto; /* Allow sidebar content to scroll if needed */
}
.sidebar.active {
transform: translateX(0); /* Slide in when active */
}
.sidebar.collapsed {
/* On mobile, 'collapsed' means hidden, so it's the same as default hidden state */
width: 250px;
transform: translateX(-100%);
}
.sidebar-header {
margin-bottom: 2rem;
}
.sidebar-header h2 {
opacity: 1; /* Always show title on mobile */
}
.sidebar-nav .nav-link .nav-text {
opacity: 1; /* Always show text on mobile */
width: auto;
overflow: visible;
}
.sidebar-nav .nav-link {
justify-content: flex-start;
}
.main-content {
margin-left: 0; /* Remove left margin */
width: 100%; /* Take full width */
min-height: 100vh; /* Ensure main content takes at least full viewport height */
padding: 1rem; /* Adjust padding */
overflow-y: auto; /* Ensure scrolling */
background-size: cover; /* Ensure background covers well */
background-position: center;
}
.main-content.collapsed {
margin-left: 0;
width: 100%;
}
.container {
padding: 1rem; /* Adjust container padding */
/* Center the card horizontally */
justify-content: center;
align-items: flex-start; /* Align items to start to prevent vertical centering issues */
}
.page {
max-width: 100%; /* Allow pages to take full width */
}
.card {
padding: 1.5rem; /* Adjust card padding */
width: 95%; /* Give it a max width to prevent stretching */
box-sizing: border-box; /* Include padding in width */
}
/* Adjust font sizes for better mobile readability */
body {
font-size: 0.9rem;
}
.card h2 {
font-size: 1.5rem;
}
select, input[type="text"], button {
padding: 0.8rem;
font-size: 0.9rem;
}
}