/* Main stylesheet for FoodSafe Digital Chat */

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
  --primary-color: #4a89dc;
  --primary-dark: #3b7dd8;
  --secondary-color: #5cb85c;
  --danger-color: #d9534f;
  --warning-color: #f0ad4e;
  --text-color: #333;
  --text-light: #666;
  --text-lighter: #999;
  --bg-color: #f5f5f5;
  --bg-light: #ffffff;
  --border-color: #ddd;
  --border-radius: 4px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  --transition: all 0.2s ease;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-color);
  margin-bottom: 0.5rem;
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Container layouts */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Authentication container */
.auth-container {
  max-width: 500px;
  width: 90%;
  background-color: var(--bg-light);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin: 2rem auto;
}

.logo-container {
  text-align: center;
  margin-bottom: 1.5rem;
}

.logo {
  width: 100px;
  height: auto;
  margin-bottom: 1rem;
}

.logo-small {
  width: 40px;
  height: auto;
  margin-right: 1rem;
}

.logo-sidebar {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-container.small {
  display: flex;
  align-items: center;
  text-align: left;
  margin-bottom: 0;
}

.logo-container.small h1 {
  font-size: 1.5rem;
  margin-bottom: 0;
}

/* Tabs for login/register */
.tabs {
  display: flex;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  padding: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-light);
  transition: var(--transition);
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Form elements */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-color);
  font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(74, 137, 220, 0.2);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.btn:hover {
  background-color: var(--primary-dark);
  text-decoration: none;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--text-light);
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--primary-color);
}

.btn-icon img {
  width: 20px;
  height: 20px;
}

/* Badge indicator */
.badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: var(--danger-color);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Chat container layout */
.chat-container {
  display: flex;
  height: 100vh;
  width: 100%;
}

.sidebar {
  width: 280px;
  background-color: #2c3e50;
  color: white;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-info {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info h3 {
  color: white;
  margin-bottom: 0.25rem;
}

.user-info p {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.user-actions {
  display: flex;
  align-items: center;
  margin-top: 1rem;
}

.user-actions button {
  margin-right: 0.5rem;
  position: relative;
}

.rooms-list {
  flex: 1;
  overflow-y: auto;
}

.rooms-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.rooms-header h3 {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0;
  font-size: 1rem;
}

.rooms-list ul {
  list-style: none;
  padding: 0.5rem 1rem;
}

.rooms-list li {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
}

.rooms-list li:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.rooms-list li.active {
  background-color: var(--primary-color);
}

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-light);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background-color: white;
  border-bottom: 1px solid var(--border-color);
}

.chat-header h2 {
  font-size: 1.25rem;
  margin-bottom: 0;
}

.room-info {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-light);
}

.room-info span {
  margin-right: 0.5rem;
}

.messages {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  background-color: var(--bg-color);
}

.message {
  display: flex;
  margin-bottom: 1.5rem;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #ddd;
  margin-right: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  background-color: var(--primary-color);
}

.message-content {
  flex: 1;
  max-width: 70%;
}

.message-header {
  display: flex;
  align-items: baseline;
  margin-bottom: 0.25rem;
}

.message-sender {
  font-weight: 600;
  margin-right: 0.5rem;
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-lighter);
}

.message-body {
  background-color: white;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.own {
  flex-direction: row-reverse;
}

.message.own .message-avatar {
  margin-right: 0;
  margin-left: 1rem;
}

.message.own .message-content {
  align-items: flex-end;
}

.message.own .message-header {
  justify-content: flex-end;
}

.message.own .message-body {
  background-color: var(--primary-color);
  color: white;
}

.message.admin .message-body {
  background-color: var(--warning-color);
  color: white;
  font-weight: 500;
}

.input-area {
  padding: 1rem 1.5rem;
  background-color: white;
  border-top: 1px solid var(--border-color);
}

.input-area form {
  display: flex;
}

.input-area input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-right: 0.5rem;
  font-size: 1rem;
}

.input-area input:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Admin panel styles */
.admin-container {
  height: 100vh;
}

.admin-panel {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background-color: #2c3e50;
  color: white;
}

.admin-header h1 {
  font-size: 1.5rem;
  color: white;
  margin-bottom: 0;
}

.admin-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.admin-sidebar {
  width: 280px;
  background-color: #34495e;
  color: white;
  padding: 1.5rem;
  overflow-y: auto;
}

