/**
 * Satmo Admin Styles for Shopify
 * 
 * Consolidated styles for admin settings page
 * 
 * @package Satmo
 * @version 1.0.0
 */

/* ========================================
   CSS CUSTOM PROPERTIES
   ======================================== */

:root {
  --font-primary: 'Saans TRIAL', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --color-black-800: #2A2A2A;
  --color-black-700: #3C3C3C;
  --color-gray-600: #6B6B6B;
  --color-gray-500: #8D8D8D;
  --color-gray-200: #F0F0F0;
  --color-gray-100: #FAFAFA;
  --color-background: #EAEAEA;
  --color-white: #FFF;
  --color-orange: #FF5C19;
  --color-green: #2D7A5F;
  --color-green-bg: #CAE9DE;
  --color-red: #B93732;
  --color-red-bg: #F8E9E9;
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-elevated: 0 12px 35px rgba(23, 26, 31, 0.08);
}

/* ========================================
   BODY BACKGROUND
   ======================================== */

body {
  background: var(--color-background);
}

/* ========================================
   ADMIN WRAPPER & HEADER
   ======================================== */

.satmo-admin-wrapper {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 20px;
  font-family: var(--font-primary);
  background: var(--color-background);
  min-height: 100vh;
}

.satmo-admin-header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 32px;
  padding: 32px 0;
  margin-bottom: 20px;
  text-align: center;
}

.satmo-header-logo {
  flex-shrink: 0;
}

.satmo-header-logo-img {
  height: 32px;
  width: auto;
  display: block;
}

.satmo-header-text {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  margin-top: 8px;
}

.satmo-header-title {
  color: var(--color-black-700);
  text-align: center;
  font-family: var(--font-primary);
  font-size: 26px;
  font-weight: 500;
  line-height: 112%;
  margin: 0;
}

.satmo-header-description {
  color: var(--color-gray-600);
  text-align: center;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 600;
  line-height: 150%;
  margin: 0 0 0 0;
  margin-top: 7px;
  max-width: 720px;
}

.satmo-header-store {
  font-size: 14px;
  color: var(--color-gray-600);
  margin: -6px 0 6px;
  font-family: var(--font-primary);
}

.satmo-header-links {
  margin: -12px 0 0 0;
  padding: 0;
  display: flex;
  gap: 24px;
  align-items: center;
}

.satmo-header-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-orange);
  text-align: center;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 500;
  line-height: 150%;
  text-decoration: none;
}

.satmo-header-link svg {
  width: 14px;
  height: 14px;
}

.satmo-header-link:hover {
  text-decoration: underline;
}

/* ========================================
   ALERTS
   ======================================== */

.satmo-alert {
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 6px;
  border: 1px solid;
}

