/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f7fa;
  color: #1a1a2e;
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== NAVBAR ===== */
.navbar {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.nav-brand a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #1a1a2e;
}

.nav-logo {
  font-size: 24px;
}

.nav-title {
  font-weight: 700;
  font-size: 18px;
}

.nav-links {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.nav-link {
  text-decoration: none;
  color: #4a5568;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}

.nav-link:hover {
  background: #f0f4f8;
}

.nav-link.active {
  background: #edf2f7;
  color: #1a73e8;
}

.nav-link-primary {
  background: #1a73e8;
  color: white !important;
}

.nav-link-primary:hover {
  background: #1557b0 !important;
}

.nav-link-logout {
  color: #e53e3e;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 16px;
}

.nav-user-name {
  font-size: 13px;
  color: #718096;
}

/* ===== CONTAINER ===== */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.4;
}

.btn-primary {
  background: #1a73e8;
  color: white;
}

.btn-primary:hover {
  background: #1557b0;
}

.btn-secondary {
  background: #edf2f7;
  color: #4a5568;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-danger {
  background: #e53e3e;
  color: white;
}

.btn-danger:hover {
  background: #c53030;
}

.btn-warning {
  background: #ed8936;
  color: white;
}

.btn-warning:hover {
  background: #dd6b20;
}

.btn-large {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: #fed7d7;
  color: #e53e3e;
  font-size: 16px;
}

.btn-icon:hover {
  background: #feb2b2;
}

.btn-google {
  background: white;
  color: #3c4043;
  border: 1px solid #dadce0;
  padding: 12px 24px;
  font-size: 15px;
  width: 100%;
  margin: 16px 0;
}

.btn-google:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-error {
  background: #fff5f5;
  color: #c53030;
  border: 1px solid #fed7d7;
}

/* ===== LOGIN ===== */
.login-body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  text-align: center;
}

.login-header {
  margin-bottom: 24px;
}

.login-logo {
  font-size: 48px;
  display: block;
  margin-bottom: 8px;
}

.login-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-subtitle {
  color: #718096;
  font-size: 14px;
}

.login-description {
  color: #4a5568;
  font-size: 14px;
  margin-bottom: 8px;
}

.login-note {
  color: #a0aec0;
  font-size: 12px;
  margin-top: 16px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  background: white;
  border-radius: 12px;
  border: 2px dashed #e2e8f0;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.empty-state h2 {
  font-size: 20px;
  margin-bottom: 8px;
  color: #4a5568;
}

.empty-state p {
  color: #718096;
  margin-bottom: 24px;
}

/* ===== DOCUMENTS LIST ===== */
.documents-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.document-card {
  background: white;
  border-radius: 12px;
  padding: 20px 24px;
  text-decoration: none;
  color: inherit;
  border: 1px solid #e2e8f0;
  transition: all 0.2s;
  display: block;
}

.document-card:hover {
  border-color: #1a73e8;
  box-shadow: 0 4px 12px rgba(26,115,232,0.1);
  transform: translateY(-1px);
}

.document-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.document-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.document-info {
  flex: 1;
  min-width: 0;
}

.document-info h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-filename {
  font-size: 12px;
  color: #718096;
}

.document-card-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f4f8;
}

.document-date {
  font-size: 12px;
  color: #a0aec0;
}

.document-signers {
  font-size: 12px;
  color: #4a5568;
  font-weight: 500;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: #edf2f7;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #34a853;
  border-radius: 2px;
  transition: width 0.3s;
}

/* ===== STATUS BADGES ===== */
.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-pending {
  background: #fef3cd;
  color: #856404;
}

.status-completed {
  background: #d4edda;
  color: #155724;
}

.status-cancelled {
  background: #f8d7da;
  color: #721c24;
}

.status-draft {
  background: #e2e8f0;
  color: #4a5568;
}

.status-large {
  padding: 8px 16px;
  font-size: 14px;
}

/* ===== UPLOAD FORM ===== */
.upload-form {
  background: white;
  border-radius: 12px;
  padding: 32px;
  border: 1px solid #e2e8f0;
}

.form-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid #f0f4f8;
}

.form-section:last-of-type {
  border-bottom: none;
}

.form-section h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #2d3748;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #4a5568;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26,115,232,0.1);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  font-size: 13px;
  color: #718096;
  margin-bottom: 16px;
}

/* File upload */
.file-upload-area {
  border: 2px dashed #e2e8f0;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.file-upload-area:hover, .file-upload-area.dragover {
  border-color: #1a73e8;
  background: #f0f7ff;
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-upload-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 8px;
}

.file-upload-content p {
  color: #4a5568;
  font-size: 14px;
}

.file-upload-hint {
  color: #a0aec0 !important;
  font-size: 12px !important;
  margin-top: 4px;
}

.file-upload-selected {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #34a853;
  font-weight: 500;
}

.file-check {
  font-size: 20px;
}

/* Signers */
.signer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.signer-fields {
  display: flex;
  gap: 12px;
  flex: 1;
}

.signer-fields .form-input {
  flex: 1;
}

