:root {
  --primary-blue: #1e3a5f;
  --secondary-blue: #2c5282;
  --light-blue: #4299e1;
  --very-light-blue: #bee3f8;
  --dark-blue: #0f1e33;
  --text-light: #e2e8f0;
  --text-dark: #1a202c;
  --bg-dark: #0a1628;
  --bg-light: #f7fafc;
  --border-color: #2d3748;
  --success: #48bb78;
  --error: #f56565;
  --shadow: rgba(0, 0, 0, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--primary-blue) 100%);
  color: var(--text-light);
  min-height: 100vh;
  line-height: 1.6;
}

/* Navigation */
.navbar {
  background: var(--dark-blue);
  padding: 1rem 0;
  box-shadow: 0 2px 10px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar.hidden {
  display: none;
}

.nav-brand h1 {
  color: var(--light-blue);
  font-size: 1.8rem;
  margin-bottom: 0.2rem;
}

.tagline {
  font-size: 0.9rem;
  color: var(--very-light-blue);
  font-style: italic;
}

.nav-menu {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.nav-btn {
  background: transparent;
  border: 2px solid var(--light-blue);
  color: var(--light-blue);
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.nav-btn:hover {
  background: var(--light-blue);
  color: var(--dark-blue);
}

.badge {
  background: var(--error);
  color: white;
  border-radius: 50%;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  position: absolute;
  top: -8px;
  right: -8px;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Sections */
.section {
  display: none;
  min-height: calc(100vh - 120px);
  padding: 2rem 0;
}

.section.active {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  color: var(--very-light-blue);
  font-size: 2rem;
}

/* Auth Section */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2rem;
}

.auth-box {
  background: rgba(30, 58, 95, 0.9);
  padding: 3rem;
  border-radius: 15px;
  box-shadow: 0 10px 40px var(--shadow);
  max-width: 450px;
  width: 100%;
  border: 1px solid var(--secondary-blue);
}

.auth-box h2 {
  color: var(--very-light-blue);
  margin-bottom: 0.5rem;
  text-align: center;
}

.auth-subtitle {
  text-align: center;
  color: var(--light-blue);
  margin-bottom: 2rem;
  font-style: italic;
}

.tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.tab {
  flex: 1;
  padding: 0.75rem;
  background: transparent;
  border: 2px solid var(--secondary-blue);
  color: var(--text-light);
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.3s;
}

.tab.active {
  background: var(--light-blue);
  color: var(--dark-blue);
  border-color: var(--light-blue);
}

.auth-form input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--secondary-blue);
  border-radius: 5px;
  color: var(--text-light);
  font-size: 1rem;
}

.auth-form input::placeholder {
  color: var(--very-light-blue);
  opacity: 0.7;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s;
}

.btn-primary {
  background: var(--light-blue);
  color: var(--dark-blue);
  width: 100%;
}

.btn-primary:hover {
  background: var(--very-light-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}

.btn-secondary {
  background: var(--secondary-blue);
  color: var(--text-light);
}

/* Filters */
.filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.filters input,
.filters select {
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--secondary-blue);
  border-radius: 5px;
  color: var(--text-light);
  flex: 1;
}

.filters input::placeholder {
  color: var(--very-light-blue);
  opacity: 0.7;
}

/* Tags Cloud */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.tag {
  background: var(--secondary-blue);
  color: var(--very-light-blue);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s;
  border: 1px solid var(--light-blue);
}

.tag:hover {
  background: var(--light-blue);
  color: var(--dark-blue);
  transform: scale(1.05);
}

/* Quotes */
.quotes-list {
  display: grid;
  gap: 1.5rem;
}

.quote-card {
  background: rgba(44, 82, 130, 0.4);
  padding: 1.5rem;
  border-radius: 10px;
  border: 1px solid var(--secondary-blue);
  transition: all 0.3s;
}

.quote-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px var(--shadow);
  border-color: var(--light-blue);
}

.quote-text {
  font-size: 1.1rem;
  color: var(--very-light-blue);
  margin-bottom: 1rem;
  font-style: italic;
  line-height: 1.8;
}

