/* =========================================================
   1. SIDA OCH KNAPPAR
   ========================================================= */

h1 {
  text-align: center;
  margin: 8px 0;
  color: #193e4f;
}

button {
  cursor: pointer;
  font-size: 16px; 
  padding: 16px;
  margin-bottom: 8px;
}

.h2-rubrik {
  text-align: center;
  margin-bottom: 24px;
}

/* =========================================================
   2. GEMENSAM MODAL-BAS
   ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  display: none;
}

.modal.open { 
  display: flex; 
}

.modal-content {
  max-width: 450px;
  width: 90%;
  padding: 32px;
  display: flex;
  flex-direction: column;
  position: relative;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
  border-radius: 4px;
}

.modal .close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 24px;
  cursor: pointer;
}

/* H1/P gemensamt i modaler */
.modal-content h1,
.modal-content p {
  font-family: Arial, sans-serif;
  margin-top: 0;
}

.modal-content h1 {
  margin-bottom: 12px;
  line-height: 1.3;
}

.modal-content p {
  margin-bottom: 42px;
  line-height: 1.5;
}

.no-margin-p {
  margin-bottom: 0 !important;
}

/* =========================================================
   3. QR-MODAL
   ========================================================= */

#bankidModal .modal-content {
  background: #edf7fb;
}

#bankidLogo {
  display: block;
  width: 120px;
  height: auto;
  margin: -12px auto 8px auto;
}

#statusText {
  color: #193e4f;
  font-size: 15px;
  margin: 0 0 18px 0;
}

.processing { color: #193e4f; }
.done { color: #4caf50; }
.failed { color: #f44336; }

#spinner {
  width: 60px;
  height: 60px;
  border: 5px solid #ccc;
  border-top: 5px solid #0071ce;
  border-radius: 50%;
  animation: spin 0.5s linear infinite;
  display: none;
  margin: 18px 0 24px 0;
}

#bankidQr {
  width: 240px;
  height: 240px;
  border-radius: 8px;
  background: #fff;
  display: none;
  margin: 18px 0 24px 0;
}

/* Hjälpsektion */
.help-section {
  text-align: center;
  width: 100%;
  padding-bottom: 24px;
}

.help-section button {
  background: transparent;
  color: #193e4f;
  font-weight: bold;
  font-size: 15px; 
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 390px;
  padding: 16px 20px;
  margin: 0 auto;
  cursor: pointer;
}

.help-section button::after {
  content: "▼";
  font-size: 13px; 
  transition: transform 0.3s;
}

.help-section.open button::after {
  transform: rotate(-180deg);
}

.help-line {
  width: 390px;
  margin: 0 auto;
  border-top: 1px solid #193e4f;
}

.help-content {
  display: none;
  padding: 2px 20px;
  font-size: 14px;
  color: #333;
  text-align: left;
  line-height: 1.4;
  background: #fff;
  width: 350px;
  margin: 0 auto;
}

#openDeviceBtn button {
  background: #193e4f;
  color: white;
  border: 1px solid #193e4f;
  font-size: 18px; 
  padding: 13px 24px; 
  cursor: pointer;
  margin: 18px auto;
}

/* =========================================================
   4. ERROR-MODAL
   ========================================================= */

#errorModal .modal-content {
  background: #fee5e5;
}

#errorModal .error-emoji {
  font-size: 60px;
  color: #f44336;
  margin-bottom: 24px; 
}

#errorModal h1 {
  margin-bottom: 12px;
}

#errorModal .error-text {
  color: #333;
  font-size: 15px;
  margin-bottom: 42px;
}

#errorModal #retryBtn {
  background: #193e4f;
  color: white;
  border: 1px solid #193e4f;
  font-size: 18px;
  padding: 13px 24px;
  cursor: pointer;
  transition: background 0.2s ease;
  margin-top: 0; 
}

#errorModal #retryBtn:hover {
  background: #214f63;
}

.error-icon {
  width: 70px;
  height: 70px;
  background: #f44336;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
}

.error-icon span {
  color: white;
  font-weight: bold;
  font-size: 48px;
  line-height: 1;
}

/* =========================================================
   5. SUCCESS-MODAL
   ========================================================= */

#successModal .modal-content {
  background: #dff1e7;
}

.success-icon {
  width: 70px;
  height: 70px;
  background: #60b987;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
  position: relative;
}

