* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

.container,
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header,
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #ddd;
}

.header-actions {
  display: flex;
  gap: 10px;
}

h1 {
  font-size: 2rem;
  color: #222;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: #333;
}

/* Card Styles - CRITICAL FOR EDIT SCREEN */
.card {
  background: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 30px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  background: #333;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s;
}

.btn:hover {
  background: #555;
}

.btn-primary {
  background: #007bff;
}

.btn-primary:hover {
  background: #0056b3;
}

.btn-secondary {
  background: #6c757d;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-small {
  padding: 5px 10px;
  font-size: 12px;
  margin: 0 5px;
}

.btn-danger {
  background: #dc3545;
}

.btn-danger:hover {
  background: #c82333;
}

/* Form Styles */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #555;
  font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

input[type="checkbox"] {
  margin-right: 8px;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

/* Share Link Styles */
.share-link {
  display: flex;
  gap: 10px;
  align-items: center;
}

.share-link input {
  flex: 1;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #f8f9fa;
  font-family: monospace;
}

/* Block Type Selector */
.block-type-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.block-type-btn {
  padding: 15px 25px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
}

.block-type-btn:hover {
  background: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Block Forms */
.block-form {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 8px;
  margin-top: 20px;
}

/* Tables */
table {
  width: 100%;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

thead {
  background: #f8f9fa;
}

th {
  text-align: left;
  padding: 15px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  font-size: 12px;
}

td {
  padding: 15px;
  border-top: 1px solid #eee;
}

.actions {
  white-space: nowrap;
}

/* Blocks List */
.blocks-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.block-item {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.block-type {
  background: #007bff;
  color: white;
  padding: 5px 12px;
  border-radius: 3px;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.block-actions {
  display: flex;
  gap: 5px;
  align-items: center;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px 10px;
  transition: transform 0.2s;
}

.btn-icon:hover {
  transform: scale(1.2);
}

.block-preview {
  margin-top: 10px;
  color: #666;
}

.block-preview img {
  border-radius: 4px;
  margin-top: 10px;
}

.block-preview strong {
  display: block;
  margin-bottom: 8px;
  color: #333;
}

.block-preview p {
  margin: 5px 0;
  line-height: 1.5;
}

.badge {
  background: #28a745;
  color: white;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 10px;
}

.text-muted {
  color: #999;
  font-style: italic;
}

/* Input with Button */
.input-with-button {
  display: flex;
  gap: 10px;
}

.input-with-button input {
  flex: 1;
}

/* Edit Block Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  padding: 0;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.close {
  font-size: 28px;
  font-weight: bold;
  color: #999;
  cursor: pointer;
  transition: color 0.2s;
}

.close:hover,
.close:focus {
  color: #333;
}

#editBlockForm {
  padding: 20px;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 20px;
  border-top: 1px solid #e0e0e0;
  background-color: #f8f9fa;
}

.edit-field-group {
  margin-bottom: 20px;
}

/* Empty State */
.empty-state {
  text-align: center;
  color: #999;
  padding: 40px;
  font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .header-actions {
    flex-direction: column;
  }
  
  .block-type-selector {
    flex-direction: column;
  }
  
  .modal-content {
    width: 95%;
    max-height: 95vh;
  }
  
  .modal-header h2 {
    font-size: 1.2rem;
  }
}