/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #1DA1F2;
  --primary-hover: #1991db;
  --secondary-color: #14171A;
  --dark-gray: #657786;
  --light-gray: #AAB8C2;
  --extra-light-gray: #E1E8ED;
  --background: #F5F8FA;
  --white: #FFFFFF;
  --error: #E0245E;
  --success: #17BF63;
  --border-color: #E1E8ED;
  --text-color: #14171A;
  --link-color: #1DA1F2;
  --max-width: 1200px;
  --sidebar-width: 275px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  color: var(--text-color);
  background-color: var(--background);
  line-height: 1.5;
}

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

a:hover {
  text-decoration: underline;
}

/* Layout */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.app-container {
  display: flex;
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
}

/* Header */
.main-header {
  background: var(--white);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.main-header nav {
  display: flex;
  align-items: center;
  height: 53px;
}

.main-header .container {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 20px;
  font-weight: bold;
  color: var(--primary-color);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 5px;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

/* Sidebars */
.sidebar-left {
  width: var(--sidebar-width);
  padding: 20px;
  border-right: 1px solid var(--border-color);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  border-radius: 30px;
  color: var(--text-color);
  font-size: 20px;
  transition: background-color 0.2s;
}

.sidebar-link:hover {
  background-color: rgba(29, 161, 242, 0.1);
  text-decoration: none;
}

.sidebar-link .icon {
  font-size: 24px;
}

.tweet-button {
  width: 100%;
  margin-top: 20px;
  padding: 15px;
  border-radius: 30px;
  font-size: 17px;
  font-weight: bold;
}

.main-content {
  flex: 1;
  max-width: 600px;
  border-right: 1px solid var(--border-color);
  min-height: 100vh;
}

.sidebar-right {
  width: 350px;
  padding: 20px;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 20px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--white);
}

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

.btn-secondary {
  background-color: var(--white);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.btn-secondary:hover {
  background-color: rgba(29, 161, 242, 0.1);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  font-size: 15px;
}

.btn-logout:hover {
  text-decoration: underline;
}

/* Tweet Styles */
.tweet-card {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--white);
  transition: background-color 0.2s;
}

.tweet-card:hover {
  background-color: var(--background);
}

.tweet-header {
  display: flex;
  align-items: flex-start;
  margin-bottom: 10px;
}

.tweet-meta {
  flex: 1;
  margin-left: 10px;
}

.tweet-content {
  margin-bottom: 10px;
  word-wrap: break-word;
}

.tweet-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  max-width: 425px;
}

.btn-action {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--dark-gray);
  padding: 8px 12px;
  border-radius: 20px;
  transition: all 0.2s;
}

.btn-action:hover {
  background-color: rgba(29, 161, 242, 0.1);
  color: var(--primary-color);
}

.btn-action.active {
  color: var(--primary-color);
}

.tweet-time {
  color: var(--dark-gray);
  font-size: 14px;
}

/* Avatar Styles */
.avatar {
  border-radius: 50%;
  object-fit: cover;
}

.avatar-small {
  width: 48px;
  height: 48px;
}

.avatar-medium {
  width: 64px;
  height: 64px;
}

.avatar-large {
  width: 128px;
  height: 128px;
}

/* User Styles */
.user-link {
  font-weight: bold;
  color: var(--text-color);
}

.user-link:hover {
  text-decoration: underline;
}

.verified {
  color: var(--primary-color);
  margin-left: 2px;
}

/* Tweet Composer */
.tweet-composer {
  padding: 20px;
  border-bottom: 10px solid var(--border-color);
  background: var(--white);
}

.composer-input textarea {
  width: 100%;
  min-height: 50px;
  padding: 10px;
  border: none;
  resize: none;
  font-size: 20px;
  font-family: inherit;
}

.composer-input textarea:focus {
  outline: none;
}

.composer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.char-count {
  color: var(--dark-gray);
}

/* Forms */
.auth-container {
  max-width: 400px;
  margin: 50px auto;
  padding: 30px;
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  font-size: 16px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.help-text {
  display: block;
  margin-top: 5px;
  color: var(--dark-gray);
  font-size: 14px;
}

.auth-link {
  text-align: center;
  margin-top: 20px;
}

/* Error and Success Messages */
.error {
  background-color: #FEE;
  color: var(--error);
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 20px;
  border: 1px solid #FCC;
}

.success {
  background-color: #EFE;
  color: var(--success);
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 20px;
  border: 1px solid #CFC;
}

/* Page Headers */
.page-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--white);
  position: sticky;
  top: 53px;
  z-index: 50;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 800;
}

/* Notifications */
.notification {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--white);
  display: flex;
  align-items: center;
  gap: 10px;
}

.notification.unread {
  background-color: rgba(29, 161, 242, 0.05);
}

.notification time {
  color: var(--dark-gray);
  font-size: 14px;
  margin-left: auto;
}

.tweet-preview {
  margin-top: 5px;
  padding: 10px;
  background: var(--background);
  border-radius: 5px;
  font-size: 14px;
  color: var(--dark-gray);
}

/* Search Box */
.search-box {
  margin-bottom: 20px;
}

.search-box input {
  width: 100%;
  padding: 10px 20px;
  border: none;
  border-radius: 30px;
  background-color: var(--background);
  font-size: 15px;
}

.search-box input:focus {
  outline: none;
  background-color: var(--white);
  border: 1px solid var(--primary-color);
}

/* Widgets */
.widget {
  background: var(--white);
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.widget h3 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 15px;
}

/* Profile Styles */
.profile-header {
  height: 200px;
  background-color: var(--primary-color);
  background-size: cover;
  background-position: center;
  position: relative;
}

.profile-header-content {
  position: absolute;
  bottom: -64px;
  left: 20px;
  display: flex;
  align-items: flex-end;
  gap: 20px;
}

.profile-info {
  padding: 80px 20px 20px;
  background: var(--white);
}

.profile-meta {
  display: flex;
  gap: 15px;
  margin: 15px 0;
  color: var(--dark-gray);
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.profile-stats {
  display: flex;
  gap: 20px;
  margin-top: 15px;
}

.profile-stats .stat {
  color: var(--text-color);
}

.profile-stats .stat:hover {
  text-decoration: underline;
}

.profile-nav {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--white);
}

.profile-nav a {
  flex: 1;
  padding: 15px;
  text-align: center;
  color: var(--dark-gray);
  font-weight: bold;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.profile-nav a:hover {
  background-color: rgba(29, 161, 242, 0.1);
  text-decoration: none;
}

.profile-nav a.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

/* Loading */
.htmx-indicator {
  display: none;
  color: var(--dark-gray);
  padding: 10px;
}

.htmx-request .htmx-indicator {
  display: block;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--dark-gray);
}

/* Responsive */
@media (max-width: 1200px) {
  .sidebar-right {
    display: none;
  }
}

@media (max-width: 768px) {
  .sidebar-left {
    display: none;
  }
  
  .main-content {
    max-width: 100%;
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .nav-links {
    display: none;
  }
  
  .tweet-actions {
    max-width: 100%;
  }
}