:root {
  --primary-color: #1a56db;
  --primary-hover: #1e40af;
  --bg-color: #f3f4f6;
  --card-bg: rgba(255, 255, 255, 0.9);
  --text-main: #111827;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  background-image: 
    radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
    radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
    radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
  background-attachment: fixed;
  background-size: cover;
  min-height: 100vh;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.025em;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.header {
  margin-bottom: 2rem;
  color: white;
  text-align: center;
}

.header .logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.header h1 {
  font-size: 2.25rem;
}

.header p {
  opacity: 0.9;
  font-weight: 500;
}

.main-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  flex: 1;
}

@media (min-width: 1024px) {
  .main-content {
    grid-template-columns: 400px 1fr;
  }
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card h2 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-color);
  color: var(--primary-color);
}

.input-group {
  margin-bottom: 1.25rem;
  opacity: 0;
  animation: fadeIn 0.4s forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.input-group select,
.input-group input,
.input-group textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-main);
  background-color: white;
  transition: all 0.2s ease;
}

.input-group select:focus,
.input-group input:focus,
.input-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

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

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  width: 100%;
  box-shadow: 0 4px 6px -1px rgba(26, 86, 219, 0.2);
}

.btn-primary:not(:disabled):hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 8px -1px rgba(26, 86, 219, 0.3);
}

.btn-secondary {
  background-color: white;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:not(:disabled):hover {
  background-color: #f9fafb;
}

.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

.preview-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

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

.preview-header h2 {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.document-output {
  flex: 1;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2.5rem 3rem;
  overflow-y: auto;
  min-height: 500px;
  max-height: 700px;
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.04);
}

.document-output.rendered {
  font-family: 'Times New Roman', Times, serif; /* Standard legal font */
  font-size: 13pt;
  line-height: 1.6;
  color: black;
  position: relative;
}

/* Stamp Paper Mode Styles */
.document-output.stamp-mode {
  padding-top: 10cm; /* Space for physical stamp paper header */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500" viewBox="0 0 500 500"><text x="50%" y="50%" font-family="Arial" font-size="60" fill="rgba(150, 150, 150, 0.1)" text-anchor="middle" transform="rotate(-45 250 250)">GOVERNMENT OF INDIA</text></svg>');
  background-repeat: no-repeat;
  background-position: center;
}

.document-output.stamp-mode::before {
  content: "INDIA NON JUDICIAL STAMP PAPER";
  position: absolute;
  top: 1.5cm;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 24pt;
  color: rgba(0, 0, 0, 0.15);
  text-align: center;
  border: 4px solid rgba(0, 0, 0, 0.1);
  padding: 1rem 2rem;
  letter-spacing: 2px;
}

.ai-agent-card {
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.1) 0%, rgba(255, 255, 255, 0.9) 100%);
  border: 1px solid rgba(30, 64, 175, 0.3);
}

.ai-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.ai-header h3 {
  font-size: 1.1rem;
  color: #1e40af;
}

.ai-sparkle {
  color: #3b82f6;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0.7; transform: scale(1); }
}

.ai-status {
  font-size: 0.85rem;
  margin-top: 0.75rem;
  font-style: italic;
  color: var(--text-muted);
}

.toggle-group {
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.switch-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.input-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.upload-list {
  margin-top: 1rem;
}

.upload-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: white;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.ai-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.document-output.refined {
  border-left: 5px solid #7c3aed;
}



.document-output p {
  margin-bottom: 1.2rem;
}

.document-output strong {
  font-weight: bold;
}

.empty-state {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

.footer {
  margin-top: 2rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
}

/* Print Styles */
@media print {
  body * {
    visibility: hidden;
  }
  .document-output, .document-output * {
    visibility: visible;
  }
  .document-output {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 0;
    border: none;
    box-shadow: none;
    max-height: none;
    overflow: visible;
  }
}
