/* All CSS from the <style> block in index.html goes here */
:root {
  --contacts-width: 320px;
  --bg: #f0f0f0;
  --sidebar-bg: #fff;
  --main-bg: #f9f9f9;
  --header-bg: #fff;
  --text: #222;
  --primary: #4285F4;
  --secondary: #34A853;
  --danger: #EA4335;
  --contact-selected: #e3f0fd;
  --message-self: #e3f0fd;
  --message-other: #fff;
  --input-bg: #fff;
  --input-border: #ccc;
  --modal-bg: #fff;
  --modal-text: #222;
}
[data-theme="dark"] {
  --bg: #181a1b;
  --sidebar-bg: #23272a;
  --main-bg: #181a1b;
  --header-bg: #23272a;
  --text: #f0f0f0;
  --primary: #8ab4f8;
  --secondary: #57e389;
  --danger: #f28b82;
  --contact-selected: #23272a;
  --message-self: #23272a;
  --message-other: #181a1b;
  --input-bg: #23272a;
  --input-border: #444;
  --modal-bg: #23272a;
  --modal-text: #f0f0f0;
}
body {
  font-family: 'Roboto', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
}
.container {
  display: flex;
  height: 100vh;
  transition: all 0.2s;
}
.sidebar {
  width: var(--contacts-width);
  min-width: 180px;
  max-width: 100vw;
  background: var(--sidebar-bg);
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  padding: 0 0 10px 0;
  transition: width 0.2s, left 0.2s;
  z-index: 100;
}
.sidebar-header {
  padding: 20px 20px 10px 20px;
  font-size: 1.2em;
  font-weight: bold;
  color: var(--primary);
  border-bottom: 1px solid #e0e0e0;
}
.contacts {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
}
.contact {
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s;
  font-size: 1.08em;
}
.contact.selected {
  background: var(--contact-selected);
}
.contact .status {
  font-size: 0.9em;
  color: #888;
}
.add-contact {
  display: flex;
  padding: 10px 20px;
  border-top: 1px solid #e0e0e0;
}
.add-contact input {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  font-size: 1em;
  background: var(--input-bg);
  color: var(--text);
}
.add-contact button {
  margin-left: 8px;
  padding: 8px 14px;
  background: #FABB05;
  border: none;
  border-radius: 3px;
  color: #222;
  font-weight: bold;
  cursor: pointer;
  font-size: 1em;
}
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--main-bg);
  min-width: 0;
}
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--header-bg);
  border-bottom: 1px solid #e0e0e0;
  color: var(--text);
  min-height: 56px;
}
.header .user {
  font-weight: bold;
  color: var(--primary);
}
.header .profile {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header .profile img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: none;
}
.header .logout {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 10px 18px;
  font-weight: bold;
  cursor: pointer;
  font-size: 1.08em;
}
.header .sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 2em;
  margin-right: 10px;
  cursor: pointer;
  color: var(--primary);
}
.chat-area {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: var(--main-bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.message {
  margin-bottom: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  max-width: 80%;
  word-break: break-word;
  background: var(--message-other);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  font-size: 1.08em;
}
.message.self {
  background: var(--message-self);
  align-self: flex-end;
}
.message.other {
  background: var(--message-other);
  align-self: flex-start;
}
.input-area {
  display: flex;
  padding: 16px 24px;
  background: var(--input-bg);
  border-top: 1px solid var(--input-border);
}
.input-area input {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  font-size: 1.08em;
  background: var(--input-bg);
  color: var(--text);
}
.input-area button {
  margin-left: 8px;
  padding: 12px 18px;
  background: var(--primary);
  border: none;
  border-radius: 3px;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  font-size: 1.08em;
}
.login-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: #f0f0f0;
}
.login-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 14px 28px;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
  margin-top: 20px;
}
#settings-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.3);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
#settings-modal > div {
  background: var(--modal-bg);
  color: var(--modal-text);
  padding: 24px 32px;
  border-radius: 8px;
  min-width: 260px;
  max-width: 90vw;
  box-shadow: 0 2px 16px rgba(0,0,0,0.15);
}
#settings-modal h3 {
  margin-top: 0;
}
#settings-modal label {
  display: block;
  margin-bottom: 12px;
}
#settings-modal input[type="radio"] {
  margin-right: 8px;
}
#settings-modal button {
  margin-top: 10px;
}
/* Responsive styles for mobile */
@media (max-width: 700px) {
  .container {
    flex-direction: column;
    height: 100vh;
    min-height: 100vh;
  }
  .sidebar {
    position: fixed;
    left: -100vw;
    top: 0;
    height: 100vh;
    width: 80vw !important;
    max-width: 400px;
    min-width: 0;
    border-right: 1px solid #e0e0e0;
    border-bottom: none;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 2000;
    background: var(--sidebar-bg);
    transition: left 0.2s;
  }
  .sidebar.open {
    left: 0;
  }
  .main {
    min-width: 0;
    width: 100vw;
    margin-left: 0;
  }
  .header {
    padding: 8px 8px;
    min-height: 56px;
  }
  .header .sidebar-toggle {
    display: inline-block;
  }
  .contacts {
    display: block;
    height: auto;
    padding: 0;
  }
  .contact {
    min-width: 0;
    max-width: 100vw;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 14px 10px;
    font-size: 1.08em;
  }
  .chat-area {
    padding: 8px;
    min-height: 0;
    height: calc(100vh - 180px);
    max-height: 60vh;
  }
  .input-area {
    padding: 8px;
  }
  #settings-modal > div {
    min-width: 90vw;
    max-width: 98vw;
  }
}
.contact-options-btn {
  background: none;
  border: none;
  font-size: 1.1em;
  color: #888;
  cursor: pointer;
  margin-left: 4px;
  padding: 0;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.contact-options-btn:hover {
  background: #eee;
}
.contact-options-menu {
  display: none;
  position: fixed;
  right: auto;
  top: 0;
  left: 0;
  background: var(--modal-bg);
  color: var(--modal-text);
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  z-index: 3000;
  min-width: 120px;
  max-width: 90vw;
  max-height: 200px;
  overflow-y: auto;
}
.contact-options-menu button {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  font-size: 1em;
  color: var(--text);
  cursor: pointer;
}
.contact-options-menu button:hover {
  background: #f0f0f0;
} 