/* --------------------------------------------------------------------------
   Sutra GPS — Punjab Government Green & White Theme (Full Replacement)
   + Extended for History Panel, Offline Queue, Notifications
   -------------------------------------------------------------------------- */

:root {
  --bg-page: #f6faf7;
  --bg-card: #ffffff;
  --bg-surface: #f0f5f1;
  --primary: #1c7d3a;
  --primary-600: #16642f;
  --accent: #2ea44f;
  --success: #138a3d;
  --danger: #c92a2a;
  --warning: #c08a10;
  --muted: #5f6b63;
  --text-main: #1b2b20;
  --border: #dfe7e2;
  --radius: 12px;
  --shadow: 0 6px 22px rgba(0,0,0,0.08);
  --max-width: 980px;
  --gutter: 16px;
}

html, body {
  height: 100%;
  background: var(--bg-page);
  color: var(--text-main);
  font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#sutra-gps-form,
.sutra-gps-form {
  max-width: var(--max-width);
  margin: 28px auto;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 24px;
  box-sizing: border-box;
  transition: background .2s ease, border-color .2s ease;
}

#sutra-gps-form:hover { border-color: #ccd7d0; }

#sutra-gps-form h3 {
  text-align: center;
  margin-bottom: 16px;
  font-size: 22px;
  color: var(--primary);
  font-weight: 800;
}

#sutra-gps-form label {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

#sutra-gps-form i.fa,
#sutra-gps-form i.fas,
#sutra-gps-form i.far,
#sutra-gps-form i.fab {
  margin-right: 6px;
  color: var(--primary);
}

#sutra-gps-form input,
#sutra-gps-form select,
#sutra-gps-form textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 14px;
  transition: all .15s ease;
}

#sutra-gps-form input:focus,
#sutra-gps-form select:focus,
#sutra-gps-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(28,125,58,0.18);
  background: #fff;
}

#sutra-submit {
  margin-top: 20px;
  background: linear-gradient(90deg, var(--primary), var(--primary-600));
  border: none;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  box-shadow: 0 8px 18px rgba(28,125,58,0.25);
}

#sutra-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(28,125,58,0.25);
  filter: brightness(1.03);
}

#sutra-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#sutra-gps-status {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  background: #f7faf8;
}

#sutra-gps-status.ok { background: #eef8f1; color: var(--success); border-color: #cfe9d8; }
#sutra-gps-status.error { background: #fdecec; color: var(--danger); border-color: #f7c9cd; }
#sutra-gps-status.waiting { background: #fff7e7; color: var(--warning); border-color: #f3dfb2; }

#sutra-gps-status .small-muted {
  margin-left: 12px;
  font-weight: 500;
  color: #41634f;
}

.map-container,
#sutra-mapview {
  width: 100%;
  height: 340px;
  margin-top: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #eaf2ec;
  overflow: hidden;
}

.leaflet-container { background: #e8f1ea !important; }

/* Photo bar */
.sutra-photo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.sutra-photo-bar .button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sutra-photo-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

/* Preview */
#sutra-preview {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sutra-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}

.sutra-preview-item {
  position: relative;
  width: 170px;
  height: 170px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  background: #fff;
}

.sutra-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sutra-preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.62);
  color: #fff;
  border: none;
  border-radius: 999px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.sutra-preview-remove:hover {
  background: rgba(0,0,0,0.85);
}

/* PWA Install */
#sutra-install-app { text-align: center; }
#sutra-install-app #sutra-install-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
}
#sutra-ios-hint { color: var(--muted); }

/* Admin Grid */
.sutra-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.sutra-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  border: 1px solid var(--border);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
  box-shadow: var(--shadow);
}

.sutra-card:hover { transform: translateY(-2px); border-color: #cfe0d6; }

.sutra-card img {
  border-radius: 8px;
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.sutra-card .meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.4;
}

.sutra-card button.delete-btn {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  padding: 5px 8px;
  cursor: pointer;
}
.sutra-card button.delete-btn:hover { opacity: 0.9; }

/* Bulk admin toolbar */
.bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}
.bulk-toolbar button {
  background: var(--danger);
  border: none;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.bulk-toolbar button:hover { opacity: 0.9; }

/* Toast */
.sutra-toast {
  position: fixed;
  right: 24px;
  bottom: 32px;
  background: #ffffff;
  color: var(--text-main);
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 9999;
  font-weight: 600;
  animation: fadeIn .3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* WP Primary Button */
.button.button-primary {
  background: var(--primary);
  border-color: var(--primary-600);
  color: #fff;
}
.button.button-primary:hover {
  background: var(--primary-600);
  border-color: var(--primary-600);
}

/* Responsive */
@media (max-width: 720px) {
  #sutra-gps-form { padding: 16px; }
  .sutra-card img { height: 140px; }
  .sutra-preview-item {
    width: 140px;
    height: 140px;
  }
}

/* Print */
@media print {
  #wpadminbar,
  .site-header,
  .site-footer { display: none !important; }
  #sutra-gps-form,
  .sutra-card {
    box-shadow: none !important;
    border-color: #cfd8d3 !important;
  }
}

/* --------------------------------------------------------------------------
   NEW CSS SECTION: SUBMISSION HISTORY PANEL
-------------------------------------------------------------------------- */

#sutra-history-panel {
  margin-top: 30px;
  padding: 20px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.sutra-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sutra-history-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sutra-history-actions button {
  padding: 6px 12px;
}

#sutra-history-offline {
  margin-top: 8px;
  padding: 8px 12px;
  background: #fff7e7;
  border-left: 4px solid var(--warning);
  font-weight: 700;
  color: var(--warning);
  border-radius: 6px;
  display: none;
}

/* History List */
.sutra-history-list {
  margin-top: 16px;
}

.sutra-history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  margin-bottom: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

.sutra-history-thumb {
  width: 65px;
  height: 65px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #edeff0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.sutra-history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sutra-history-thumb-placeholder i {
  font-size: 24px;
  color: var(--muted);
}

/* Metadata */
.sutra-history-meta {
  flex-grow: 1;
  font-size: 13px;
  line-height: 1.3;
}

.sutra-history-row-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-600);
}

/* Status Badge */
.sutra-history-status {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  text-transform: capitalize;
  white-space: nowrap;
}

.sutra-history-status-offline {
  background: #fff4d6;
  color: var(--warning);
  border: 1px solid #f2d59c;
}

.sutra-history-status-ok {
  background: #e9f7ec;
  color: var(--success);
  border: 1px solid #c3e7cd;
}

.sutra-history-loading,
.sutra-history-empty {
  text-align: center;
  padding: 20px 0;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   NEW CSS SECTION: NOTIFICATION BAR
-------------------------------------------------------------------------- */

#sutra-notification-bar,
#sutra-notifications {
  padding: 12px 18px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  margin: 20px auto;
  max-width: var(--max-width);
  position: relative;
  box-shadow: 0 6px 22px rgba(0,0,0,0.15);
}

.sutra-notif-close {
  position: absolute;
  right: 12px;
  top: 10px;
  background: rgba(255,255,255,0.25);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  line-height: 22px;
}

.sutra-notif-close:hover {
  background: rgba(255,255,255,0.4);
}

/* End of File */
