@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700;900&display=swap");
@import url("https://fonts.cdnfonts.com/css/gilroy-bold");

/* ===== GLOBAL RESET ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Montserrat", sans-serif;
}

/* ===== ROOT VARIABLES ===== */
:root {
  --navy-primary: #0a1f3b;
  --navy-secondary: #1a365d;
  --corporate-white: #ffffff;
  --border-radius: 16px;
  --transition: all 0.3s ease;
}

/* ===== BODY BASE STYLES ===== */
body {
  font-family: "Montserrat", sans-serif;
  font-weight: 400;
  min-height: 100vh;
  line-height: 1.6;
  font-size: 16px;
  color: #222;
}

/* ===== INDEX PAGE SPECIFIC ===== */
body.index-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: url("img/subcon.jpeg") no-repeat center center fixed;
  background-size: cover;
  padding-top: 10px;
}

/* ===== REGISTER/LOGIN PAGE SPECIFIC ===== */
body.register-page {
  font-family: "Montserrat", sans-serif;
  color: var(--corporate-white);
  background: url("img/subcon.jpeg") no-repeat center center fixed;
  background-size: cover;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2rem 1rem;
}

/* ===== TOP CONTROLS (Admin + Language Buttons) ===== */
.top-controls {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.75rem;
  z-index: 999;
}

.control-btn {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(0, 75, 134, 0.1);
}

.control-btn:hover {
  background: #004b86;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 75, 134, 0.2);
}

.control-btn svg {
  width: 22px;
  height: 22px;
  fill: #004b86;
  transition: var(--transition);
}

.control-btn:hover svg {
  fill: white;
}

body.register-page .control-btn {
  background: #004b86;
}

body.register-page .control-btn svg {
  fill: #ffffff;
}

body.register-page .control-btn:hover {
  background: #006bbf;
}

#langBtn svg {
  display: none;
}

#langBtn::after {
  content: "EN";
  font-family: "Gilroy-Bold", "Montserrat", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: #004b86;
  transition: var(--transition);
  letter-spacing: 0.5px;
}

#langBtn:hover::after {
  color: white;
}

#langBtn[data-lang="en"]::after {
  content: "BM";
}

#langBtn[data-lang="ms"]::after {
  content: "EN";
}

body.register-page #langBtn::after {
  color: #ffffff;
}

/* ===== LOGOS ===== */
.header-logos {
  margin-top: 0.25rem; /* reduce vertical space above logos */
  margin-bottom: 0.25rem; /* control spacing below logos */
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-top: 0.75rem;
  width: 100%;
  padding: 0 1rem;
}

.header-logos img {
  height: 70px;
  width: auto;
  object-fit: contain;
}

.logo-left {
  height: 80px;
}

.logo-right {
  height: 70px;
}

/* ===== LOCATION INFO ===== */
.location-info {
  margin-top: 1.5rem;
  color: #000;
  font-size: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: center;
}

.company-name {
  font-family: "Gilroy-Bold", "Montserrat", sans-serif;
  font-weight: bold;
  font-size: 1rem;
}

.address {
  font-family: "Montserrat", sans-serif;
  font-weight: normal;
  font-size: 1rem;
}

/* ===== PERASMI SECTION (Registration Card) ===== */
.perasmi-section {
  margin: 0.25rem auto;
  display: inline-block;
  max-width: 700px;
  padding: 0.875rem 1.5rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s ease-out;
  text-align: center;
}

.perasmi-section.show {
  opacity: 1;
  transform: translateY(0);
}

.perasmi-title {
  font-family: "Gilroy-Bold", "Montserrat", sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: #004b86;
}

.perasmi-content .perasmi-info h3 {
  font-family: "Gilroy-Bold", "Montserrat", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: #004b86;
}

.perasmi-content .perasmi-info p {
  font-family: "Montserrat", sans-serif;
  font-size: 1rem;
  line-height: 1.3;
  color: #333;
}