.btn-remove-signer {
  flex-shrink: 0;
}

/* Form actions */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* ===== DOCUMENT DETAIL ===== */
.back-link {
  display: inline-block;
  color: #1a73e8;
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 16px;
}

.back-link:hover {
  text-decoration: underline;
}

.document-detail {
  background: white;
  border-radius: 12px;
  padding: 32px;
  border: 1px solid #e2e8f0;
}

.document-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.document-detail-header h1 {
  font-size: 22px;
  margin-bottom: 4px;
}

.document-description {
  color: #4a5568;
  font-size: 14px;
  margin-top: 8px;
}

.document-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-bottom: 1px solid #f0f4f8;
  margin-bottom: 24px;
  font-size: 13px;
  color: #718096;
}

.section {
  margin-top: 32px;
}

.section h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #2d3748;
}

/* Signers list */
.signers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.signer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.signer-signed {
  border-color: #c6f6d5;
  background: #f0fff4;
}

.signer-pending {
  border-color: #fefcbf;
  background: #fffff0;
}

.signer-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.signer-status-icon {
  font-size: 20px;
  width: 28px;
  text-align: center;
}

.signer-signed .signer-status-icon {
  color: #34a853;
}

.signer-pending .signer-status-icon {
  color: #ed8936;
}

.signer-email {
  display: block;
  font-size: 12px;
  color: #718096;
}

.signer-date {
  font-size: 12px;
  color: #718096;
}

/* Audit log */
.audit-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audit-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f7fafc;
  font-size: 13px;
}

.audit-time {
  color: #a0aec0;
  font-size: 11px;
  min-width: 140px;
}

.audit-action {
  font-weight: 500;
  color: #2d3748;
}

.audit-actor {
  color: #718096;
}

.audit-details {
  color: #a0aec0;
  font-size: 12px;
}

/* ===== SIGN PAGE ===== */
.sign-body {
  background: #f5f7fa;
}

.sign-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 32px 24px;
}

.sign-header {
  text-align: center;
  margin-bottom: 24px;
}

.sign-header h1 {
  font-size: 24px;
  font-weight: 700;
}

.sign-subtitle {
  color: #718096;
  font-size: 14px;
}

.sign-card {
  background: white;
  border-radius: 12px;
  padding: 32px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.sign-document-info {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #f0f4f8;
}

.sign-document-info h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.sign-description {
  color: #4a5568;
  font-size: 14px;
  margin-bottom: 8px;
}

.sign-sender {
  font-size: 13px;
  color: #718096;
}

.sign-preview {
  text-align: center;
  margin-bottom: 24px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
}

.sign-signers-status {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #f0f4f8;
}

.sign-signers-status h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #4a5568;
}

.sign-signer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}

.sign-signer-icon {
  width: 20px;
  text-align: center;
}

.sign-signer-name {
  flex: 1;
}

.sign-signer-signed {
  color: #34a853;
  font-weight: 500;
}

.sign-signer-pending {
  color: #ed8936;
}

/* Signature area */
.sign-form-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.signature-area {
  margin: 16px 0;
}

.signature-area label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #4a5568;
}

#signatureCanvas {
  width: 100%;
  max-width: 500px;
  height: 150px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
  display: block;
}

.signature-actions {
  margin-top: 8px;
}

.sign-agreement {
  margin: 20px 0;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: #4a5568;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
}

.btn-sign {
  width: 100%;
  margin-top: 16px;
}

.btn-sign:disabled {
  background: #a0aec0;
  cursor: not-allowed;
}

/* Success / Error cards */
.sign-success-card {
  text-align: center;
  padding: 48px 32px;
}

.success-icon {
  font-size: 64px;
  color: #34a853;
  margin-bottom: 16px;
}

.sign-success-card h2 {
  color: #34a853;
  margin-bottom: 16px;
}

.sign-note {
  color: #718096;
  font-size: 14px;
  margin-top: 12px;
}

.sign-error-card {
  text-align: center;
  padding: 48px 32px;
}

.error-icon {
  font-size: 64px;
  color: #e53e3e;
  margin-bottom: 16px;
}

.sign-error-card h2 {
  color: #e53e3e;
  margin-bottom: 16px;
}

/* Error page */
.error-page {
  text-align: center;
  padding: 64px 24px;
}

.error-page h1 {
  font-size: 24px;
  margin-bottom: 12px;
}

.error-page p {
  color: #718096;
  margin-bottom: 24px;
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 24px;
  color: #a0aec0;
  font-size: 12px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .navbar {
    padding: 0 16px;
    gap: 12px;
  }

  .nav-user-name {
    display: none;
  }

  .container {
    padding: 24px 16px;
  }

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

  .document-card-header {
    flex-wrap: wrap;
  }

  .signer-fields {
    flex-direction: column;
  }

  .document-detail-header {
    flex-direction: column;
    gap: 12px;
  }

  .document-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .upload-form {
    padding: 20px;
  }

  .sign-card {
    padding: 24px 20px;
  }

  #signatureCanvas {
    height: 120px;
  }
}
