/*
 * Central Parent Portal UI
 * Baracim Model School branding derived from the official school logo.
 */

:root {
  --baracim-green: #019444;
  --baracim-green-dark: #007a38;
  --baracim-green-soft: #eaf7f0;
  --baracim-orange: #f36523;
  --baracim-orange-dark: #d94d12;
  --baracim-orange-soft: #fff1e9;
  --baracim-charcoal: #58595b;
  --baracim-ink: #303236;
  --baracim-muted: #6d747d;
  --baracim-cream: #fff8f5;
  --baracim-surface: #ffffff;
  --baracim-border: #e4e8e5;
  --baracim-shadow: 0 10px 30px rgba(48, 50, 54, 0.09);
  --baracim-radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f4f7f5;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--baracim-ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(243, 101, 35, 0.07), transparent 25rem),
    linear-gradient(180deg, #fbfdfc 0, #f3f7f5 100%);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--baracim-green-dark);
}

a:hover,
a:focus {
  color: var(--baracim-green);
}

/* --------------------------------------------------------------------------
   Shared header
   -------------------------------------------------------------------------- */
.parent-site-header {
  position: relative;
  z-index: 1030;
  color: #fff;
  background: linear-gradient(118deg, var(--baracim-green-dark), var(--baracim-green) 62%, #10a653);
  box-shadow: 0 5px 22px rgba(0, 93, 43, 0.2);
}

.parent-header-accent {
  height: 5px;
  background: linear-gradient(90deg, var(--baracim-orange), #ff8a36 42%, var(--baracim-orange));
}

.parent-header-inner {
  min-height: 88px;
  padding: 10px clamp(14px, 3vw, 34px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.parent-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: #fff;
  text-decoration: none;
}

.parent-brand:hover,
.parent-brand:focus {
  color: #fff;
}

.parent-brand-logo {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  object-fit: cover;
  border-radius: 50%;
  background: #fff;
  border: 3px solid rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.parent-brand-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.parent-brand-copy strong {
  font-size: clamp(1rem, 2.1vw, 1.34rem);
  font-weight: 850;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.parent-brand-copy span {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.86rem;
  font-weight: 650;
}

.parent-header-account,
.parent-header-actions,
.parent-welcome {
  display: flex;
  align-items: center;
}

.parent-header-account {
  gap: 12px;
}

.parent-welcome {
  max-width: 190px;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 700;
}

.parent-welcome span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parent-header-actions {
  gap: 7px;
}

.parent-header-action {
  min-height: 40px;
  padding: 8px 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 750;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.parent-header-action:hover,
.parent-header-action:focus {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.42);
  transform: translateY(-1px);
}

.parent-logout-action {
  border-color: rgba(255, 217, 196, 0.6);
  background: rgba(243, 101, 35, 0.88);
}

.parent-logout-action:hover,
.parent-logout-action:focus {
  background: var(--baracim-orange-dark);
}

.parent-contact-action {
  min-width: 132px;
  background: rgba(255, 255, 255, 0.16);
}

/* Compatibility with the old header class while all pages move through the
   central header. */
.dashboard-header {
  color: #fff;
  background: var(--baracim-green);
}

/* --------------------------------------------------------------------------
   Shared footer
   -------------------------------------------------------------------------- */
.parent-site-footer,
.dashboard-footer {
  position: static;
  width: 100%;
  margin-top: auto;
  padding: 0;
  color: #fff;
  background: var(--baracim-charcoal);
  border-top: 4px solid var(--baracim-orange);
}

.parent-footer-inner {
  min-height: 72px;
  padding: 10px clamp(14px, 3vw, 34px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.parent-footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.parent-footer-brand img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(255, 255, 255, 0.86);
}

.parent-footer-brand div,
.parent-footer-meta {
  display: flex;
  flex-direction: column;
}

.parent-footer-brand strong {
  font-size: 0.9rem;
}

.parent-footer-brand span,
.parent-footer-meta {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
}

.parent-footer-meta {
  align-items: flex-end;
  gap: 3px;
}

.parent-footer-meta a {
  color: #fff;
  font-weight: 750;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Global content and components
   -------------------------------------------------------------------------- */
.dashboard-section,
.content,
main {
  width: 100%;
}

.dashboard-section {
  padding-top: 22px;
  padding-bottom: 42px;
}

.card,
.dashboard-widget,
.login-container,
.summary-card,
.month-section {
  border-color: var(--baracim-border);
}

.card,
.dashboard-widget,
.login-container {
  border-radius: var(--baracim-radius);
}

.card-header.bg-success,
.bg-success,
.table-success > :not(caption) > * > *,
.table-success th,
.modal-header.brand {
  background-color: var(--baracim-green) !important;
  color: #fff !important;
}

.text-success,
.text-green {
  color: var(--baracim-green) !important;
}

.text-orange {
  color: var(--baracim-orange) !important;
}

.text-blue {
  color: var(--baracim-green-dark) !important;
}

.text-purple {
  color: #7c4d9e !important;
}

.btn-green,
.btn-success,
.btn-primary {
  color: #fff !important;
  background-color: var(--baracim-green) !important;
  border-color: var(--baracim-green) !important;
}

.btn-green:hover,
.btn-green:focus,
.btn-success:hover,
.btn-success:focus,
.btn-primary:hover,
.btn-primary:focus {
  color: #fff !important;
  background-color: var(--baracim-green-dark) !important;
  border-color: var(--baracim-green-dark) !important;
}

.btn-outline-success,
.btn-outline-primary {
  color: var(--baracim-green-dark) !important;
  border-color: var(--baracim-green) !important;
}

.btn-outline-success:hover,
.btn-outline-success:focus,
.btn-outline-primary:hover,
.btn-outline-primary:focus {
  color: #fff !important;
  background: var(--baracim-green) !important;
  border-color: var(--baracim-green) !important;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(1, 148, 68, 0.62);
  box-shadow: 0 0 0 0.22rem rgba(1, 148, 68, 0.14);
}

.badge.bg-warning {
  color: #4b341f !important;
  background: #ffd59c !important;
}

.dashboard-widget {
  position: relative;
  min-height: 142px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--baracim-border);
  box-shadow: 0 3px 12px rgba(48, 50, 54, 0.06);
  transition: transform 0.17s ease, box-shadow 0.17s ease, border-color 0.17s ease;
}

.dashboard-widget::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: var(--baracim-radius) 0 0 var(--baracim-radius);
  background: linear-gradient(180deg, var(--baracim-green), var(--baracim-orange));
  opacity: 0;
  transition: opacity 0.17s ease;
}

.dashboard-widget:hover,
.dashboard-widget:focus-within {
  transform: translateY(-3px);
  border-color: rgba(1, 148, 68, 0.3);
  box-shadow: var(--baracim-shadow);
}

.dashboard-widget:hover::before,
.dashboard-widget:focus-within::before {
  opacity: 1;
}

.widget-icon {
  margin-right: 0;
  font-size: 30px;
}

.modal-header {
  color: #fff;
  background: var(--baracim-green);
}

/* --------------------------------------------------------------------------
   Central loading overlay
   -------------------------------------------------------------------------- */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(2px);
}

#loading-overlay.hidden {
  display: none !important;
}

.parent-loading-box {
  min-width: 118px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--baracim-charcoal);
  background: #fff;
  border: 1px solid var(--baracim-border);
  border-radius: 16px;
  box-shadow: var(--baracim-shadow);
  font-size: 0.86rem;
  font-weight: 750;
}

.custom-spinner,
#loading-overlay .spinner-border {
  width: 2.75rem;
  height: 2.75rem;
  border: 0.36rem solid rgba(1, 148, 68, 0.2);
  border-top-color: var(--baracim-orange);
  border-radius: 50%;
  animation: parent-spin 0.78s linear infinite;
}

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

/* --------------------------------------------------------------------------
   Public/login page
   -------------------------------------------------------------------------- */
.parent-public-page {
  background:
    radial-gradient(circle at 14% 12%, rgba(243, 101, 35, 0.13), transparent 26rem),
    radial-gradient(circle at 86% 60%, rgba(1, 148, 68, 0.12), transparent 30rem),
    #f7faf8;
}

.parent-public-page .parent-site-header {
  box-shadow: 0 4px 20px rgba(0, 93, 43, 0.16);
}

.parent-login-main {
  flex: 1 0 auto;
  width: 100%;
  padding: clamp(28px, 6vw, 72px) 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  width: 100%;
  max-width: 430px;
  padding: clamp(24px, 5vw, 36px);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--baracim-border);
  border-top: 5px solid var(--baracim-orange);
  box-shadow: var(--baracim-shadow);
}

