/* ==========================================================================
   HOME NEWS - ADMIN CREATE ADVERTISEMENT CAMPAIGN CSS
   File: assets/css/advertisement-create.css
   ========================================================================== */

/* 1. Page Layout (Two-Column Responsive Grid) */
.ad-create-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(300px, 0.95fr);
  gap: 24px;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
}

.ad-main-column,
.ad-sidebar-column {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.sticky-sidebar-card {
  position: -webkit-sticky;
  position: sticky;
  top: 88px;
}

/* 2. White Card Containers */
.form-card {
  background: #ffffff;
  border: 1px solid #dce4ef;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(16, 25, 45, 0.04);
  box-sizing: border-box;
  width: 100%;
}

.form-card:last-child {
  margin-bottom: 0;
}

.form-card-title {
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 1.08rem;
  font-weight: 700;
  color: #10192d;
  margin: 0 0 18px 0;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 3. Reusable Form Grid & Controls */
.modal-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.form-label {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  color: #172033;
  letter-spacing: 0.01em;
  margin: 0;
}

.form-label-required::after {
  content: " *";
  color: var(--primary-red, #E31824);
}

.field-subtext {
  font-size: 0.76rem;
  color: #64748b;
  margin-top: 3px;
  line-height: 1.4;
}

/* Base Form Inputs */
.form-control,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.92rem;
  color: #0f172a;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form-control {
  height: 44px;
}

.form-control::placeholder,
.form-textarea::placeholder {
  color: #94a3b8;
  font-size: 0.88rem;
}

.form-control:hover,
.form-select:hover,
.form-textarea:hover {
  background-color: #ffffff;
  border-color: #94a3b8;
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  background-color: #ffffff;
  border-color: var(--primary-red, #E31824);
  box-shadow: 0 0 0 3px rgba(227, 24, 36, 0.14);
}

.form-control:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background-color: #e2e8f0;
  color: #64748b;
  cursor: not-allowed;
  border-color: #cbd5e1;
}

/* Form Select Dropdown */
.form-select {
  height: 44px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23334155' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 10px;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
}

/* Date input styling */
input[type="date"].form-control {
  cursor: pointer;
  color: #0f172a;
}

/* Form Textarea */
.form-textarea {
  min-height: 90px;
  padding: 10px 14px;
  line-height: 1.5;
  resize: vertical;
}

/* Validation error states */
.form-control.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
  border-color: #dc2626 !important;
  background-color: #fef2f2 !important;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus,
.form-textarea.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16) !important;
}

.field-error-message {
  font-size: 0.78rem;
  color: #dc2626;
  font-weight: 600;
  margin-top: 4px;
  display: none;
}

.field-error-message.active {
  display: block;
}

.form-validation-msg {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  display: none;
  line-height: 1.4;
}

.form-validation-msg.active {
  display: block;
}

/* 4. Creative File Upload & Dropzone System */
.custom-file-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  background-color: #f8fafc;
  padding: 22px 20px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  overflow: hidden;
}

.custom-file-dropzone:hover,
.custom-file-dropzone.dragover {
  border-color: var(--primary-red, #E31824);
  background-color: #fff5f5;
}

.dropzone-file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
}

.dropzone-prompt {
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dropzone-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 2px;
}

.dropzone-text {
  font-size: 0.88rem;
  color: #334155;
  margin: 0;
}

.btn-browse-link {
  background: none;
  border: none;
  color: var(--primary-red, #E31824);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
}

.dropzone-hint {
  font-size: 0.74rem;
  color: #64748b;
}

/* Image Upload Preview Card */
.custom-image-preview-wrapper {
  margin-top: 8px;
}

.preview-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #dce4ef;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.preview-img-container {
  border-radius: 4px;
  overflow: hidden;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid #cbd5e1;
}

.preview-img-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.preview-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-filename {
  font-size: 0.84rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-filesize {
  font-size: 0.74rem;
  color: #64748b;
}

.preview-actions-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-action-pill {
  background: none;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action-pill:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-remove-image {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-remove-image:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

/* 5. Placement Selection Grid */
.placement-select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.placement-select-item {
  border: 1px solid #dce4ef;
  border-radius: 6px;
  padding: 12px 14px;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  user-select: none;
  box-sizing: border-box;
}

.placement-select-item:hover {
  background: #ffffff;
  border-color: #94a3b8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.placement-select-item:has(input[type="checkbox"]:checked) {
  border-color: var(--primary-red, #E31824);
  background-color: #fff9f9;
}

.placement-select-item input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--primary-red, #E31824);
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
}

.placement-select-item .item-details {
  flex: 1;
}

.placement-select-item .item-details strong {
  display: block;
  font-size: 0.86rem;
  color: #0f172a;
  font-weight: 600;
}

.placement-select-item .item-details span {
  display: block;
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 2px;
}

/* 6. Action Buttons in Form Card */
.form-action-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.btn-form-submit {
  width: 100%;
  height: 46px;
  background: var(--primary-red, #E31824);
  border: 1px solid var(--primary-red, #E31824);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.94rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-form-submit:hover {
  background: #b9131d;
  border-color: #b9131d;
}

.btn-form-secondary {
  width: 100%;
  height: 42px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-form-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-form-preview {
  width: 100%;
  height: 42px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-form-preview:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.btn-form-cancel {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  color: #64748b;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-form-cancel:hover {
  color: #0f172a;
  background-color: #f1f5f9;
}

/* 7. Responsive Media Breakpoints */
@media screen and (max-width: 1100px) {
  .ad-create-layout {
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
    gap: 20px;
  }
}

@media screen and (max-width: 900px) {
  .ad-create-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .sticky-sidebar-card {
    position: static;
  }

  .placement-select-grid {
    grid-template-columns: 1fr;
  }
}

@media screen and (max-width: 600px) {
  .modal-grid-2col {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .form-card {
    padding: 18px 16px;
  }

  .preview-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .preview-actions-strip {
    width: 100%;
    justify-content: flex-end;
  }
}
