/* styles/modal.css
   Dialogs, backdrops, report modal, spinner/loader, fallback panels and A4 iframe styles
   Extracted from style.css
*/

/* Dialogs */
.picker,
.modal,
.report-modal {
  border: none;
  border-radius: 16px;
  width: min(920px, 92vw);
  padding: 0;
  max-height: 90dvh;
  overflow: auto;
}

.modal-header,
.report-modal .modal-header {
  position: sticky;
  top: 0;
  background: #fff;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body,
.report-modal .modal-body {
  padding: 16px;
  background: linear-gradient(#f6efe7, #f3ece4);
}

.report-modal .modal-body {
  overflow: auto;
}

.modal-body .a4-wrap,
.report-modal .modal-body .a4-wrap {
  min-height: 72dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

/* Backdrop */
.picker::backdrop,
.modal::backdrop,
.report-modal::backdrop {
  background: rgba(60, 46, 35, .22);
  backdrop-filter: blur(1.5px);
}

/* Spinner / loader */
.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(181, 139, 99, 0.12);
  border-top-color: #b58b63;
  animation: spin .9s linear infinite;
  margin: 36px auto;
}

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

.loader {
  height: 4px;
  background: #efe7df;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.loader::before {
  content: "";
  position: absolute;
  left: -40%;
  top: 0;
  width: 40%;
  height: 100%;
  background: #b58b63;
  animation: load 1s linear infinite;
  border-radius: 999px;
}

@keyframes load {
  from {
    left: -40%;
  }

  to {
    left: 100%
  }
}

/* Fallback / buttons */
.fallback {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

.modal .btn,
.report-modal .btn {
  background: #b58b63;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

.modal .btn.ghost,
.report-modal .btn.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
}

/* a4 iframe */
.a4-wrap iframe {
  width: 100%;
  height: 72dvh;
  border: 0;
  border-radius: 12px;
  display: block;
}

/* fallback inner */
.report-modal .report-fallback-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* fallback panel/content */
.report-modal .report-fallback-panel,
.report-modal .report-fallback-content {
  padding: 12px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--accent);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* p-12 wrapper (used instead of modal-body when reporting forms) */
#reportModal>.p-12,
.report-modal>.p-12 {
  padding: 16px;
  background: linear-gradient(#f6efe7, #f3ece4);
  max-height: 72vh;
  overflow: auto;
}

/* Report modal misc */
.report-modal {
  transition: opacity .28s ease, transform .28s ease
}

.report-modal.closing {
  opacity: 0;
  transform: translateY(-8px) scale(.99)
}

.report-modal[aria-busy="true"] {
  pointer-events: none;
  opacity: .95
}

/* Disabled link style inside modal */
.report-modal a.disabled,
.modal a.disabled {
  opacity: .55;
  pointer-events: none;
  cursor: default;
}

/* Fallback helpers */
#reportFallback .kv-inline {
  display: flex;
  gap: .5rem;
  align-items: baseline;
  line-height: 1.6
}

#reportFallback .kv-inline .k {
  min-width: 5.5rem;
  color: #555
}

#reportFallback .hours-label {
  opacity: .8
}

#reportFallback .hours-value {
  font-size: 1.2rem;
  font-weight: 600
}

/* Fallback helpers */
.sep-small {
  height: 8px
}

.sep-xsmall {
  height: 6px
}

.hr {
  border-top: 1px solid #e6e6e6;
  margin: 6px 0
}

/* General Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(60, 46, 35, 0.4);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* Modal Content Box */
.modal-content {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: min(500px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideIn 0.2s ease-out;
}

/* Modal Header */
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--accent);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: #999;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #333;
}

/* Modal Body */
.modal-body {
  padding: 20px;
  overflow-y: auto;
  background: var(--bg);
}

/* Modal Footer */
.modal-footer {
  padding: 16px 20px;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Animations */
@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Button Variants in Modal */
.btn-danger {
  background-color: #ef5350;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 500;
}

.btn-secondary {
  background-color: #f5f5f5;
  color: #666;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 500;
}

.btn-primary {
  background-color: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 500;
}

/* Form Controls in Modal */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.9rem;
  color: #555;
}

.form-control {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(181, 139, 99, 0.1);
}