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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
  padding: 20px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  background-color: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Header */
header {
  margin-bottom: 40px;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 20px;
}

header h1 {
  font-size: 2rem;
  color: #2c3e50;
  margin-bottom: 10px;
}

header p {
  color: #7f8c8d;
  font-size: 1.1rem;
}

.back-link {
  display: inline-block;
  margin-top: 10px;
  color: #3498db;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

.back-link:hover {
  color: #2980b9;
}

/* Home Page - Template Cards */
.template-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 30px;
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
  border-color: #3498db;
}

.card h2 {
  font-size: 1.5rem;
  color: #2c3e50;
  margin-bottom: 15px;
}

.card p {
  color: #7f8c8d;
  margin-bottom: 20px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 30px;
  background-color: #3498db;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
}

.btn:hover {
  background-color: #2980b9;
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  background-color: #bdc3c7;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  width: 100%;
  margin-top: 20px;
  padding: 15px;
  font-size: 1.1rem;
}

.btn-secondary {
  background-color: #95a5a6;
  width: 100%;
  padding: 15px;
  font-size: 1.1rem;
}

.btn-secondary:hover {
  background-color: #7f8c8d;
}

/* Button Group */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Generator Layout */
.generator-layout {
  display: grid;
  grid-template-columns: 45% 55%;
  gap: 40px;
  margin-top: 30px;
}

/* Form Section */
.form-section {
  background-color: #fafafa;
  padding: 30px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.form-section h2 {
  color: #2c3e50;
  margin-bottom: 25px;
  font-size: 1.4rem;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #2c3e50;
  font-size: 0.95rem;
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 5px;
  font-size: 1rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group input[readonly] {
  background-color: #ecf0f1;
  cursor: not-allowed;
}

.form-group small {
  display: block;
  margin-top: 5px;
  color: #7f8c8d;
  font-size: 0.85rem;
}

/* Preview Section */
.preview-section {
  background-color: #fafafa;
  padding: 30px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.preview-section h2 {
  color: #2c3e50;
  margin-bottom: 25px;
  font-size: 1.4rem;
}

.signature-preview {
  background-color: white;
  padding: 30px;
  border-radius: 5px;
  border: 2px dashed #e0e0e0;
  min-height: 300px;
  overflow: auto;
}

.placeholder-text {
  color: #95a5a6;
  text-align: center;
  padding: 50px 20px;
  font-style: italic;
}

.error-text {
  color: #e74c3c;
  text-align: center;
  padding: 50px 20px;
  font-weight: 500;
}

/* Copy Message */
.copy-message {
  text-align: center;
  margin-top: 15px;
  font-weight: 500;
  min-height: 24px;
}

.copy-message.success {
  color: #27ae60;
}

.copy-message.error {
  color: #e74c3c;
}

/* Instruction Text */
.instruction-text {
  background-color: #e8f4f8;
  border-left: 4px solid #3498db;
  padding: 15px 20px;
  margin-top: 20px;
  border-radius: 4px;
}

.instruction-text p {
  margin: 0;
  color: #2c3e50;
  font-size: 0.9rem;
  line-height: 1.5;
}

.instruction-text strong {
  color: #3498db;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .generator-layout {
    grid-template-columns: 1fr;
  }

  .preview-section {
    order: 2;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 20px;
  }

  header h1 {
    font-size: 1.5rem;
  }

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

  .form-section,
  .preview-section {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  .container {
    padding: 15px;
  }

  header h1 {
    font-size: 1.3rem;
  }

  .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
}

/* Form Validation Styles */
input:invalid:not(:placeholder-shown) {
  border-color: #e74c3c;
}

input:valid:not(:placeholder-shown) {
  border-color: #27ae60;
}

/* Loading State */
.loading {
  text-align: center;
  padding: 50px 20px;
  color: #7f8c8d;
}

/* Signature specific styles - to ensure proper rendering */
.signature-preview table {
  border-collapse: collapse;
}

.signature-preview img {
  display: block;
}

.signature-preview a {
  text-decoration: none;
}