.checkmark {
  width: 30px;
  height: 10px;
  border-left: 7px solid #183e4f;
  border-bottom: 7px solid #183e4f;
  transform: rotate(-45deg);
}

#successModal h1 {
  color: #183e4f;
  margin-bottom: 12px;
}

#successModal p {
  color: #193e4f;
  font-size: 15px;
  margin-bottom: 42px;
}

#successModal #successBtn {
  background: #193e4f;
  color: white;
  border: 1px solid #193e4f;
  font-size: 18px;
  padding: 13px 24px;
  cursor: pointer;
  margin-top: 0;
  transition: background 0.2s ease;
}

#successModal #successBtn:hover {
  background: #214f63;
}

/* =========================================================
   6. ANIMATIONER
   ========================================================= */

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* =========================================================
   7. FORMULÄR
   ========================================================= */

/* === Layout === */
form.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: flex-start;
}

.roles-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #f6f6f6;
  border-radius: 4px;
  padding: 2px 0 13px 0;
}

.roles-list label {
  display: flex;
  align-items: center;
  padding: 9px 0 0 9px;
}

.checkbox-group {
  margin-bottom: 20px;
}

.checkbox-group label {
  display: block;
  position: relative;
  padding-left: 20px;
  margin-bottom: 5px;
}

.checkbox-group input[type="checkbox"] {
  position: absolute;
  left: 0;
  margin-left: 0;
}

.terms-box {
  background: #f6f6f6;
  padding: 10px;
  max-height: 484px;
  overflow-y: auto;
  margin-bottom: 20px;
  margin-top: 5px;
  font-size: 12px;
  border-radius: 4px;
}

.terms-box h4 {
  margin: 0 0 10px 0;
}

/* === Form Inputs === */
.input {
  border: none;
  border-radius: 4px;
  padding: 15px 10px;
  margin-top: 5px;
  background: #f6f6f6;
  width: 92%;
}

.input:focus {
  outline: none;
}

.input-row, .input-row-customer { 
  display: flex; 
  gap: 10px; 
  padding-bottom: 8px; 
  align-items: flex-start; 
}

.input-row > div, .input-row-customer > div { 
  flex: 1 1 0; 
  min-width: 0; 
  position: relative; 
} 

.input-row .input {
  border-radius: 4px;
  background: #f6f6f6;
  color: #000;
  outline: none;
  padding-left: 12px;
  padding-right: 3px;
}

#portal_user:focus:placeholder-shown::placeholder {
  color: rgb(170, 170, 170);
}

#customer {
  height: 44.5px;
}

#customer, #customer_number {
  color: dimgray;
}

#customer_number {
  color: rgb(170, 170, 170);
  padding-right: 5px;
}

#customer option:first-child,
#customer_number option:first-child {
  color: dimgray;
}

#customer option,
#customer_number option {
  color: black;
}

.input-row .input::placeholder { 
  color: transparent; 
}

/* Label startar nere i fältet (som en placeholder) */
.input-row > div > label {
  position: absolute;
  left: 8px;
  top: 18px;
  color: dimgray;
  background: transparent;
  padding: 0 4px;
  pointer-events: none;
  transition: 0.2s ease;
}

/* Flytta upp när input har fokus eller innehåll */
.input-row > div:has(.input:focus) > label,
.input-row > div:has(.input:not(:placeholder-shown)) > label {
  top: -5px;
  font-size: 0.75rem;
  background: #f6f6f6;
}

.input-row-customer select.input {
  max-width: 390px;
  width: 100%;
}

/* Specialfält "Annat" */
.annat-input {
  margin-bottom: -10px;
  padding-left: 0px;
  width: calc(100% - 25px);
  border: none;
  border-bottom: 1px solid gray;
  background: #f6f6f6;
}

.annat-input:focus {
  outline: none;
  border-bottom: 1px solid gray;
}

.annat-label {
  padding-bottom: 15px !important;
  margin-top: 8px;
}

.role-other {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === Statusmeddelande === */
.form-message {
  background-color: #ccccdd;
  padding: 10px 15px;
  margin-bottom: 20px;
  color: #000;
  font-weight: bold;
  border-radius: 4px;
}

/* === Knappar === */
#startBankID {
  background: #193e4f;
  color: white;
  border: 1px solid #193e4f;
  font-size: 16px;
  padding: 13px 24px;
  cursor: pointer;
  margin-top: 0;
  transition: background 0.2s ease;
}

#startBankID:hover {
  background: #214f63;
}
