@import url("./styles.css");

/* ===== Admin Layout ===== */
.admin-main {
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.admin-shell {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

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

.panel-header h3 {
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: 1.5rem;
}

/* ===== Form Styles ===== */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

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

.label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input, .select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  transition: all 0.2s;
  background: #fff;
}

.input:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
  outline: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.5rem 0;
}

.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.form-meta {
  background: #fcfaf5;
  padding: 1.5rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

/* ===== Quill Editor Customization ===== */
.quill-editor {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  min-height: 250px;
  display: flex;
  flex-direction: column;
}

.quill-small {
  min-height: auto !important;
}

.quill-small .ql-editor {
  min-height: 60px !important;
  height: 60px;
  padding: 8px 12px;
}

.ql-toolbar.ql-snow {
  border: none;
  border-bottom: 1px solid var(--line);
  background: #f8f9fa;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.ql-container.ql-snow {
  border: none;
  flex: 1;
}

.ql-editor {
  min-height: 350px;
  font-size: 1.1rem;
  line-height: 1.7;
}

/* ===== Sidebar List ===== */
.list-panel {
  position: sticky;
  top: 100px;
}

.list-filters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.note-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.note-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.note-item-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-item-status {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  width: fit-content;
}

.note-item-status.draft {
  background: #fff3cd;
  color: #856404;
}

.note-item-status.published {
  background: #d4edda;
  color: #155724;
}

.note-item-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 59, 102, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: var(--surface);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  border-radius: 24px;
  overflow-y: auto;
  padding: 2.5rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ===== Auth Box ===== */
.auth-box {
  max-width: 400px;
  margin: 5rem auto;
  text-align: center;
}

.auth-box h2 {
  font-family: "Playfair Display", serif;
  margin-bottom: 2rem;
}

/* ===== Buttons ===== */
.btn-submit {
  width: 100%;
  padding: 1rem;
  font-size: 1.1rem;
  border-radius: 14px;
}



/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .list-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ===== Image Upload Component ===== */
.image-upload-wrapper {
  position: relative;
  width: 100%;
}

.image-upload-container {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-height: 120px;
  justify-content: center;
}

.image-upload-container:hover, .image-upload-container.drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.image-preview-container {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  display: none;
}

.image-preview-container img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.image-remove-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.2s;
  color: #e63946;
  z-index: 10;
}

.image-remove-btn:hover {
  background: #e63946;
  color: #fff;
  transform: scale(1.1);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.upload-placeholder .icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.upload-placeholder .text {
  font-weight: 600;
  font-size: 0.9rem;
}

.upload-placeholder .hint {
  font-size: 0.8rem;
  opacity: 0.7;
}

.hidden-input {
  display: none;
}