.quote-reference {
  color: var(--light-blue);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

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

.quote-author {
  color: var(--text-light);
  font-size: 0.9rem;
}

.quote-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.like-btn {
  background: transparent;
  border: 2px solid var(--light-blue);
  color: var(--light-blue);
  padding: 0.4rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.like-btn.liked {
  background: var(--light-blue);
  color: var(--dark-blue);
}

.like-btn:hover {
  background: var(--light-blue);
  color: var(--dark-blue);
}

.quote-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Messages */
.messages-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  height: calc(100vh - 200px);
}

.conversations-panel,
.messages-panel {
  background: rgba(44, 82, 130, 0.4);
  border: 1px solid var(--secondary-blue);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.panel-header h3 {
  color: var(--very-light-blue);
}

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

.conversation-item:hover {
  background: rgba(66, 153, 225, 0.2);
}

.conversation-item.active {
  background: var(--secondary-blue);
}

.conversation-name {
  color: var(--very-light-blue);
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.conversation-preview {
  color: var(--text-light);
  font-size: 0.85rem;
  opacity: 0.8;
}

.unread-indicator {
  background: var(--light-blue);
  color: var(--dark-blue);
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  float: right;
}

.messages-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.message {
  margin-bottom: 1rem;
  padding: 0.75rem;
  border-radius: 10px;
  max-width: 70%;
}

.message.sent {
  background: var(--light-blue);
  color: var(--dark-blue);
  margin-left: auto;
}

.message.received {
  background: var(--secondary-blue);
  color: var(--text-light);
}

.message-time {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 0.25rem;
}

.message-input-container {
  border-top: 1px solid var(--border-color);
  padding: 1rem;
}

.message-input-box {
  display: flex;
  gap: 0.5rem;
}

.message-input-box input {
  flex: 1;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--secondary-blue);
  border-radius: 5px;
  color: var(--text-light);
}

.ratio-warning {
  background: rgba(245, 101, 101, 0.2);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 0.5rem;
  border-radius: 5px;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

/* Profile */
.profile-container {
  max-width: 600px;
  margin: 0 auto;
  background: rgba(44, 82, 130, 0.4);
  padding: 2rem;
  border-radius: 10px;
  border: 1px solid var(--secondary-blue);
}

.profile-form {
  margin-bottom: 2rem;
}

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

.form-group label {
  display: block;
  color: var(--very-light-blue);
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--secondary-blue);
  border-radius: 5px;
  color: var(--text-light);
  font-family: inherit;
}

.form-group input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.message-stats {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.message-stats h3 {
  color: var(--very-light-blue);
  margin-bottom: 1rem;
}

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

.stat-card {
  background: var(--secondary-blue);
  padding: 1.5rem;
  border-radius: 10px;
  text-align: center;
  border: 1px solid var(--light-blue);
}

.stat-value {
  font-size: 2rem;
  color: var(--light-blue);
  font-weight: bold;
}

.stat-label {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.ratio-info {
  text-align: center;
  color: var(--very-light-blue);
  font-style: italic;
  font-size: 0.9rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--primary-blue);
  padding: 2rem;
  border-radius: 10px;
  max-width: 500px;
  width: 90%;
  border: 1px solid var(--light-blue);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  color: var(--very-light-blue);
}

.close {
  color: var(--text-light);
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.3s;
}

.close:hover {
  color: var(--light-blue);
}

#addQuoteForm textarea,
#addQuoteForm input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--secondary-blue);
  border-radius: 5px;
  color: var(--text-light);
  font-family: inherit;
}

.search-results {
  max-height: 300px;
  overflow-y: auto;
  margin-top: 1rem;
}

.user-item {
  padding: 1rem;
  background: rgba(44, 82, 130, 0.6);
  margin-bottom: 0.5rem;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
  border: 1px solid var(--secondary-blue);
}

.user-item:hover {
  background: var(--secondary-blue);
  border-color: var(--light-blue);
}

/* Messages */
.error-msg,
.success-msg {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 5px;
  font-size: 0.9rem;
}

.error-msg {
  background: rgba(245, 101, 101, 0.2);
  color: var(--error);
  border: 1px solid var(--error);
}

.success-msg {
  background: rgba(72, 187, 120, 0.2);
  color: var(--success);
  border: 1px solid var(--success);
}

.hidden {
  display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--dark-blue);
}

::-webkit-scrollbar-thumb {
  background: var(--light-blue);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--very-light-blue);
}

/* Responsive */
@media (max-width: 768px) {
  .messages-layout {
    grid-template-columns: 1fr;
  }

  .conversations-panel {
    max-height: 200px;
  }

  .nav-menu {
    flex-wrap: wrap;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}
