Spaces:
Sleeping

chatr / frontend /css /style.css
valent-p's picture
Responsive CSS
e2468ae
Raw History Blame Contribute Delete
4.93 kB
:root {
--primary-bg: #f4f4f9;
--secondary-bg: #ffffff;
--border-color: #ddd;
--text-color: #333;
--primary-accent: #007bff;
--primary-accent-hover: #0056b3;
--danger-color: #dc3545;
--danger-hover: #c82333;
--success-color: #28a745;
--font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
body {
margin: 0;
font-family: var(--font-family);
background-color: var(--primary-bg);
color: var(--text-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
#app-container {
width: 100%;
max-width: 800px;
height: 90vh;
max-height: 700px;
background-color: var(--secondary-bg);
border-radius: 8px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
overflow: hidden;
}
/* --- Helper Classes --- */
.hidden {
display: none !important;
}
/* --- Form and Auth Styles --- */
.form-container {
padding: 2rem;
display: flex;
flex-direction: column;
gap: 1.5rem;
overflow-y: auto;
}
form {
display: flex;
flex-direction: column;
gap: 1rem;
}
form h3 {
margin: 0;
text-align: center;
}
hr {
border: none;
border-top: 1px solid var(--border-color);
}
input[type="text"],
input[type="email"],
input[type="password"] {
padding: 10px;
border: 1px solid var(--border-color);
border-radius: 4px;
font-size: 1rem;
}
button {
padding: 10px 15px;
border: none;
border-radius: 4px;
background-color: var(--primary-accent);
color: white;
font-size: 1rem;
font-weight: bold;
cursor: pointer;
transition: background-color 0.2s;
}
button:hover {
background-color: var(--primary-accent-hover);
}
/* --- Notification Bar --- */
.notification {
padding: 10px;
text-align: center;
color: white;
font-weight: bold;
display: none;
/* Hidden by default */
}
.notification.error {
background-color: var(--danger-color);
}
.notification.success {
background-color: var(--success-color);
}
/* --- Lobby Styles --- */
#lobby-view {
display: flex;
flex-direction: column;
}
.lobby-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 2rem;
border-bottom: 1px solid var(--border-color);
}
.lobby-header p {
margin: 0;
}
#logout-btn {
background-color: var(--danger-color);
}
#logout-btn:hover {
background-color: var(--danger-hover);
}
#room-created-info {
border: 1px dashed var(--primary-accent);
padding: 1rem;
border-radius: 4px;
}
#room-created-info p {
margin: 0.5rem 0;
}
/* --- Chat View Styles --- */
#chat-view {
display: flex;
flex-direction: column;
height: 100%;
}
.chat-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem;
border-bottom: 1px solid var(--border-color);
flex-shrink: 0;
}
.chat-header h3 {
margin: 0;
}
#leave-room-btn {
background-color: var(--danger-color);
}
#leave-room-btn:hover {
background-color: var(--danger-hover);
}
.chat-main {
display: flex;
flex-grow: 1;
overflow: hidden;
}
#messages-container {
flex-grow: 1;
padding: 1rem;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 1rem;
}
.message {
padding: 8px 12px;
border-radius: 18px;
max-width: 70%;
word-wrap: break-word;
}
.message .sender {
font-size: 0.8em;
font-weight: bold;
margin-bottom: 4px;
}
.message.sent {
background-color: var(--primary-accent);
color: white;
align-self: flex-end;
border-bottom-right-radius: 4px;
}
.message.received {
background-color: #e9e9eb;
color: var(--text-color);
align-self: flex-start;
border-bottom-left-radius: 4px;
}
.message.system {
align-self: center;
background-color: var(--primary-bg);
color: #888;
font-style: italic;
font-size: 0.9em;
}
#user-list {
width: 200px;
border-left: 1px solid var(--border-color);
padding: 1rem;
overflow-y: auto;
flex-shrink: 0;
}
#user-list h4 {
margin-top: 0;
}
#user-list ul {
list-style: none;
padding: 0;
margin: 0;
}
#user-list li {
padding: 5px 0;
}
.chat-footer {
padding: 1rem;
border-top: 1px solid var(--border-color);
display: flex;
gap: 1rem;
flex-shrink: 0;
}
.chat-footer input {
flex-grow: 1;
}
/* --- Mobile and Responsive Styles --- */
@media (max-width: 768px) {
body {
align-items: flex-start;
}
#app-container {
height: 100vh;
max-height: none;
border-radius: 0;
box-shadow: none;
}
.form-container {
padding: 1.5rem;
}
.lobby-header {
padding: 1rem;
}
.chat-header {
padding: 1rem;
}
.chat-main {
flex-direction: column;
}
#user-list {
width: 100%;
max-height: 150px;
/* Or a height that works for your design */
border-left: none;
border-top: 1px solid var(--border-color);
flex-shrink: 0;
}
.message {
max-width: 85%;
}
.chat-footer {
padding: 0.75rem;
}
}