.admin-actions {
  margin-bottom: 2rem;
}

.admin-actions h3 {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.admin-main {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.room-details h2 {
  margin-bottom: 1rem;
}

.room-actions, .room-stats, .members-list {
  margin-top: 2rem;
}

.action-group {
  margin-bottom: 1.5rem;
}

.action-group h4 {
  margin-bottom: 0.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.stat-box {
  background-color: white;
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-box h4 {
  color: var(--text-light);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
}

.members-list ul {
  list-style: none;
}

.members-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background-color: white;
  border-radius: var(--border-radius);
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.member-info {
  display: flex;
  flex-direction: column;
}

.member-name {
  font-weight: 500;
}

.member-email {
  font-size: 0.875rem;
  color: var(--text-light);
}

.member-status {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 20px;
}

.member-status.online {
  background-color: var(--secondary-color);
  color: white;
}

.member-status.offline {
  background-color: var(--danger-color);
  color: white;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  padding: 2rem;
  border-radius: var(--border-radius);
  width: 500px;
  max-width: 90%;
  box-shadow: var(--shadow);
}

.close-btn {
  position: absolute;
  right: 1rem;
  top: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-lighter);
}

.close-btn:hover {
  color: var(--text-color);
}

/* Notification panel styles */
.notification-panel, 
.settings-panel,
.room-info-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 350px;
  height: 100vh;
  background-color: white;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 900;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.notification-panel.show,
.settings-panel.show,
.room-info-panel.show {
  transform: translateX(0);
}

.notification-header,
.settings-header,
.room-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.notification-header h3,
.settings-header h3,
.room-info-header h3 {
  margin-bottom: 0;
}

.notifications-list,
.settings-content,
.room-info-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.notification-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

.notification-item:hover {
  background-color: var(--bg-color);
}

.notification-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.notification-body {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.notification-time {
  font-size: 0.75rem;
  color: var(--text-lighter);
}

.notification-item.unread {
  border-left: 3px solid var(--primary-color);
}

/* Settings panel styles */
.settings-group {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.settings-group h4 {
  margin-bottom: 1rem;
}

.toggle-setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.time-setting {
  margin-top: 1rem;
}

.time-inputs {
  display: flex;
  align-items: center;
  margin-top: 0.5rem;
}

.time-inputs input {
  width: 100px;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

.time-inputs span {
  margin: 0 0.5rem;
}

.select-setting {
  margin-bottom: 1rem;
}

.select-setting select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background-color: white;
}

/* Room info panel styles */
.room-description {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.room-created,
.room-date {
  margin-bottom: 0.5rem;
  color: var(--text-light);
}

.room-members-list {
  list-style: none;
  margin-top: 1rem;
}

.room-members-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

/* Invite link container */
#invite-link-container {
  margin-top: 1rem;
}

#invite-link {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  cursor: text;
}

.expires-text {
  font-size: 0.875rem;
  color: var(--text-light);
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .chat-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: 200px;
    overflow-y: auto;
  }
  
  .admin-content {
    flex-direction: column;
  }
  
  .admin-sidebar {
    width: 100%;
    height: auto;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .notification-panel,
  .settings-panel,
  .room-info-panel {
    width: 100%;
  }
}

/* Dark theme styles */
body.dark-theme {
  --text-color: #e1e1e1;
  --text-light: #b0b0b0;
  --text-lighter: #808080;
  --bg-color: #121212;
  --bg-light: #1e1e1e;
  --border-color: #2d2d2d;
}

body.dark-theme .auth-container,
body.dark-theme .chat-area,
body.dark-theme .input-area,
body.dark-theme .chat-header,
body.dark-theme .modal-content,
body.dark-theme .notification-panel,
body.dark-theme .settings-panel,
body.dark-theme .room-info-panel {
  background-color: var(--bg-light);
}

body.dark-theme .message-body {
  background-color: #2d2d2d;
}

body.dark-theme .stat-box,
body.dark-theme .members-list li {
  background-color: #2d2d2d;
}

body.dark-theme .message.own .message-body {
  background-color: var(--primary-color);
}

/* Animation styles */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-fadeIn {
  animation: fadeIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.animate-slideIn {
  animation: slideIn 0.3s ease;
}

/* Loading indicator */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}