.login-header {
  margin-bottom: 26px;
  text-align: center;
}

.login-header .login-mark {
  width: 68px;
  height: 68px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--baracim-green), var(--baracim-green-dark));
  border-radius: 19px;
  box-shadow: 0 8px 20px rgba(1, 148, 68, 0.2);
  font-size: 1.75rem;
}

.login-header h1 {
  margin: 0 0 8px;
  color: var(--baracim-charcoal);
  font-size: 1.55rem;
  font-weight: 850;
}

.login-header p {
  margin: 0;
  color: var(--baracim-muted);
}

.login-container .form-group {
  position: relative;
  margin-bottom: 18px;
}

.login-container .form-control {
  min-height: 48px;
  border-radius: 11px;
}

.login-container .input-group-prepend {
  position: absolute;
  top: 36px;
  left: 13px;
  z-index: 4;
  color: var(--baracim-muted);
  font-weight: 750;
}

.login-container .phone-control {
  padding-left: 28px;
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  .parent-header-inner {
    min-height: 76px;
    gap: 10px;
  }

  .parent-brand {
    gap: 9px;
  }

  .parent-brand-logo {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
  }

  .parent-brand-copy strong {
    font-size: 0.94rem;
  }

  .parent-brand-copy span {
    max-width: 46vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75rem;
  }

  .parent-welcome {
    display: none;
  }

  .parent-header-action {
    width: 39px;
    min-width: 39px;
    height: 39px;
    min-height: 39px;
    padding: 0;
    border-radius: 10px;
  }

  .parent-header-action span {
    display: none;
  }

  .parent-contact-action {
    width: auto;
    min-width: 43px;
    padding: 0 11px;
  }

  .parent-contact-action span {
    display: inline;
  }

  .parent-footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-top: 13px;
    padding-bottom: 13px;
  }

  .parent-footer-meta {
    align-items: flex-start;
  }

  .dashboard-section {
    padding-top: 16px;
    padding-bottom: 28px;
  }
}

@media (max-width: 575.98px) {
  .parent-header-inner {
    padding-left: 10px;
    padding-right: 10px;
  }

  .parent-brand-logo {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .parent-brand-copy strong {
    max-width: 43vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.84rem;
  }

  .parent-brand-copy span {
    max-width: 43vw;
  }

  .parent-header-actions {
    gap: 5px;
  }

  .parent-contact-action span {
    display: none;
  }

  .dashboard-widget {
    min-height: 126px;
    padding: 14px;
  }

  .widget-icon {
    font-size: 25px;
  }
}
