/* Main Container */
.rsa-container {
  max-width: 900px;
  margin: 30px auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.1);
  overflow: hidden;
  font-family: 'Segoe UI', Roboto, sans-serif;
}

/* Form Styles */
.rsa-form {
  padding: 30px;
}

.rsa-terms {
  background: #faf8f5;
  padding: 20px;
  border-radius: 12px;
  margin: 20px 0;
  border: 1px solid #e8dccf;
}

.term-section {
  margin-bottom: 20px;
  border-left: 3px solid #c7a252;
  padding-left: 15px;
}

.term-section h3 {
  margin: 0 0 8px;
  color: #2c3e2f;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-group input:not([type=checkbox]),
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
}

.form-row {
  display: flex;
  gap: 20px;
}

/* Signature Pad */
.signature-pad-wrapper {
  border: 2px solid #ccc;
  border-radius: 12px;
  background: #fff;
  touch-action: none;
}

canvas#signature-pad {
  width: 100%;
  height: 200px;
  background: #fff;
  border-radius: 10px;
  display: block;
}

.signature-buttons {
  margin-top: 12px;
}

/* Buttons */
.rsa-btn-primary,
.rsa-btn-secondary {
  background: #2c3e2f;
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 40px;
  font-size: 16px;
  cursor: pointer;
  transition: 0.3s;
}

.rsa-btn-secondary {
  background: #95a5a6;
}

.rsa-btn-primary:hover {
  background: #1e2a1f;
}

/* Messages */
.rsa-success {
  background: #d4edda;
  color: #155724;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.rsa-error {
  background: #f8d7da;
  color: #721c24;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.checkbox-group {
  margin: 20px 0;
}

/* Table Header & Filters */

/* Removed old table header styles - now using rsa-agreements-header */



/* No Results Message */
.rsa-no-results {
  padding: 60px 20px;
  text-align: center;
  color: #999;
  font-size: 15px;
  background: linear-gradient(135deg, #f9f9f9 0%, #fafafa 100%);
  border-radius: 12px;
  margin-top: 20px;
}

.rsa-empty-state {
  padding: 80px 20px;
  text-align: center;
  color: #999;
}

.rsa-empty-state p:first-child {
  font-size: 48px;
  margin: 0 0 10px;
}

.rsa-empty-state p:last-child {
  margin: 0;
}

/* ===== ENHANCED AGREEMENTS SECTION ===== */

/* Header with Stats */
.rsa-agreements-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #2c3e2f 0%, #3d5035 100%);
  padding: 40px;
  margin: -30px -30px 30px -30px;
  border-radius: 20px 20px 0 0;
  gap: 30px;
  flex-wrap: wrap;
}

.rsa-header-content {
  flex: 1;
  min-width: 250px;
}