.divider {
  width: 60px;
  height: 2px;
  background: #004b86;
  margin: 0.6rem auto;
  border-radius: 2px;
}

.perasmi-quote {
  font-family: "Montserrat", sans-serif;
  font-style: italic;
  color: #004b86;
  font-size: 0.95rem;
  line-height: 1.3;
  margin-bottom: 0.875rem;
}

.register-btn {
  display: inline-block;
  background: #004b86;
  color: white;
  font-family: "Gilroy-Bold", "Montserrat", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 2rem;
  border-radius: 30px;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.register-btn:hover {
  background: #006dcc;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

/* ===== SIDEBAR ===== */
.sidebar-vertical {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%) translateX(0);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 8px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
  box-shadow: 2px 0 15px rgba(0, 75, 134, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-left: none;
  z-index: 1000;
  opacity: 1;
  transition: all 0.3s ease;
}

.sidebar-vertical .sidebar-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: "Montserrat", sans-serif;
  font-size: 0.55rem;
  font-weight: 600;
  color: #004b86;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  text-transform: uppercase;
  opacity: 0.75;
}

.sidebar-vertical .social-icons {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.sidebar-vertical .social-icons li {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-vertical .social-icons li a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 75, 134, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.sidebar-vertical .social-icons li a:hover {
  background: #004b86;
  transform: translateX(3px);
  box-shadow: 0 3px 10px rgba(0, 75, 134, 0.18);
}

.sidebar-vertical .social-icons li img {
  width: 14px;
  height: 14px;
  transition: var(--transition);
  filter: grayscale(0%) brightness(0.4);
}

.sidebar-vertical .social-icons li a:hover img {
  filter: brightness(0) invert(1);
  transform: scale(1.08);
}

/* ===== FOOTER IMAGE ===== */
.footer-image {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1.5rem auto 1rem;
}

.footer-image img {
  width: 100%;
  max-width: 750px;
  height: auto;
}

/* ===== FORM CARD (Register/Login) ===== */
.form-card {
  background: linear-gradient(180deg, #ffffff 0%, #f9f9f9 100%);
  padding: 2rem 1.5rem;
  border-radius: var(--border-radius);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  max-width: 650px;
  width: 100%;
  text-align: center;
  position: relative;
  overflow: hidden;
  color: #222;
}

.form-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(
    90deg,
    var(--navy-primary),
    var(--navy-secondary)
  );
}

.form-card h2 {
  font-family: "Gilroy-Bold", "Montserrat", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: var(--navy-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== FORM STYLES ===== */
.form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form label {
  display: flex;
  flex-direction: column;
  text-align: left;
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  color: #333;
  font-size: 1rem;
  letter-spacing: 0.3px;
}

.form input,
.form select {
  margin-top: 0.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius);
  background: #fff;
  color: #000;
  font-size: 1rem;
  font-family: "Montserrat", sans-serif;
  transition: var(--transition);
}

.form input::placeholder,
.form select option {
  color: #555;
}

.form input:focus,
.form select:focus {
  outline: none;
  border-color: var(--navy-secondary);
  background: #fff;
}

.form-row {
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
}

/* ===== BUTTON STYLES ===== */
.btn {
  display: inline-block;
  padding: 1rem 2.5rem;
  border-radius: var(--border-radius);
  background: linear-gradient(
    135deg,
    var(--navy-primary) 0%,
    var(--navy-secondary) 100%
  );
  color: var(--corporate-white);
  font-family: "Gilroy-Bold", "Montserrat", sans-serif;
  font-weight: 600;
  font-size: 1rem;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: 0 8px 25px rgba(10, 31, 59, 0.3);
  transition: var(--transition);
  border: none;
  cursor: pointer;
  min-width: 200px;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(10, 31, 59, 0.5);
}

/* ===== MESSAGE STYLES ===== */
.message {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  font-family: "Montserrat", sans-serif;
  font-weight: 500;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.4;
  display: none;
}

.message.show {
  display: block;
  animation: fadeInUp 0.4s ease forwards;
}

.message.success {
  background: rgba(40, 167, 69, 0.15);
  color: #155724;
  border: 1px solid rgba(40, 167, 69, 0.3);
}

.message.error {
  background: rgba(220, 53, 69, 0.15);
  color: #721c24;
  border: 1px solid rgba(220, 53, 69, 0.3);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== CONDITIONAL FIELDS ===== */
.conditional-field {
  display: none;
  margin-top: 0.5rem;
}

.conditional-field.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet (768px and below) */
@media (max-width: 768px) {
  .sidebar-vertical {
    display: none;
  }

  .top-controls {
    top: 10px;
    right: 10px;
  }

  .control-btn {
    width: 45px;
    height: 45px;
  }

  .control-btn svg {
    width: 20px;
    height: 20px;
  }

  .header-logos {
    gap: 1.5rem;
    margin-top: 0.5rem;
  }

  .header-logos img {
    height: 65px;
  }

  .logo-left {
    height: 70px;
  }

  .logo-right {
    height: 65px;
  }

  .location-info {
    font-size: 0.9rem;
    margin-top: 1.25rem;
  }

  .perasmi-section {
    max-width: 90%;
    padding: 0.875rem 1.25rem;
  }

  .perasmi-title {
    font-size: 1.8rem;
  }

  .perasmi-content .perasmi-info h3 {
    font-size: 1.1rem;
  }

  .perasmi-content .perasmi-info p {
    font-size: 0.95rem;
  }

  .footer-image {
    margin: 1.25rem auto 1rem;
  }

  .footer-image img {
    width: 80%;
  }

  body.register-page {
    padding: 1.5rem 1rem;
  }

  .form-card {
    padding: 1.75rem 1.25rem;
    max-width: 100%;
  }

  .form-card h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
  }

  .form {
    gap: 1.25rem;
  }

  .form label {
    font-size: 0.95rem;
  }

  .form input,
  .form select {
    padding: 0.875rem 1rem;
    font-size: 16px;
  }

  .btn {
    padding: 0.875rem 2rem;
    font-size: 0.95rem;
    min-width: 180px;
  }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
  .top-controls {
    top: 8px;
    right: 8px;
    gap: 0.5rem;
  }

  .control-btn {
    width: 40px;
    height: 40px;
  }

  .control-btn svg {
    width: 18px;
    height: 18px;
  }

  #langBtn::after {
    font-size: 0.8rem;
  }

  .header-logos {
    gap: 1rem;
    padding: 0 0.5rem;
    margin-top: 0.35rem;
  }

  .header-logos img {
    height: 55px;
  }

  .logo-left {
    height: 60px;
  }

  .logo-right {
    height: 55px;
  }

  .location-info {
    font-size: 0.85rem;
    gap: 0.15rem;
    padding: 0 1rem;
    margin-top: 1rem;
  }

  .company-name {
    font-size: 0.9rem;
  }

  .address {
    font-size: 0.85rem;
  }

  .perasmi-section {
    max-width: 95%;
    padding: 0.75rem 1rem;
    margin: 0.75rem auto;
  }

  .perasmi-title {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
  }

  .perasmi-content .perasmi-info h3 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
  }

  .perasmi-content .perasmi-info p {
    font-size: 0.875rem;
  }

  .divider {
    margin: 0.5rem auto;
  }

  .perasmi-quote {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
  }

  .register-btn {
    font-size: 0.9rem;
    padding: 0.65rem 1.5rem;
  }

  .footer-image {
    margin: 1.25rem auto 1rem;
  }

  .footer-image img {
    width: 85%;
  }

  body.register-page {
    padding: 1rem 0.75rem;
  }

  .form-card {
    padding: 1.5rem 1rem;
    border-radius: 12px;
  }

  .form-card h2 {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
  }

  .form {
    gap: 1rem;
  }

  .form label {
    font-size: 0.875rem;
  }

  .form input,
  .form select {
    padding: 0.75rem 0.875rem;
    border-radius: 12px;
    font-size: 16px;
  }

  .btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    border-radius: 12px;
    width: 100%;
    min-width: unset;
  }

  .message {
    font-size: 0.85rem;
    padding: 0.625rem 0.875rem;
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  .form input,
  .form select {
    min-height: 44px;
  }

  .btn {
    min-height: 44px;
  }

  .control-btn {
    min-width: 44px;
    min-height: 44px;
  }
}

/* Print styles */
@media print {
  .top-controls,
  .sidebar-vertical,
  .register-btn {
    display: none !important;
  }

  body {
    background: white !important;
  }

  .form-card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* PDPA Consent Checkbox */
.pdpa-consent {
  margin: 1.5rem 0;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin-top: 3px;
  cursor: pointer;
  accent-color: #004b86;
}

.checkbox-text {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #333;
  text-align: justify;
}

.checkbox-label input[type="checkbox"]:not(:checked) + .checkbox-text {
  color: #666;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-text {
  color: #004b86;
  font-weight: 500;
}

/* ===== PHONE INPUT STYLING ===== */
.phone-input-wrapper {
  position: relative;
  width: 100%;
  margin-top: 0.5rem; /* Match other inputs */
}

.phone-input-wrapper .phone-prefix {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: #666;
  font-size: 1rem;
  font-weight: 500;
  pointer-events: none;
  z-index: 2;
}

.phone-input-wrapper input {
  padding: 1rem 1.25rem 1rem 3.5rem !important;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius);
  background: #fff;
  color: #000;
  font-size: 1rem;
  font-family: "Montserrat", sans-serif;
  transition: var(--transition);
  width: 100%;
  margin-top: 0 !important; /* Override any inherited margin */
  box-sizing: border-box;
}

.phone-input-wrapper input:focus {
  outline: none;
  border-color: var(--navy-secondary);
  background: #fff;
}

.phone-input-wrapper input::placeholder {
  color: #555;
}

/* Responsive adjustments for phone input */
@media (max-width: 768px) {
  .phone-input-wrapper input {
    padding: 0.875rem 1rem 0.875rem 3.5rem !important;
    font-size: 16px;
  }

  .phone-input-wrapper .phone-prefix {
    left: 1rem;
  }
}

@media (max-width: 480px) {
  .phone-input-wrapper input {
    padding: 0.75rem 0.875rem 0.75rem 3.25rem !important;
    border-radius: 12px;
    font-size: 16px;
  }

  .phone-input-wrapper .phone-prefix {
    left: 0.875rem;
    font-size: 0.95rem;
  }
}

.id-toggle-btn {
  padding: 0.75rem 1.5rem;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s;
  color: #666;
}

.id-toggle-btn.active {
  background: #004b86;
  color: white;
  border-color: #004b86;
}

.id-toggle-btn:hover {
  border-color: #004b86;
}

/* Profile picture upload styles */
.profile-pic-upload {
  margin-bottom: 1.5rem;
  text-align: center;
}

.profile-pic-preview {
  width: 150px;
  height: 150px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #004b86;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-pic-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-pic-preview svg {
  width: 60px;
  height: 60px;
  opacity: 0.3;
}

.upload-btn-wrapper {
  position: relative;
  display: inline-block;
}

.upload-btn {
  padding: 0.75rem 1.5rem;
  background: #004b86;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s;
}

.upload-btn:hover {
  background: #003d6b;
}

.upload-btn-wrapper input[type="file"] {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.remove-pic-btn {
  margin-top: 10px;
  padding: 8px 16px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.3s;
  width: 100%;
}

.remove-pic-btn:hover {
  background: #c82333;
}

/* Highlight animation for table updates */
@keyframes tableHighlight {
  0% {
    background-color: #fff3cd;
  }
  100% {
    background-color: transparent;
  }
}

tbody.highlight {
  animation: tableHighlight 0.5s ease-out;
}
