/* === GLOBAL LAYOUT === */
body {
  font-family: 'Segoe UI', Roboto, sans-serif;
  background: #f6f8fb;
  color: #333;
  margin: 0;
  padding: 0;
}

.page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

/* === HEADER === */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e3a8a;
  color: white;
  padding: 15px 25px;
  border-radius: 12px;
  margin-bottom: 25px;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

header nav a {
  color: white;
  text-decoration: none;
  margin-left: 20px;
  font-weight: 500;
  transition: opacity 0.2s;
}

header nav a:hover {
  opacity: 0.8;
}

header nav a.active {
  text-decoration: underline;
  font-weight: 600;
}

.dashboard-container {
  flex: 1;
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 20px;
}

.new-campaign-btn {
  background-color: #2563eb;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}

.new-campaign-btn:hover {
  background-color: #1e40af;
}

/* Stats Cards */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  text-align: center;
  padding: 20px;
}

.stat-card h3 {
  font-size: 16px;
  color: #6b7280;
}

.stat-card p {
  font-size: 24px;
  color: #1e3a8a;
  font-weight: 700;
  margin-top: 6px;
}

/* Campaign Table */
.campaigns h2 {
  margin-bottom: 16px;
  color: #111827;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

th, td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

th {
  background-color: #f3f4f6;
  font-weight: 600;
  color: #374151;
}

.status {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-transform: capitalize;
}

.status.success {
  background: #dcfce7;
  color: #166534;
}

.status.scheduled {
  background: #fef9c3;
  color: #854d0e;
}

.view-btn, .delete-btn {
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.view-btn {
  background: #2563eb;
  color: white;
  margin-right: 8px;
}

.view-btn:hover {
  background: #1e40af;
}

.delete-btn {
  background: #ef4444;
  color: white;
}

.delete-btn:hover {
  background: #b91c1c;
}

/* === SECTIONS === */
section {
  background: white;
  padding: 20px;
  margin-bottom: 25px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

section h2 {
  margin-top: 0;
  color: #1e3a8a;
}

/* === BUTTONS === */
button {
  background: #1e3a8a;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

button:hover {
  background: #2e4cc9;
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* === INPUTS & TABLES === */
input, textarea, select {
  width: 50%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin: 6px 0 12px;
  font-size: 0.95rem;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

table, th, td {
  border: 1px solid #ddd;
}

th, td {
  padding: 8px;
  text-align: left;
}

/* === UTILITIES === */
.hidden {
  display: none;
}

.tip {
  font-size: 0.9rem;
  color: #555;
}

/* === NUMBER PAGE === */
.number-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #ddd;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 10px;
  background: #fafafa;
}

.number-card span {
  font-weight: 500;
}

.number-actions button {
  margin-left: 10px;
}

/* === Upload Section === */
.upload-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.upload-box input[type="file"] {
  border: 1px solid #cbd5e1;
  padding: 0.5rem;
  border-radius: 6px;
}

.upload-box button {
  background-color: #2563eb;
  color: white;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s ease;
}

.upload-box button:hover {
  background-color: #1d4ed8;
}

/* === Preview Table === */
#previewContainer {
  margin-top: 1rem;
}

#previewTable {
  border-collapse: collapse;
  width: 100%;
  margin-top: 0.5rem;
  border: 1px solid #e2e8f0;
}

#previewTable th,
#previewTable td {
  border: 1px solid #e2e8f0;
  padding: 0.5rem;
  text-align: left;
}

#previewTable th {
  background-color: #f1f5f9;
  font-weight: 600;
}

.mapping {
  margin-top: 1rem;
}

.mapping label {
  display: block;
  margin-bottom: 0.5rem;
}

.mapping select {
  margin-left: 0.5rem;
  padding: 0.3rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}

/* === Manual Entry === */
.manual-entry textarea {
  width: 100%;
  height: 120px;
  margin-top: 0.5rem;
  padding: 0.7rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  resize: vertical;
  font-family: monospace;
}

.manual-entry button {
  margin-top: 0.5rem;
  background-color: #10b981;
  color: white;
  border: none;
  padding: 0.7rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.manual-entry button:hover {
  background-color: #059669;
}

/* === Message Section === */
.message-section textarea {
  width: 100%;
  height: 120px;
  padding: 0.7rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  resize: vertical;
  font-family: "Inter", Arial, sans-serif;
}

.message-section .tip {
  font-size: 0.9rem;
  color: #475569;
  margin-top: 0.5rem;
}

/* === Send Section === */
.send-section {
  background-color: #f8fafc;
}

.send-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.send-controls label {
  font-weight: 500;
}

.send-controls input[type="text"],
.send-controls input[type="datetime-local"] {
  width: 50%;
  max-width: 350px;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
}

.send-type {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4rem;
}

.send-type label {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* === Status Panel === */
.send-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.status-panel {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  min-width: 220px;
  font-size: 0.9rem;
  color: #1e293b;
}

.status-panel p {
  margin: 0.2rem 0;
}

.status-panel strong {
  color: #0f172a;
}

#retryBtn {
  background-color: #facc15;
  color: #1e293b;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
}

#retryBtn:hover {
  background-color: #eab308;
}

#sendBtn {
  background-color: #2563eb;
  color: white;
  border: none;
  padding: 0.7rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  align-self: flex-start;
  transition: 0.2s;
}

#sendBtn:hover {
  background-color: #1d4ed8;
}

.hidden {
  display: none;
}

/* === Responsive === */
@media (max-width: 768px) {
  .send-controls input[type="text"],
  .send-controls input[type="datetime-local"] {
    width: 100%;
  }

  .upload-box {
    flex-direction: column;
    align-items: stretch;
  }

  .manual-entry button {
    width: 100%;
  }

  .send-row {
    flex-direction: column;
  }

  .status-panel {
    width: 100%;
  }
}

/* === MESSAGES PAGE === */
.filter-controls {
  margin-bottom: 1rem;
}

.filter-controls select {
  width: auto;
  margin-left: 0.5rem;
}

.message-row {
  cursor: pointer;
  transition: background-color 0.2s;
}

.message-row:hover {
  background-color: #f8fafc;
}

.unread-dot {
  color: #ef4444;
  font-weight: bold;
  margin-left: 0.5rem;
}

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

.modal.hidden {
  display: none !important;
}


.modal-content {
  background: white;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  border-radius: 12px;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header button {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
}

.conversation-history {
  height: 400px;
  overflow-y: auto;
  padding: 1rem;
}

.message {
  margin-bottom: 1rem;
  max-width: 70%;
}

.message.sent {
  margin-left: auto;
  text-align: right;
}

.message.received {
  margin-right: auto;
}

.message p {
  background: #e5e7eb;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  margin: 0 0 0.25rem 0;
}

.message.sent p {
  background: #2563eb;
  color: white;
}

.message .time {
  font-size: 0.75rem;
  color: #6b7280;
}

.reply-section {
  padding: 1rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 0.5rem;
}

.reply-section textarea {
  flex: 1;
  height: 60px;
  resize: none;
  margin: 0;
}

.reply-section button {
  align-self: flex-end;
  height: fit-content;
}

#unreadIndicator {
  color: #ef4444;
  font-weight: bold;
}