.satmo-alert-error {
  background-color: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.satmo-alert-success {
  background-color: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

/* ========================================
   MODULES CONTAINER
   ======================================== */

.satmo-modules-container {
  display: flex;
  flex-direction: column;
  gap: 48px;
  align-items: center;
}

/* ========================================
   MODULE LAYOUT
   ======================================== */

.satmo-module {
  width: 100%;
  max-width: 630px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ========================================
   MODULE INFO
   ======================================== */

.satmo-module-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  background: transparent;
  text-align: left;
}

.satmo-module-header {
  margin-bottom: 6px;
}

/* Shared styles for step header and title row */
.satmo-module-title-row,
.satmo-step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.satmo-step-badge {
  display: flex;
  padding: 2px 4px;
  justify-content: center;
  align-items: center;
  gap: 2px;
  border-radius: var(--border-radius-sm);
  background: var(--color-gray-600);
  color: var(--color-gray-100);
  text-align: center;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 400;
  line-height: 150%;
}

.satmo-module-title {
  margin: 0;
  color: var(--color-black-800);
  text-align: center;
  font-family: var(--font-primary);
  font-size: 20px;
  font-weight: 600;
  line-height: 150%;
}

/* ========================================
   STATUS PILLS
   ======================================== */

.satmo-status-pill {
  display: flex;
  padding: 2px 4px;
  justify-content: center;
  align-items: center;
  gap: 2px;
  border-radius: var(--border-radius-sm);
  border: none;
  text-align: center;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 400;
  line-height: 150%;
  white-space: nowrap;
  flex-shrink: 0;
}

.satmo-status-pill.active {
  background: var(--color-green-bg);
  color: var(--color-green);
}

.satmo-status-pill.inactive {
  background: var(--color-red-bg);
  color: var(--color-red);
}

.satmo-status-pill svg {
  width: 14px;
  height: 14px;
}

.satmo-status-pill-floating {
  position: absolute;
  top: 18px;
  right: 20px;
}

.satmo-module-description {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: #4b5563;
}

.satmo-doc-link {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: #FF9900;
  text-decoration: none;
  margin-top: 4px;
  transition: color 0.2s ease;
}

.satmo-doc-link:hover {
  color: #D88200;
}

/* ========================================
   MODULE CONTROLS
   ======================================== */

.satmo-module-controls {
  padding: 24px;
  border: 1px solid #e5e5e5;
  background: var(--color-white);
  position: relative;
  width: 100%;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-card);
}

.satmo-module-controls .form-table {
  margin: 0;
  display: block;
  height: auto;
  max-height: 100%;
  overflow: hidden;
  transition: all 0.15s ease-in-out;
}

.satmo-module-controls .form-table tr {
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.satmo-module-controls .form-table tr:first-child {
  padding-top: 0;
}

.satmo-module-controls .form-table th,
.satmo-module-controls .form-table td {
  padding: 0;
  font-size: 14px;
  width: 100%;
}

.satmo-module-controls .form-table th {
  padding-bottom: 10px;
  font-weight: 600;
  color: #1d1d1f;
}

.satmo-module-controls label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #1d1d1f;
  line-height: 1.5;
}

.satmo-module-controls input[type="checkbox"] {
  margin: 2px 0 0 0;
  flex-shrink: 0;
}

.satmo-module-controls .description {
  margin: 6px 0 0 0;
  font-size: 14px;
  color: #1d1d1f;
  line-height: 1.6;
  font-family: var(--font-primary);
}

.satmo-card-title {
  margin: 0 0 12px 0;
  color: var(--color-black-800);
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 600;
  line-height: 150%;
}

.satmo-step-content .description {
  align-self: stretch;
  margin-bottom: 14px;
  color: var(--color-black-700);
  font-feature-settings: 'liga' off, 'calt' off;
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 400;
  line-height: 140%;
}

/* ========================================
   FORM INPUTS
   ======================================== */

.satmo-module-controls input[type="text"],
.satmo-module-controls input[type="password"],
.satmo-module-controls select,
.satmo-module-controls textarea,
.satmo-input {
  display: flex;
  height: 40px;
  width: 100%;
  padding: 8px 16px;
  align-items: center;
  gap: 12px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-gray-200);
  background: var(--color-white);
  box-sizing: border-box;
  font-family: monospace;
  font-size: 12px;
  color: var(--color-black-700);
}

.satmo-module-controls input[type="text"]:placeholder-shown,
.satmo-module-controls input[type="password"]:placeholder-shown,
.satmo-input:placeholder-shown {
  background-color: var(--color-gray-100);
}

.satmo-module-controls input[type="text"]::placeholder,
.satmo-module-controls input[type="password"]::placeholder,
.satmo-input::placeholder {
  color: var(--color-gray-500);
}

.satmo-input-wide {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  height: 48px;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.4;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.satmo-input:focus,
.satmo-input-wide:focus {
  outline: none;
  border-color: var(--color-black-800);
  box-shadow: 0 0 0 2px rgba(42, 42, 42, 0.1);
}

.satmo-module-controls textarea {
  height: auto;
  min-height: 80px;
  resize: vertical;
}

/* ========================================
   HEALTH & PREVIEW
   ======================================== */

.satmo-module-health {
  margin-top: 16px;
}

.satmo-health-container {
  width: 100%;
  margin-top: 24px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-elevated);
  border: 1px solid #e5e7eb;
  background: var(--color-white);
  padding: 24px;
}

.satmo-module-preview {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}

.satmo-preview-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.satmo-health-card {
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.satmo-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 16px;
  color: #1d1d1f;
  font-size: 14px;
  font-weight: 600;
}

