/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header {
  background: #1E4C2C;
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.5rem;
  margin: 0;
}

header nav a {
  color: white;
  text-decoration: none;
  margin-left: 1.5rem;
  transition: opacity 0.2s;
}

header nav a:hover {
  opacity: 0.8;
}

header nav a.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-link-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.platform-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  line-height: 1;
}

.platform-icon-svg {
  width: 1rem;
  height: 1rem;
  display: block;
  fill: currentColor;
}

.social-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

/* Main content */
main {
  padding: 2rem 0;
  min-height: calc(100vh - 140px);
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.app-shell.app-shell-with-left {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 20px;
}

.app-shell.app-shell-no-left {
  grid-template-columns: minmax(0, 1fr);
}

.left-nav {
  background: white;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  padding: 1rem;
  position: sticky;
  top: 1rem;
}

.left-nav h3 {
  font-size: 0.95rem;
  color: #2c3e50;
  margin-bottom: 0.75rem;
}

.left-nav-link {
  display: block;
  text-decoration: none;
  color: #2c3e50;
  padding: 0.5rem 0.6rem;
  border: 1px solid #d6dce1;
  border-radius: 4px;
  transition: background 0.2s;
}

.left-nav-link-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.left-nav-link:hover {
  background: #f3f7fa;
}

.content-area {
  min-width: 0;
}

.app-shell.app-shell-with-left .content-area {
  padding-right: 20px;
}

.instagram-two-col {
  display: grid;
  grid-template-columns: 30% 70%;
  gap: 1rem;
  align-items: start;
}

.instagram-examples-col {
  min-width: 0;
}

.instagram-form-col {
  min-width: 0;
}

.instagram-examples-panel {
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

.instagram-result-actions {
  margin-top: 0.75rem;
  margin-bottom: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.instagram-result-actions .btn {
  min-width: 170px;
  text-align: center;
}

/* Footer */
footer {
  background: #34495e;
  color: white;
  text-align: center;
  padding: 1rem 0;
  margin-top: 2rem;
}

footer p {
  margin: 0;
  font-size: 0.9rem;
}

/* Login */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
}

.login-box h1 {
  text-align: center;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.login-box h2 {
  text-align: center;
  color: #7f8c8d;
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  font-weight: normal;
}

/* Page header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e0e0e0;
}

.page-header h2 {
  color: #2c3e50;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.actions {
  display: flex;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #ecf0f1;
  color: #2c3e50;
  text-decoration: none;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.btn:hover {
  background: #bdc3c7;
}

.btn-primary {
  background: #3498db;
  color: white;
  border-color: #2980b9;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-active {
  background: #2ecc71;
  color: white;
  border-color: #27ae60;
}

/* Filters */
.filters {
  background: white;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filters form {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-size: 0.85rem;
  color: #7f8c8d;
  font-weight: 500;
}

.filter-group input,
.filter-group select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
}

/* Tables */
.table-container {
  background: white;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: #34495e;
  color: white;
}

thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
}

tbody tr {
  border-bottom: 1px solid #e0e0e0;
}

tbody tr:hover {
  background: #f8f9fa;
}

tbody td {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

tbody td a {
  color: #3498db;
  text-decoration: none;
}

tbody td a:hover {
  text-decoration: underline;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Status badges */
.badge-new { background: #ecf0f1; color: #2c3e50; }
.badge-researched { background: #3498db; color: white; }
.badge-contacted { background: #9b59b6; color: white; }
.badge-engaged { background: #f39c12; color: white; }
.badge-trial_granted { background: #e67e22; color: white; }
.badge-wrote_about { background: #27ae60; color: white; }
.badge-declined { background: #e74c3c; color: white; }
.badge-paused { background: #95a5a6; color: white; }

/* Risk badges */
.badge-low { background: #2ecc71; color: white; }
.badge-medium { background: #f39c12; color: white; }
.badge-high { background: #e74c3c; color: white; }

/* Channel badges */
.badge-email { background: #3498db; color: white; }
.badge-x_dm, .badge-x_reply { background: #000; color: white; }
.badge-linkedin_dm { background: #0077b5; color: white; }
.badge-contact_form { background: #9b59b6; color: white; }
.badge-call { background: #27ae60; color: white; }
.badge-other { background: #95a5a6; color: white; }

/* Direction badges */
.badge-outbound { background: #e67e22; color: white; }
.badge-inbound { background: #2ecc71; color: white; }

/* Outcome badges */
.badge-replied { background: #3498db; color: white; }
.badge-tried_product { background: #9b59b6; color: white; }
.badge-wrote_about { background: #27ae60; color: white; }
.badge-declined { background: #e74c3c; color: white; }

/* Forms */
.form {
  background: white;
  padding: 2rem;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.form-group label {
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: #2c3e50;
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e0e0e0;
}

/* Errors */
.errors {
  background: #fee;
  border: 1px solid #fcc;
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.errors h3 {
  color: #c33;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.errors ul {
  margin-left: 1.5rem;
  color: #c33;
}

.errors li {
  margin-bottom: 0.25rem;
}

.error {
  background: #fee;
  border: 1px solid #fcc;
  color: #c33;
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.success {
  background: #eafaf1;
  border: 1px solid #bfe8cf;
  color: #1e8449;
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* Detail view */
.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.detail-section {
  background: white;
  padding: 1.5rem;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.detail-section h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e0e0e0;
}

.detail-section dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.5rem 1rem;
}

.detail-section dt {
  font-weight: 600;
  color: #7f8c8d;
  font-size: 0.85rem;
}

.detail-section dd {
  color: #2c3e50;
  font-size: 0.9rem;
}

.inline-form select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Timeline */
.timeline {
  margin-top: 1rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #e0e0e0;
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-date {
  color: #7f8c8d;
  font-size: 0.85rem;
  font-weight: 500;
}

.timeline-header {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.timeline-content p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.timeline-content a {
  color: #3498db;
  text-decoration: none;
}

.timeline-content a:hover {
  text-decoration: underline;
}

/* Playbook */
.playbook-section {
  margin-bottom: 1rem;
}

.playbook-list {
  margin-top: 0.75rem;
  margin-left: 1.25rem;
}

.playbook-list li {
  margin-bottom: 0.35rem;
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 0.75rem;
}

.platform-card {
  border: 1px solid #e6eaf0;
  border-radius: 8px;
  padding: 0.9rem;
  background: #fafcff;
}

.platform-card p {
  margin-top: 0.35rem;
}

.platform-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.platform-title h4 {
  color: #2c3e50;
  font-size: 1rem;
}

.platform-icon {
  width: 18px;
  height: 18px;
}

/* Posts generator */
.posts-section {
  margin-bottom: 1rem;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.post-output {
  background: #f7f9fb;
  border: 1px solid #e3e8ee;
  border-radius: 6px;
  padding: 0.75rem;
  font-family: inherit;
  font-size: 0.9rem;
  white-space: pre-wrap;
  line-height: 1.45;
  margin: 0.4rem 0 0.75rem;
}

.generated-slide {
  width: 100%;
  border: 1px solid #e3e8ee;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .detail-grid {
    grid-template-columns: 1fr;
  }
  
  .timeline-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .detail-section dl {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  
  .detail-section dt {
    margin-top: 0.5rem;
  }

  .platform-grid {
    grid-template-columns: 1fr;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }
  
  .chat-container {
    max-width: 800px;
    margin: 0 auto;
  }
  
  .chat-messages {
    max-height: 400px;
  }
  
  .chat-input-container form {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .chat-input-container input {
    width: 100%;
  }
  
  .chat-widget {
    width: 100%;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px 12px 0 0;
    max-height: 70vh;
  }
  
  .chat-widget.minimized {
    max-height: 60px;
  }
  
  .chat-widget-body {
    height: calc(70vh - 60px);
  }
}

/* Chat Styles */
.chat-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
  max-width: 900px;
  margin: 0 auto;
}

/* Floating Chat Widget */
.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 380px;
  max-height: 600px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: all 0.3s ease;
}

.chat-widget.minimized {
  max-height: 60px;
}

.chat-widget-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 12px 12px 0 0;
  user-select: none;
}

.chat-widget-header span {
  font-weight: 600;
  font-size: 1rem;
}

.chat-toggle {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.chat-toggle:hover {
  background: rgba(255,255,255,0.3);
}

.chat-widget-body {
  display: flex;
  flex-direction: column;
  height: 540px;
  overflow: hidden;
}

.chat-messages {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
}

.chat-widget .chat-messages {
  padding: 1rem;
  max-height: none;
  height: auto;
}

.chat-message {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #3498db;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.chat-message.user .message-avatar {
  background: #2ecc71;
}

.message-content {
  flex: 1;
  background: white;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chat-message.user .message-content {
  background: #e3f2fd;
}

.message-content strong {
  display: block;
  margin-bottom: 0.5rem;
  color: #2c3e50;
  font-size: 0.9rem;
}

.message-content p {
  margin: 0.5rem 0;
  color: #333;
  line-height: 1.5;
}

.message-content ul {
  margin: 0.5rem 0 0.5rem 1.5rem;
  color: #333;
}

.message-content li {
  border-radius: 0 0 12px 12px;
}

.chat-widget .chat-input-container {
  padding: 0.75rem;
  margin: 0.25rem 0;
}

.chat-input-container {
  padding: 1rem;
  background: white;
}

.chat-input-container form {
  display: flex;
  gap: 0.75rem;
}

.chat-input-container input {
  flex: 1;
 

.chat-widget .chat-input-container input {
  padding: 0.5rem;
  font-size: 0.85rem;
} padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.chat-widget .chat-input-container button {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.chat-widget .chat-message {
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.chat-widget .message-avatar {
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
}

.chat-widget .message-content {
  padding: 0.75rem;
  font-size: 0.85rem;
}

.chat-widget .message-content strong {
  font-size: 0.8rem;
}

.chat-input-container input:focus {
  outline: none;
  border-color: #3498db;
}

.chat-input-container button {
  padding: 0.75rem 1.5rem;
  white-space: nowrap;
}

.chat-input-container button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* AI Suggestions */
.suggestions-box {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
}

.suggestions-box pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
  margin: 0;
  line-height: 1.6;
}

.suggestions-box .loading {
  color: #7f8c8d;
  font-style: italic;
  margin: 0;
}

.suggestions-box .error {
  color: #e74c3c;
  margin: 0;
}
