/* ACE Scholarships Keycloak Theme */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body { height: 100%; }
body { min-height: 100vh; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: rgb(252 252 252 / var(--tw-bg-opacity));
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px 0;
}

#kc-header {
    display: none;
}

.login-pf body {
    background-color: #f5f5f5;
}

#kc-container {
    width: 100%;
    max-width: 480px;
    padding: 20px;
}

#kc-content {
    width: 100%;
}

#kc-form-wrapper {
    background: white;
    padding: 48px 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ACE Logo */
.ace-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
    gap: 8px;
}

.ace-logo svg {
    width: 50px;
    height: 50px;
}

.ace-logo h1 {
    font-size: 42px;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -1px;
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.ace-logo h1 span {
    font-size: 18px;
    font-weight: 400;
    color: #6b7280;
    letter-spacing: 0;
}

/* Welcome Text */
.welcome-text {
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
    text-align: center;
    margin-bottom: 32px;
}

/* Create Account + Sign In Label */
.ace-create-account {
    text-align: center;
    margin-bottom: 10px;
}

.ace-create-account a {
    color: #f59e0b;
    text-decoration: underline;
    font-weight: 600;
    font-size: 16px;
    transition: color 0.2s;
}

.ace-create-account a:hover {
    color: #d97706;
}

.ace-create-separator {
    height: 2px;
    background: #111827;
    margin: 12px auto 14px;
    width: 70%;
    opacity: 0.9;
}

.ace-signin-label {
    text-align: center;
    font-size: 15px;
    color: #1f2937;
    margin-bottom: 20px;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

label {
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

/* Register form layout helpers (avoid Safari label rendering quirks) */
.kc-label-wrapper,
.kc-input-wrapper {
    width: 100%;
}

.kc-label-wrapper {
    margin-bottom: 8px;
}

#kc-register-form .form-group {
    display: flex;
    flex-direction: column;
}

#kc-register-form .control-label {
    display: block;
    float: none;
}

/* Keep required marker inline with label on registration */
#kc-register-form .kc-label-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}

#kc-register-form .kc-label-wrapper .required,
#kc-register-form .kc-label-wrapper .kc-required,
#kc-register-form .kc-label-wrapper .kc-form-required,
#kc-register-form .required {
    display: inline;
    margin-left: 4px;
    line-height: 1;
}

/* Hide stray checkbox-like artifacts in Safari unless explicitly wrapped */
#kc-register-form input[type="checkbox"] {
    display: none;
}

#kc-register-form .checkbox input[type="checkbox"],
#kc-register-form .ace-checkbox input[type="checkbox"] {
    display: inline-block;
}

/* Hide Keycloak's default password toggle on registration (Safari shows it) */
#kc-register-form button[data-password-toggle] {
    display: none;
}

/* Add space between back link and submit button on registration */
#kc-register-form #kc-form-options,
#kc-register-form .kc-form-options-wrapper {
    margin-bottom: 16px;
}

/* Input Fields */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"] {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

input::placeholder {
    color: #9ca3af;
}

/* Remember Me and Forgot Password */
.form-group.kcFormSettingClass {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

#kc-form-options {
    flex: 1;
}

.checkbox {
    display: flex;
    align-items: center;
}

.checkbox label {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 400;
    color: #4b5563;
    margin: 0;
    cursor: pointer;
}

.checkbox input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
}

.ace-forgot-link{
  margin-left:auto;
  font-size: 14px;
  color: #f59e0b;
  text-decoration:none;
  font-weight: 500;
  transition: color 0.2s;
}

.ace-forgot-link:hover{
    color: #d97706;
}

/* Login Button */
#kc-form-buttons {
    margin-bottom: 0;
}