.rsa-agreements-title {
  margin: 0 0 8px;
  font-size: 32px;
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.rsa-header-subtitle {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 400;
}

/* Stats Cards */
.rsa-header-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.rsa-stat-card {
  background: rgba(255, 255, 255, 0.15);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding: 20px 25px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-width: 150px;
  transition: all 0.3s ease;
}

.rsa-stat-card:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.rsa-stat-number {
  font-size: 28px;
  font-weight: 700;
  color: #c7a252;
  margin-bottom: 5px;
}

.rsa-stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

/* Filter Section */
.rsa-filter-section {
  background: linear-gradient(135deg, #f8f8f8 0%, #fafafa 100%);
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 25px;
  border: 1px solid #f0f0f0;
}

.rsa-filter-title {
  font-size: 14px;
  font-weight: 700;
  color: #2c3e2f;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rsa-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}

.rsa-filter-group {
  position: relative;
  display: flex;
  align-items: center;
}

.rsa-filter-input {
  width: 100%;
  padding: 12px 40px 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
  font-family: inherit;
  background: #fff;
}

.rsa-filter-input:focus {
  outline: none;
  border-color: #c7a252;
  box-shadow: 0 0 0 4px rgba(199, 162, 82, 0.1);
  background: #fff;
}

.rsa-filter-icon {
  position: absolute;
  right: 12px;
  pointer-events: none;
  font-size: 16px;
}

.rsa-filter-clear-btn {
  padding: 12px 20px;
  background: linear-gradient(135deg, #c7a252 0%, #d4b46e 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(199, 162, 82, 0.2);
}

.rsa-filter-clear-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(199, 162, 82, 0.3);
}

.rsa-filter-info {
  font-size: 12px;
  color: #666;
  padding-top: 10px;
  border-top: 1px solid #e8e8e8;
}

.rsa-filter-info strong {
  color: #2c3e2f;
}

/* Table Container */
.rsa-table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid #f0f0f0;
  width: 100%;
}

.rsa-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
  table-layout: auto;
}

.rsa-table thead {
  background: linear-gradient(135deg, #2c3e2f 0%, #3d5035 100%);
  position: sticky;
  top: 0;
  z-index: 10;
}

.rsa-table th {
  color: #fff;
  padding: 18px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.rsa-table tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: all 0.2s ease;
}

.rsa-table tbody tr:hover {
  background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
  box-shadow: 0 2px 10px rgba(199, 162, 82, 0.1);
}

.rsa-table tbody tr.rsa-hidden {
  display: none;
}

.rsa-table td {
  padding: 16px 14px;
  font-size: 14px;
  color: #333;
}

/* Column Styles */
.rsa-col-id {
  width: 5%;
}

.rsa-id-badge {
  display: inline-block;
  background: linear-gradient(135deg, #c7a252 0%, #d4b46e 100%);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  min-width: 30px;
  text-align: center;
}

.rsa-col-name {
  font-weight: 500;
  color: #2c3e2f;
}

.rsa-col-email {
  color: #666;
}

.rsa-email-link {
  color: #c7a252;
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 500;
}

.rsa-email-link:hover {
  color: #d4b46e;
  text-decoration: underline;
}

.rsa-col-date {
  color: #666;
}

.rsa-date-badge {
  display: inline-block;
  background: linear-gradient(135deg, #e8f4f8 0%, #f0f9fc 100%);
  color: #2c3e2f;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid #c7a252;
}

.rsa-col-price {
  font-weight: 600;
}

.rsa-price-highlight {
  color: #c7a252;
  font-size: 15px;
}

.rsa-col-signed {
  color: #666;
}

.rsa-timestamp-badge {
  display: inline-block;
  background: #f5f5f5;
  color: #666;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.rsa-col-action {
  min-width: 100px;
}

/* Table Header Column Styles */
.rsa-th-id {
  width: 5%;
  min-width: 50px;
}

.rsa-th-email,
.rsa-th-signed {
  display: table-cell;
}

.rsa-th-action {
  min-width: 100px;
}

/* PDF Button */
.rsa-pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #c7a252 0%, #d4b46e 100%);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(199, 162, 82, 0.2);
  border: none;
  cursor: pointer;
}

.rsa-pdf-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(199, 162, 82, 0.3);
  text-decoration: none;
  color: #fff;
}

.rsa-pdf-btn:active {
  transform: translateY(0);
}

.rsa-pdf-icon {
  font-size: 16px;
}

/* Settings Form */
.rsa-settings-form {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
}

.rsa-logo-preview {
  max-width: 150px;
  margin: 10px 0;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .rsa-filters-grid {
    grid-template-columns: 1fr;
  }

  .rsa-header-stats {
    flex-direction: column;
    width: 100%;
  }

  .rsa-agreements-header {
    flex-direction: column;
  }

  .rsa-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -30px;
    border-radius: 0;
    width: auto;
  }

  .rsa-table {
    width: 100%;
  }

  .rsa-table th,
  .rsa-table td {
    padding: 12px 8px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* Hide non-essential columns on mobile to keep scroll minimal */
  .rsa-th-email,
  .rsa-col-email,
  .rsa-th-signed,
  .rsa-col-signed {
    display: none !important;
  }

  /* Scrollable columns (Client, Date, Price) - NOT sticky */
  .rsa-th-name,
  .rsa-col-name,
  .rsa-th-date,
  .rsa-col-date,
  .rsa-th-price,
  .rsa-col-price {
    position: static;
    background: inherit;
  }

  /* Make ID column sticky on left */
  .rsa-th-id {
    position: sticky;
    left: 0;
    z-index: 11;
    background: linear-gradient(135deg, #2c3e2f 0%, #3d5035 100%);
    min-width: 80px;
    padding: 12px 12px;
  }

  .rsa-col-id {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 6;
    border-right: 2px solid #e8e8e8;
    min-width: 80px;
    padding: 12px 12px;
  }

  .rsa-table tbody tr:hover .rsa-col-id {
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
  }

  /* Make Action/Download column sticky on right */
  .rsa-th-action {
    position: sticky;
    right: 0;
    z-index: 11;
    background: linear-gradient(135deg, #2c3e2f 0%, #3d5035 100%);
  }

  .rsa-col-action {
    position: sticky;
    right: 0;
    background: #fff;
    z-index: 6;
    border-left: 2px solid #e8e8e8;
    min-width: 85px;
  }

  .rsa-table tbody tr:hover .rsa-col-action {
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
  }

  .rsa-pdf-btn {
    padding: 6px 10px;
    font-size: 11px;
  }
}