/* Base Variables */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --text: #1f2937;
  --text-light: #6b7280;
  --bg: #f9fafb;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --transition: all 0.2s ease-in-out;
  --border-radius: 0.5rem;
  --success: #10b981;
  --error: #ef4444;
}

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

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.5rem;
  align-items: stretch;
}

.surface-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.5rem;
}

.upload-section.surface-card {
  justify-content: center;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 1.75rem;
  padding: 1.5rem 0;
}

.header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 0.6rem;
  color: #111827;
  line-height: 1.2;
}

.header p {
  font-size: 1.05rem;
  color: var(--text-light);
  margin: 0 auto;
  max-width: 580px;
}

/* Upload Form */
.upload-form {
  margin-bottom: 0;
  width: 100%;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
}

.file-upload-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
  justify-content: center;
}

.dropzone-wrapper {
  position: relative;
  width: 100%;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--border-radius);
  padding: 1.6rem 1.4rem;
  background-color: var(--card-bg);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.6rem;
  min-height: 220px;
}

.upload-area:hover, .upload-area.highlight {
  border-color: var(--primary);
  background-color: rgba(37, 99, 235, 0.03);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.8;
}

.upload-area h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.upload-area p {
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.file-info {
  margin-top: 1rem;
  font-weight: 500;
  color: var(--primary) !important;
  word-break: break-all;
}

/* Buttons */
.primary-button {
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 0.8rem 2rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  width: 100%;
  max-width: 300px;
  margin: 0.25rem auto 0;
  gap: 0.6rem;
}

.primary-button:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.primary-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.primary-button.is-loading {
  opacity: 0.85;
}

.icon-button {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.25rem;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button:hover {
  background-color: var(--bg);
  color: var(--primary);
}

/* Summary Container */
.summary-container {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-top: 1.75rem;
  border: 1px solid var(--border);
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background-color: #f8fafc;
}

.summary-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.summary-content {
  padding: 1.5rem;
  line-height: 1.7;
}

.summary-content p {
  margin-bottom: 1rem;
  white-space: pre-line;
}

.summary-content h2,
.summary-content h3 {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.1rem;
  color: var(--text);
}

.summary-content h4 {
  margin: 1.25rem 0 0.65rem;
  font-size: 1rem;
  color: var(--text);
}

.summary-content ul,
.summary-content ol {
  margin: 0 0 1rem 1.5rem;
  padding: 0;
}

.summary-content li {
  margin-bottom: 0.5rem;
}

.summary-content strong {
  color: var(--text);
}

.summary-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.summary-content th,
.summary-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.summary-content th {
  background-color: rgba(37, 99, 235, 0.08);
  font-weight: 600;
}

.ad-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ad-card.surface-card {
  padding: 0;
}

.ad-image-link {
  display: block;
}

.ad-image {
  width: 100%;
  height: auto;
  display: block;
}

.ad-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
  justify-content: space-between;
}

.ad-body h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.ad-body p {
  color: var(--text-light);
  font-size: 0.9rem;
  line-height: 1.5;
}

.ad-cta {
  align-self: flex-start;
  padding: 0.6rem 1.25rem;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
}

.ad-cta:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

@media (pointer: coarse) {
  .dropzone-wrapper .file-input {
    pointer-events: auto;
    width: 100%;
    height: 100%;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    cursor: pointer;
  }
}

/* Footer */
.footer {
  text-align: center;
  margin-top: 4rem;
  padding: 2rem 0;
  color: var(--text-light);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
}

.footer a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

.footer a:hover {
  text-decoration: underline;
}

.disclaimer {
  margin: 0.5rem 0;
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Loading Spinner */
.spinner {
  display: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
  margin-left: 0.75rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
  background-color: #fef2f2;
  color: var(--error);
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-top: 1rem;
  border: 1px solid #fecaca;
  display: none;
}

.error-message p {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 1.5rem 1rem;
  }
  
  .header h1 {
    font-size: 2rem;
  }
  
  .header p {
    font-size: 1rem;
  }
  
  .upload-area {
    padding: 2rem 1.5rem;
  }
  
  .summary-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .summary-header h2 {
    font-size: 1.125rem;
  }
  
  .primary-button {
    width: 100%;
    max-width: none;
  }

  .sidebar {
    display: none;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    margin-top: 2rem;
  }
}

/* Print Styles */
@media print {
  .header, .upload-form, .footer, .summary-header {
    display: none;
  }
  
  .summary-container {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  
  .summary-content {
    padding: 0;
  }
}