input[type="submit"],
button.btn-primary {
    width: 100%;
    padding: 14px;
    background-color: #f59e0b;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

input[type="submit"]:hover,
button.btn-primary:hover {
    background-color: #d97706;
}

input[type="submit"]:active,
button.btn-primary:active {
    background-color: #b45309;
}

input[type="submit"]:disabled,
button.btn-primary:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

/* Button bases */
.btn {
    display: inline-block;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: #374151;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
    width: auto;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-link {
    border-color: #d1d5db;
    background: #f9fafb;
    color: #374151;
}

.btn-link:hover {
    background: #f3f4f6;
    border-color: #cbd5e1;
    color: #111827;
}

.btn-link:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    border-color: #e5e7eb;
}

/* Error Messages */
.input-error {
    display: block;
    color: #dc2626;
    font-size: 13px;
    margin-top: 6px;
}


/* Password rules */
.password-validator {
    margin-top: 12px;
    padding-top: 4px;
}

.password-validator__title {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.password-rule {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #dc2626;
    margin: 4px 0;
    font-weight: 600;
}

.password-rule::before {
    content: "x";
    font-size: 14px;
    line-height: 1;
    color: #dc2626;
    font-weight: 700;
}

.password-rule.is-valid {
    color: #166534;
}

.password-rule.is-valid::before {
    color: #16a34a;
    content: "v";
}

.password-rule.is-invalid {
    color: #dc2626;
}

.password-rule.is-invalid::before {
    color: #dc2626;
    content: "x";
}

#input-error-username {
    display: block;
    color: #dc2626;
    font-size: 13px;
    margin-top: 6px;
}

.alert-error {
    background-color: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Footer Section */
.kc-footer {
  text-align: center;
  color: var(--ace-muted, #6b7280);
  font-size: 12px;
  padding: 10px 0 26px;
}

.kc-footer p {
    margin: 5px 0;
}

.kc-footer-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.kc-footer-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  vertical-align: middle;
}

.kc-footer-powered{ margin-top: 2px; }

.ace-remember-forgot{
  display:flex;
  align-items:center;
  gap:12px;
  margin:6px 0 12px;
}

.ace-resend-row{
  display:flex;
  align-items:center;
  gap:12px;
  justify-content: space-between;
}


/* Position the eye button inside the input */
.input-wrapper { position: relative; }

.pw-toggle{
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #6b7280;          /* neutral gray */
  padding: 4px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 0;
}
.pw-toggle:hover,
.pw-toggle:focus{
  color: #111827;
  outline: none;
  box-shadow: 0 0 0 3px rgba(245,158,11,.25); /* subtle amber focus */
}

.eye { display: inline-block; }


/* Responsive */
@media (max-width: 480px) {
    #kc-form-wrapper {
        padding: 32px 24px;
    }

    .ace-logo h1 {
        font-size: 36px;
    }

    .welcome-text {
        font-size: 20px;
    }
}

/* Welcome Modal */
.ace-welcome-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ace-welcome-modal.is-hidden {
    display: none;
}

.ace-welcome-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
}

.ace-welcome-content {
    position: relative;
    background: #ffffff;
    width: min(520px, 92vw);
    padding: 28px 28px 24px;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
    z-index: 1;
    color: #1f2937;
}

.ace-welcome-content h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
}

.ace-welcome-content p {
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
}

.ace-welcome-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: transparent;
    font-size: 22px;
    color: #6b7280;
    cursor: pointer;
}

.ace-welcome-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 13px;
    color: #374151;
}

.ace-welcome-actions {
    margin-top: 16px;
    text-align: right;
}

.ace-welcome-actions .btn-primary {
    padding: 10px 16px;
    font-size: 14px;
}

/* Hide default register link */
.register-link {
    display: none !important;
}

/* Info Text */
.info-text {
    text-align: center;
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Alert Messages */
.alert-success {
    background-color: #dcfce7;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert-warning {
    background-color: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
}

.alert-info {
    background-color: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1e40af;
}

/* ACE Logo image */
.ace-logo img {
    max-width: 200px;
    height: auto;
}
