/* ==========================================================
   Facebook Automation MVP - Modern Clean Stylesheet
   ========================================================== */

:root {
  --primary: #1877f2;
  --primary-hover: #166fe5;
  --primary-light: #e7f3ff;
  --secondary: #42b72a;
  --secondary-hover: #36a420;
  --bg-main: #f0f2f5;
  --card-bg: #ffffff;
  --text-main: #1c1e21;
  --text-muted: #65676b;
  --border-color: #ced0d4;
  --border-light: #e4e6eb;
  --danger: #fa383e;
  --danger-light: #ffebe8;
  --warning: #f5a623;
  --warning-light: #fff8e6;
  --success: #00a400;
  --success-light: #e6f6e6;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navigation */
.navbar {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-light);
  padding: 0.85rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.nav-brand svg {
  width: 28px;
  height: 28px;
  fill: var(--primary);
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-link {
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
}

/* Page Layout */
.container {
  max-width: 1000px;
  width: 100%;
  margin: 1.8rem auto;
  padding: 0 1rem;
  flex: 1;
}

/* Cards */
.card {
  background-color: var(--card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: var(--transition);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-connected {
  background-color: var(--success-light);
  color: var(--success);
}

.badge-disconnected {
  background-color: var(--danger-light);
  color: var(--danger);
}

.badge-warning {
  background-color: var(--warning-light);
  color: #b26a00;
}

.badge-info {
  background-color: var(--primary-light);
  color: var(--primary);
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

input[type="text"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.2);
}

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

.help-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

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

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

.btn-secondary {
  background-color: #e4e6eb;
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: #d8dadf;
}

.btn-success {
  background-color: var(--secondary);
  color: #fff;
}

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

.btn-danger {
  background-color: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background-color: #e0282e;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Switch Toggle */
.switch-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background-color: var(--bg-main);
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
}

.switch-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--secondary);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Alert Banners */
.alert {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert-success {
  background-color: var(--success-light);
  color: #0b600b;
  border-left: 4px solid var(--success);
}

.alert-danger {
  background-color: var(--danger-light);
  color: #a31519;
  border-left: 4px solid var(--danger);
}

.alert-info {
  background-color: var(--primary-light);
  color: #0d4fa8;
  border-left: 4px solid var(--primary);
}

.alert-warning {
  background-color: var(--warning-light);
  color: #8c5200;
  border-left: 4px solid var(--warning);
}

/* Tables & Lists */
.table-responsive {
  overflow-x: auto;
  margin-top: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

th {
  background-color: #f7f8fa;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

tbody tr:hover {
  background-color: #fafbfc;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 1.5rem;
}

.tab-btn {
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: white;
  border-radius: var(--radius-md);
  max-width: 650px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

/* Pre / JSON code display */
pre.code-block {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  overflow-x: auto;
  font-family: Consolas, Monaco, "Andale Mono", monospace;
  margin-top: 0.5rem;
}

/* Checklist and Diagnostic Cards */
.checklist-card {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-light);
}
.checklist-item:last-child {
  border-bottom: none;
}

.tag-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  margin: 0.15rem;
}

.simulation-box {
  background: #fdfdfd;
  border: 1px dashed var(--primary);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  background: #fff;
  margin-top: auto;
}