.satmo-preview-header-content {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.satmo-preview-header-content .dashicons {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

.satmo-status-dot {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.satmo-status-dot svg {
  width: 16px;
  height: 16px;
}

.health-card-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-gray-200);
}

.health-card-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.health-label {
  color: var(--color-black-700);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 400;
  line-height: 130%;
}

.health-value {
  overflow: hidden;
  color: var(--color-black-800);
  text-align: right;
  text-overflow: ellipsis;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  line-height: 130%;
}

.satmo-setup-status {
  padding: 12px;
  background: #f9f9f9;
  border-radius: var(--border-radius-sm);
  border-left: 3px solid #dcdcdc;
}

/* ========================================
   INFO BOXES
   ======================================== */

.satmo-info-box {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 6px;
  margin: 10px 0;
  border: 1px solid #e5e7eb;
  font-family: var(--font-primary);
}

.satmo-info-box p {
  margin: 5px 0;
  color: #1d1d1f;
  font-family: var(--font-primary);
}

.satmo-info-box.satmo-info-success {
  background: #e8f5e9;
  border-color: #4caf50;
}

.satmo-info-title {
  margin: 0 0 4px;
  font-weight: 600;
  letter-spacing: 0;
  color: #2e7d32;
  font-family: var(--font-primary);
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

.satmo-field-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.satmo-field-label {
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1f;
  font-family: var(--font-primary);
}

.satmo-field-description {
  margin: 0;
  color: var(--color-black-700);
  font-feature-settings: 'liga' off, 'calt' off;
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 400;
  line-height: 140%;
}

.satmo-step-actions {
  display: flex;
  justify-content: flex-start;
}

.satmo-form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
}

.satmo-save-actions {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.satmo-save-actions-left {
  justify-content: flex-start;
}

/* ========================================
   BUTTONS
   ======================================== */

.satmo-btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  transition: all 0.2s ease;
  font-family: var(--font-primary);
}

.satmo-btn-large {
  display: flex;
  height: 36px;
  min-width: 144px;
  padding: 8px 16px;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.satmo-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.satmo-btn-primary {
  background: var(--color-black-800);
  color: var(--color-white);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 500;
  line-height: 150%;
}

.satmo-btn-large.satmo-btn-primary {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.satmo-btn-primary:hover:not(:disabled) {
  background: var(--color-black-800);
}

.satmo-btn-primary:disabled {
  background: #A9A9A9;
}

.satmo-btn-secondary {
  background: #6c757d;
  color: white;
}

.satmo-btn-secondary:hover:not(:disabled) {
  background: #545b62;
}

.satmo-btn-secondary:disabled {
  background-color: #f9f9f9;
  color: #a7aaad;
}

.satmo-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.satmo-checkbox {
  margin: 0;
}

.satmo-checkbox-text {
  font-size: 14px;
  color: #1d1d1f;
}

/* ========================================
   ADDITIONAL STEPS
   ======================================== */

.satmo-additional-steps {
  display: flex;
  flex-direction: column;
  gap: 48px;
  margin: 48px auto 30px;
  max-width: 630px;
  width: 100%;
}

.satmo-step-card {
  background: white;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-elevated);
  padding: 28px 30px;
  border: 1px solid #e5e7eb;
  width: 100%;
}

.satmo-step-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
  flex: 1;
}

.satmo-step-list {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  color: #1d1d1f;
  font-family: var(--font-primary);
}

.satmo-step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.satmo-step-item:last-child {
  margin-bottom: 0;
}

.satmo-step-cycle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  background: var(--color-gray-200);
  border: 1px solid var(--color-gray-200);
  color: var(--color-gray-600);
  text-align: center;
  font-feature-settings: 'liga' off, 'calt' off;
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 400;
  line-height: 140%;
  flex-shrink: 0;
}

.satmo-step-text {
  flex: 1;
  color: var(--color-black-700);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 400;
  line-height: 150%;
}

.satmo-step-text strong {
  font-weight: 700;
}

/* ========================================
   LOADING SPINNER
   ======================================== */

.loading {
  text-align: center;
  padding: 40px;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #FF9900;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.card {
  background: var(--color-white);
  border: 1px solid #e5e5e5;
  border-radius: var(--border-radius-md);
  padding: 24px;
  margin-top: 24px;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 600;
  color: #1d1d1f;
}

.card ol,
.card ul {
  margin: 0;
  padding-left: 20px;
}

.card li {
  margin-bottom: 8px;
  line-height: 1.5;
}

.card a {
  color: #2271b1;
  text-decoration: none;
}

.card a:hover {
  color: #135e96;
  text-decoration: underline;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
  .satmo-admin-wrapper {
    padding: 0 15px;
  }

  .satmo-admin-header {
    flex-direction: column;
    gap: 16px;
  }

  .satmo-header-logo-img {
    height: 32px;
  }

  .satmo-header-description {
    font-size: 13px;
  }

  .satmo-header-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .satmo-btn {
    width: 100%;
  }

  .satmo-module-controls {
    width: 100%;
    padding: 15px;
  }

  .satmo-module {
    max-width: 100%;
  }

  .satmo-step-card {
    padding: 24px;
  }

  .satmo-step-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}
