/* ==========================================================
   GLOBAL BASE STYLES
   ========================================================== */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #f2f5f8;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main, .main, .container { flex: 1; }

/* ==========================================================
   HEADER / NAVIGATION
   ========================================================== */
.header {
  background-color: #52a2d8;
  color: #fff;
  padding: 12px 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.pagetitle {
  text-align: center;
  font-size: 1.5em;
  font-weight: bold;
  margin: 5px;
}

.nav {
  display: flex;
  justify-content: center;
  gap: 40px;
}

.nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  transition: color 0.2s ease;
}

.nav a:hover { color: #d0ecff; }

/* ==========================================================
   DASHBOARD / BOX LAYOUT (centered pages)
   ========================================================== */
.main {
  flex: 1 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.box {
  background: #fff;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .1);
  text-align: center;
  max-width: 640px;
  width: 100%;
}

h1 { color: #333; }

/* ==========================================================
   CONTAINERS (for forms / content pages)
   ========================================================== */
.container {
  max-width: 800px;
  width: 90%;
  background: #fff;
  padding: 20px 30px;
  border-radius: 10px;
  margin: 40px auto;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* ==========================================================
   HEADINGS
   ========================================================== */
h2 {
  background: #52a2d8;
  color: #fff;
  padding: 10px;
  border-radius: 6px;
  text-align: center;
}

h3 {
  color: #333;
  border-bottom: 2px solid #52a2d8;
  padding-bottom: 4px;
  margin-top: 30px;
}

/* ==========================================================
   FORMS (universal styles)
   ========================================================== */
label {
  font-weight: bold;
  display: block;
  margin-top: 10px;
}

input[type=text],
input[type=password],
input[type=email],
input[type=number],
select,
textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-sizing: border-box;
  font-size: 15px;
  margin-top: 4px;
}

button,
input[type=submit] {
  background: #52a2d8;
  color: #fff;
  border: none;
  padding: 12px 24px;
  margin-top: 25px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

button:hover,
input[type=submit]:hover {
  background: #428bb3;
}

/* ==========================================================
   FORM SUCCESS / ERROR MESSAGES
   ========================================================== */
.message {
  max-width: 600px;
  margin: 15px auto;
  padding: 12px 16px;
  border-radius: 6px;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  font-size: 15px;
}

.message.success {
  background-color: #e6f4ea;
  color: #0a5c25;
  border: 1px solid #a9e4b6;
}

.message.error {
  background-color: #fdeaea;
  color: #a10000;
  border: 1px solid #f5b2b2;
}

/* ==========================================================
   FORM SUCCESS / ERROR MESSAGES (with fade-out animation)
   ========================================================== */
.message {
  max-width: 600px;
  margin: 15px auto;
  padding: 12px 16px;
  border-radius: 6px;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  font-size: 15px;
  opacity: 1;
  transition: opacity 1s ease-out;
  animation: fadeOut 1s ease-out 4s forwards; /* wait 4s, then fade over 1s */
}

.message.success {
  background-color: #e6f4ea;
  color: #0a5c25;
  border: 1px solid #a9e4b6;
}

.message.error {
  background-color: #fdeaea;
  color: #a10000;
  border: 1px solid #f5b2b2;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; visibility: hidden; }
}


/* ==========================================================
   FORM PAGE OVERRIDE (scrollable pages)
   ========================================================== */
body.form-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0;
  margin: 0;
}

body.form-page > .container,
body.form-page > .client-list,
body.form-page > main,
body.form-page > .main {
  flex: 1 0 auto;
  width: 100%;
  display: block;
}

/* ==========================================================
   CLIENT LIST PAGE (Active Clients Landing)
   ========================================================== */
.client-list {
  max-width: 800px;
  margin: 40px auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  padding: 20px 30px;
}

.client-item {
  border-bottom: 1px solid #ddd;
  padding: 12px 0;
}

.client-item:last-child { border-bottom: none; }

.client-name {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.client-location {
  font-size: 14px;
  color: #666;
}

.empty {
  text-align: center;
  padding: 30px 0;
  color: #999;
  font-style: italic;
}

/* ==========================================================
   FORM ROWS (Side-by-side fields)
   ========================================================== */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 10px;
}

.form-row .form-group {
  flex: 1 1 48%;
  display: flex;
  flex-direction: column;
}

.form-row .form-group label { margin-bottom: 4px; }

@media (max-width: 600px) {
  .form-row .form-group { flex: 1 1 100%; }
}

/* ==========================================================
   STATUS GROUP (Radio Buttons Inline)
   ========================================================== */
.status-group {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 10px;
  align-items: center;
}

.status-group label {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.status-group input[type="radio"] {
  margin: 0;
  transform: scale(1.1);
}

@media (max-width: 400px) {
  .status-group {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================
   CONTACT INFORMATION (Phones & Emails)
   ========================================================== */
.phone-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.phone-block {
  background: #fff;
  padding: 10px;
  border-radius: 6px;
  box-shadow: 0 0 4px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
}

.phone-block label {
  font-weight: bold;
  margin-bottom: 4px;
}

.phone-block input[type="text"] {
  width: 100%;
  max-width: 200px;
}

.email-block {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 15px;
}

.email-block .form-group {
  flex: 1 1 48%;
  display: flex;
  flex-direction: column;
}

/* ==========================================================
   LOGIN CREDENTIALS
   ========================================================== */
.login-credentials-block {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 15px;
}

.login-credentials-block .form-group {
  flex: 1 1 48%;
  display: flex;
  flex-direction: column;
}

.login-credentials-block .form-group label { margin-bottom: 4px; }

@media (max-width: 600px) {
  .login-credentials-block .form-group { flex: 1 1 100%; }
}

/* ==========================================================
   ADDRESS BLOCK LAYOUT
   ========================================================== */
.address-block .form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 10px;
}

.address-block .form-group.short {
  flex: 0 1 120px;
  max-width: 120px;
}

.address-block .form-group.wide {
  flex: 1 1 60%;
  max-width: 500px;
}

.address-block .form-group.city { flex: 1 1 60%; }
.address-block .form-group.state { flex: 0 1 80px; max-width: 80px; }
.address-block .form-group.zip { flex: 0 1 140px; max-width: 140px; }

@media (max-width: 700px) {
  .address-block .form-row { flex-direction: column; }
  .address-block .form-group { flex: 1 1 100%; }
  .address-block .form-group.short,
  .address-block .form-group.state,
  .address-block .form-group.zip {
    flex: 0 1 auto;
    max-width: 140px;
  }
}

/* ==========================================================
   TOOLTIP HELP ICONS
   ========================================================== */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 8px;
}

.tooltip::before {
  content: "?";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  background-color: #52a2d8;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: background-color 0.2s ease;
}

.tooltip:hover::before { background-color: #428bb3; }

.tooltip .tooltiptext {
  visibility: hidden;
  opacity: 0;
  width: 240px;
  background-color: #333;
  color: #fff;
  text-align: left;
  border-radius: 6px;
  padding: 8px 10px;
  position: absolute;
  z-index: 10;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  transition: opacity 0.3s;
  font-size: 13px;
  line-height: 1.3;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.tooltip.active .tooltiptext { visibility: visible; opacity: 1; }

.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
}

@media (max-width: 600px) {
  .tooltip .tooltiptext {
    width: 200px;
    font-size: 14px;
    bottom: 140%;
  }
}

/* ==========================================================
   FOOTER STYLES
   ========================================================== */
.footer {
  background-color: #222;
  color: #ddd;
  text-align: center;
  padding: 16px 10px;
  margin-top: auto;
  font-size: 14px;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.2);
}

.footer a {
  color: #d0ecff;
  text-decoration: none;
  font-weight: 500;
}

.footer a:hover { color: #52a2d8; }

/* ==========================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================== */
@media (max-width: 900px) {
  .phone-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .phone-grid { grid-template-columns: 1fr; }
  .email-block .form-group { flex: 1 1 100%; }
  .client-list { margin: 20px; padding: 15px; }
  .nav { gap: 20px; flex-wrap: wrap; }
  .box, .container { margin: 20px; padding: 20px; width: auto; }
  .client-name { font-size: 16px; }
  .client-location { font-size: 13px; }
}
