/* ==========================================================================
   OneHCP Auth Server - Enhanced Responsive Styles for Child Windows
   ========================================================================== */

/* 
 * This file provides responsive overrides for auth screens when displayed 
 * in child windows or smaller viewports. It maintains the design aesthetics
 * while scaling elements appropriately for limited screen space.
 */

/* ========================================
   Base Responsive Foundation
======================================== */

/* For medium-sized child windows (900px - 1200px) */
@media (max-width: 1200px) {
  .auth-card-container {
    width: 60%;
    padding: 20px;
  }
  
  .auth-card {
    max-width: 550px;
    padding: 40px 45px 25px 45px;
  }
  
  .consent-layout .auth-card-container {
    width: 70%;
  }
  
  .consent-card {
    max-width: 650px;
  }
}

/* For typical child window size (700px - 900px) */
@media (max-width: 1024px) {
  .auth-layout {
    background-position: center;
    background-size: cover;
    justify-content: center;
  }
  
  .auth-card-container {
    width: 85%;
    height: 100vh;
    padding: 20px;
  }
  
  .auth-card {
    max-width: 520px;
    padding: 36px 40px 24px 40px;
    height: auto;
    max-height: calc(100vh - 40px);
  }
  
  .consent-layout .auth-card-container {
    width: 90%;
  }
  
  .consent-card {
    max-width: 600px;
    max-height: calc(100vh - 40px);
  }
  
  /* Scale form elements */
  .form-content {
    padding: 0 25px;
  }
  
  .form-title,
  .login-title,
  .signup-title,
  .consent-title {
    font-size: 26px;
  }
  
  .tagline {
    font-size: 30px;
    margin-bottom: 80px;
  }
  
  .welcome-title {
    font-size: 26px;
  }
  
  /* Logo sizing */
  .logo-image {
    height: 45px;
  }
  
  /* Button adjustments */
  .btn {
    height: 46px;
    font-size: 15px;
    padding: 0 36px;
  }
  
  .submit-btn,
  .btn-verify {
    height: 46px;
    max-width: 320px;
  }
  
  .btn-otp {
    width: 270px;
    height: 46px;
    font-size: 15px;
  }
  
  .social-btn {
    max-width: 130px;
    height: 46px;
  }
  
  /* Form input scaling */
  .form-input {
    padding: 12px 14px;
    font-size: 14px;
  }
  
  .form-label {
    font-size: 13px;
  }
  
  /* OTP inputs */
  .otp-input {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
  
  .otp-inputs {
    gap: 8px;
  }
  
  /* Consent page scaling */
  .consent-title {
    font-size: 24px;
  }
  
  .consent-section-title {
    font-size: 15px;
  }
  
  .consent-icon {
    width: 36px;
    height: 36px;
  }
  
  .consent-icon svg {
    width: 20px;
    height: 20px;
  }
  
  .consent-text-scroll {
    max-height: 110px;
  }
  
  .consent-text-scroll h3 {
    font-size: 13px;
  }
  
  .consent-text-scroll p {
    font-size: 12px;
  }
  
  .checkbox-label {
    font-size: 13px;
  }
  
  .checkbox-description {
    font-size: 11px;
  }
  
  /* Keypad adjustments */
  .keypad {
    max-width: 280px;
    padding: 12px 20px;
  }
  
  .keypad-btn {
    width: 65px;
    height: 40px;
    font-size: 18px;
  }
  
  /* Illustration scaling */
  .illustration-img {
    width: 300px;
  }
  
  .auth-footer {
    font-size: 12px;
    padding-bottom: 20px;
  }
}

/* For small child windows (500px - 700px) */
@media (max-width: 768px) {
  .auth-card-container {
    width: 95%;
    padding: 15px;
  }
  
  .auth-card {
    max-width: 100%;
    padding: 30px 32px 20px 32px;
    border-radius: var(--radius-lg, 12px);
    max-height: calc(100vh - 30px);
  }
  
  .consent-layout .auth-card-container {
    width: 95%;
  }
  
  .consent-card {
    max-width: 100%;
    padding: 28px 30px 20px 30px;
    max-height: calc(100vh - 30px);
  }
  
  /* Typography scaling */
  .form-title,
  .login-title,
  .signup-title {
    font-size: 24px;
  }
  
  .consent-title {
    font-size: 22px;
  }
  
  .tagline {
    font-size: 26px;
    margin-bottom: 60px;
  }
  
  .welcome-title {
    font-size: 24px;
    margin-bottom: 24px;
  }
  
  /* Form content */
  .form-content,
  .otp-content,
  .login-content,
  .signup-content {
    padding: 0 20px;
  }
  
  .consent-content {
    padding: 0 15px;
  }
  
  /* Logo */
  .logo-image {
    height: 40px;
  }
  
  /* Buttons */
  .btn {
    height: 44px;
    font-size: 15px;
    padding: 0 32px;
  }
  
  .action-buttons {
    gap: 12px;
  }
  
  .submit-btn,
  .btn-verify {
    height: 44px;
    max-width: 300px;
    font-size: 15px;
  }
  
  .btn-otp {
    width: 250px;
    height: 44px;
    font-size: 14px;
  }
  
  .social-btn {
    max-width: 120px;
    height: 44px;
  }
  
  /* Form elements */
  .form-group {
    margin-bottom: 16px;
  }
  
  .form-input {
    padding: 11px 12px;
    font-size: 14px;
  }
  
  .form-label {
    font-size: 13px;
    margin-bottom: 6px;
  }
  
  .form-header {
    margin-bottom: 28px;
  }
  
  /* OTP inputs */
  .otp-inputs {
    gap: 6px;
    margin-bottom: 16px;
  }
  
  .otp-input {
    width: 40px;
    height: 40px;
    font-size: 17px;
  }
  
  .otp-description {
    font-size: 14px;
    margin-bottom: 16px;
  }
  
  /* Keypad */
  .keypad {
    max-width: 260px;
    padding: 10px 18px;
  }
  
  .keypad-btn {
    width: 60px;
    height: 38px;
    font-size: 17px;
  }
  
  .keypad-row {
    margin-bottom: 10px;
  }
  
  /* Consent page */
  .consent-header {
    margin-bottom: 20px;
  }
  
  .consent-logo {
    margin-bottom: 12px;
  }
  
  .consent-title {
    font-size: 20px;
    margin-bottom: 6px;
  }
  
  .consent-subtitle {
    font-size: 13px;
  }
  
  .consent-section {
    margin-bottom: 20px;
  }
  
  .consent-section-header {
    gap: 10px;
    margin-bottom: 10px;
  }
  
  .consent-icon {
    width: 32px;
    height: 32px;
  }
  
  .consent-icon svg {
    width: 18px;
    height: 18px;
  }
  
  .consent-section-title {
    font-size: 14px;
  }
  
  .consent-box {
    padding: 12px;
    margin-bottom: 10px;
  }
  
  .consent-text-scroll {
    max-height: 100px;
  }
  
  .consent-text-scroll h3 {
    font-size: 12px;
    margin-bottom: 6px;
    margin-top: 10px;
  }
  
  .consent-text-scroll p {
    font-size: 11px;
    margin-bottom: 10px;
  }
  
  .scroll-indicator {
    font-size: 11px;
    gap: 4px;
    padding-top: 6px;
    margin-top: 6px;
  }
  
  .scroll-indicator svg {
    width: 14px;
    height: 14px;
  }
  
  .consent-checkbox {
    padding: 10px;
    gap: 10px;
  }
  
  .checkmark {
    width: 18px;
    height: 18px;
  }
  
  .checkbox-label {
    font-size: 12px;
  }
  
  .checkbox-description {
    font-size: 10px;
  }
  
  .required-badge,
  .optional-badge {
    font-size: 10px;
    padding: 3px 8px;
  }
  
  .consent-actions {
    margin-top: 20px;
    margin-bottom: 12px;
    gap: 12px;
  }
  
  .consent-actions .btn svg {
    width: 16px;
    height: 16px;
  }
  
  .consent-note {
    font-size: 11px;
  }
  
  .consent-note svg {
    width: 14px;
    height: 14px;
  }
  
  /* Email sent page */
  .email-sent-content {
    margin: -30px -32px;
    padding: 30px 32px;
  }
  
  .email-illustration {
    margin: 15px 0;
  }
  
  .illustration-img {
    width: 260px;
  }
  
  .email-message {
    font-size: 15px;
    margin-bottom: 20px;
  }
  
  .email-buttons {
    max-width: 300px;
  }
  
  .email-buttons .btn svg {
    width: 14px;
    height: 14px;
  }
  
  /* Footer */
  .auth-footer {
    font-size: 11px;
    padding-top: 16px;
    padding-bottom: 16px;
    margin-top: 16px;
  }
  
  /* Divider */
  .divider {
    margin: 16px 0;
  }
  
  .divider span {
    font-size: 12px;
    padding: 0 12px;
  }
  
  /* Terms text */
  .terms-text {
    font-size: 11px;
    margin-bottom: 16px;
  }
  
  /* Back button */
  .back-btn {
    font-size: 14px;
    padding: 6px 10px;
  }
  
  /* Forgot password */
  .forgot-password {
    margin-bottom: 20px;
  }
  
  .forgot-link {
    font-size: 13px;
  }
  
  /* Resend section */
  .resend-section {
    margin-bottom: 10px;
  }
  
  .resend-text {
    font-size: 13px;
  }
  
  .resend-btn {
    font-size: 13px;
  }
  
  /* Error text */
  .error-text {
    font-size: 11px;
  }
}

/* For very small child windows (400px - 500px) */
@media (max-width: 600px) {
  .auth-card-container {
    width: 100%;
    padding: 12px;
    height: 100vh;
  }
  
  .auth-card {
    padding: 24px 26px 18px 26px;
    max-height: calc(100vh - 24px);
    border-radius: var(--radius-md, 8px);
  }
  
  .consent-card {
    padding: 24px 24px 18px 24px;
    max-height: calc(100vh - 24px);
  }
  
  /* Typography */
  .form-title,
  .login-title,
  .signup-title,
  .consent-title {
    font-size: 22px;
  }
  
  .tagline {
    font-size: 24px;
    margin-bottom: 50px;
  }
  
  .welcome-title {
    font-size: 22px;
    margin-bottom: 20px;
  }
  
  /* Content padding */
  .form-content,
  .otp-content,
  .login-content,
  .signup-content {
    padding: 0 16px;
  }
  
  .consent-content {
    padding: 0 12px;
  }
  
  /* Logo */
  .logo-image {
    height: 36px;
  }
  
  /* Buttons - stack vertically for better usability */
  .btn {
    height: 42px;
    font-size: 14px;
    padding: 0 28px;
    margin-bottom: 12px;
  }
  
  .action-buttons {
    flex-direction: column;
    gap: 10px;
  }
  
  .action-buttons .btn {
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
  }
  
  .submit-btn,
  .btn-verify {
    height: 42px;
    max-width: 100%;
    font-size: 14px;
    margin: 20px auto 16px;
  }
  
  .btn-otp {
    width: 100%;
    max-width: 280px;
    height: 42px;
    font-size: 14px;
    margin: 0 auto 12px;
  }
  
  .social-buttons {
    gap: 12px;
  }
  
  .social-btn {
    max-width: none;
    flex: 1;
    height: 42px;
  }
  
  /* Form elements */
  .form-group {
    margin-bottom: 14px;
  }
  
  .form-input {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .form-label {
    font-size: 12px;
    margin-bottom: 5px;
  }
  
  .form-header {
    margin-bottom: 24px;
  }
  
  /* OTP */
  .otp-inputs {
    gap: 5px;
    justify-content: center;
  }
  
  .otp-input {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  .otp-description {
    font-size: 13px;
    margin-bottom: 14px;
  }
  
  /* Keypad */
  .keypad {
    max-width: 240px;
    padding: 8px 16px;
  }
  
  .keypad-btn {
    width: 55px;
    height: 36px;
    font-size: 16px;
  }
  
  .keypad-row {
    margin-bottom: 8px;
  }
  
  /* Consent sections */
  .consent-header {
    margin-bottom: 18px;
  }
  
  .consent-logo {
    margin-bottom: 10px;
  }
  
  .consent-title {
    font-size: 18px;
    margin-bottom: 4px;
  }
  
  .consent-subtitle {
    font-size: 12px;
  }
  
  .consent-section {
    margin-bottom: 16px;
  }
  
  .consent-section-header {
    gap: 8px;
    margin-bottom: 8px;
  }
  
  .consent-icon {
    width: 30px;
    height: 30px;
  }
  
  .consent-icon svg {
    width: 16px;
    height: 16px;
  }
  
  .consent-section-title {
    font-size: 13px;
  }
  
  .consent-box {
    padding: 10px;
    margin-bottom: 8px;
  }
  
  .consent-text-scroll {
    max-height: 90px;
  }
  
  .consent-text-scroll h3 {
    font-size: 11px;
    margin-bottom: 4px;
    margin-top: 8px;
  }
  
  .consent-text-scroll p {
    font-size: 10px;
    margin-bottom: 8px;
    line-height: 1.5;
  }
  
  .scroll-indicator {
    font-size: 10px;
    gap: 3px;
    padding-top: 4px;
    margin-top: 4px;
  }
  
  .scroll-indicator svg {
    width: 12px;
    height: 12px;
  }
  
  .consent-checkbox {
    padding: 8px;
    gap: 8px;
  }
  
  .checkmark {
    width: 16px;
    height: 16px;
    margin-top: 1px;
  }
  
  .consent-checkbox input[type="checkbox"]:checked + .checkmark::after {
    width: 4px;
    height: 8px;
    border-width: 0 1.5px 1.5px 0;
  }
  
  .checkbox-label {
    font-size: 11px;
  }
  
  .checkbox-description {
    font-size: 10px;
  }
  
  .required-badge,
  .optional-badge {
    font-size: 9px;
    padding: 2px 6px;
  }
  
  .consent-options {
    gap: 6px;
  }
  
  .consent-actions {
    flex-direction: column;
    margin-top: 16px;
    margin-bottom: 10px;
    gap: 10px;
  }
  
  .consent-actions .btn {
    width: 100%;
    max-width: 100%;
  }
  
  .consent-actions .btn svg {
    width: 14px;
    height: 14px;
  }
  
  .consent-note {
    font-size: 10px;
    gap: 6px;
  }
  
  .consent-note svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
  }
  
  /* Email sent page */
  .email-sent-content {
    margin: -24px -26px;
    padding: 24px 26px;
  }
  
  .email-illustration {
    margin: 12px 0;
  }
  
  .illustration-img {
    width: 220px;
  }
  
  .email-message {
    font-size: 14px;
    margin-bottom: 18px;
  }
  
  .email-buttons {
    max-width: 100%;
    width: 100%;
  }
  
  .email-buttons .btn {
    gap: 6px;
    font-size: 14px;
  }
  
  .email-buttons .btn svg {
    width: 14px;
    height: 14px;
  }
  
  /* Footer */
  .auth-footer {
    font-size: 10px;
    padding-top: 12px;
    padding-bottom: 12px;
    margin-top: 12px;
  }
  
  /* Divider */
  .divider {
    margin: 14px 0;
  }
  
  .divider span {
    font-size: 11px;
    padding: 0 10px;
  }
  
  /* Terms */
  .terms-text {
    font-size: 10px;
    margin-bottom: 14px;
    line-height: 1.5;
  }
  
  /* Back button */
  .back-btn {
    font-size: 13px;
    padding: 5px 8px;
    position: static;
    margin-top: -20px;
    align-self: flex-end;
  }
  
  /* Forgot password */
  .forgot-password {
    margin-bottom: 18px;
  }
  
  .forgot-link {
    font-size: 12px;
  }
  
  /* Resend section */
  .resend-section {
    margin-bottom: 8px;
  }
  
  .resend-text {
    font-size: 12px;
  }
  
  .resend-btn {
    font-size: 12px;
  }
  
  /* Error text */
  .error-text {
    font-size: 10px;
  }
}

/* For extra small windows (< 400px) */
@media (max-width: 480px) {
  .auth-card {
    padding: 20px 20px 16px 20px;
    max-height: calc(100vh - 20px);
  }
  
  .consent-card {
    padding: 20px 18px 16px 18px;
    max-height: calc(100vh - 20px);
  }
  
  .form-content,
  .otp-content,
  .login-content,
  .signup-content,
  .consent-content {
    padding: 0 12px;
  }
  
  .form-title,
  .login-title,
  .signup-title,
  .consent-title {
    font-size: 20px;
  }
  
  .logo-image {
    height: 32px;
  }
  
  .btn {
    height: 40px;
    font-size: 13px;
    padding: 0 24px;
  }
  
  .otp-input {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }
  
  .keypad {
    max-width: 220px;
    padding: 6px 14px;
  }
  
  .keypad-btn {
    width: 50px;
    height: 34px;
    font-size: 15px;
  }
  
  .illustration-img {
    width: 200px;
  }
}

/* ========================================
   Utility Classes for Better Scrolling
======================================== */

/* Improve scrollbar appearance in child windows */
.auth-card,
.consent-card,
.consent-text-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--neutral-300, #D1D5DB) transparent;
}

.auth-card::-webkit-scrollbar,
.consent-card::-webkit-scrollbar,
.consent-text-scroll::-webkit-scrollbar {
  width: 6px;
}

.auth-card::-webkit-scrollbar-track,
.consent-card::-webkit-scrollbar-track,
.consent-text-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.auth-card::-webkit-scrollbar-thumb,
.consent-card::-webkit-scrollbar-thumb,
.consent-text-scroll::-webkit-scrollbar-thumb {
  background-color: var(--neutral-300, #D1D5DB);
  border-radius: 3px;
}

.auth-card::-webkit-scrollbar-thumb:hover,
.consent-card::-webkit-scrollbar-thumb:hover,
.consent-text-scroll::-webkit-scrollbar-thumb:hover {
  background-color: var(--neutral-400, #9CA3AF);
}

/* ========================================
   Height Adjustments for Child Windows
======================================== */

/* Ensure content fits better in fixed-height child windows */
@media (max-height: 700px) {
  .auth-card {
    max-height: calc(100vh - 20px);
    overflow-y: auto;
  }
  
  .consent-card {
    max-height: calc(100vh - 20px);
  }
  
  .form-header,
  .consent-header {
    margin-bottom: 20px;
  }
  
  .form-group {
    margin-bottom: 14px;
  }
  
  .auth-footer {
    padding-top: 12px;
    padding-bottom: 12px;
  }
  
  .tagline {
    margin-bottom: 50px;
  }
  
  .email-illustration {
    margin: 10px 0;
  }
  
  .illustration-img {
    width: 240px;
  }
}

@media (max-height: 600px) {
  .auth-card {
    padding: 20px 30px 16px 30px;
  }
  
  .consent-card {
    padding: 20px 24px 16px 24px;
  }
  
  .form-header,
  .consent-header {
    margin-bottom: 16px;
  }
  
  .form-group {
    margin-bottom: 12px;
  }
  
  .auth-footer {
    padding-top: 10px;
    padding-bottom: 10px;
    font-size: 10px;
  }
  
  .tagline {
    font-size: 22px;
    margin-bottom: 40px;
  }
  
  .logo-image {
    height: 36px;
  }
  
  .consent-section {
    margin-bottom: 14px;
  }
  
  .consent-text-scroll {
    max-height: 80px;
  }
  
  .illustration-img {
    width: 200px;
  }
  
  .keypad {
    padding: 8px 16px;
  }
}

/* ========================================
   Print & High Contrast Mode Support
======================================== */

@media (prefers-contrast: high) {
  .form-input,
  .consent-box {
    border-width: 2px;
  }
  
  .checkmark {
    border-width: 2.5px;
  }
}

/* Prevent animations in reduced motion mode */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
