/* 
   Kerala Chatroom - Ultra-Glassmorphism Login & Registration Stylesheet
*/

:root {
    --primary-font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --text-pure: #ffffff;
    --text-dark: #1b3345;
    --text-muted: rgba(255, 255, 255, 0.82);
    --text-subtle: rgba(255, 255, 255, 0.65);
    --card-bg: rgba(255, 255, 255, 0.22);
    --card-border: rgba(255, 255, 255, 0.48);
    --field-bg: rgba(255, 255, 255, 0.22);
    --field-border: rgba(255, 255, 255, 0.48);
    --field-focus-glow: rgba(255, 255, 255, 0.9);
    --btn-blue-top: #588ec5;
    --btn-blue-bot: #30659a;
    --btn-reg-top: #4e82b0;
    --btn-reg-bot: #275279;
    --btn-blue-shadow: rgba(24, 68, 114, 0.4);
    --social-btn-bg: rgba(18, 38, 48, 0.48);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: var(--primary-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Page Background Wrapper */
.login-wrapper {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url('imgs/background.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    padding: 24px 16px;
    z-index: 1;
}

/* Ambient Backlighting */
.background-backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.08) 0%, rgba(0, 0, 0, 0.05) 100%);
    pointer-events: none;
    z-index: -1;
}

/* Realistic 3D Water Droplets */
.water-drop {
    position: absolute;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.12) 45%, rgba(0, 30, 60, 0.18) 100%);
    border-radius: 50%;
    box-shadow: 
        inset 1px 2px 3px rgba(0, 30, 60, 0.25),
        inset -1px -2px 3px rgba(255, 255, 255, 0.85),
        1px 2px 5px rgba(0, 0, 0, 0.16);
    pointer-events: none;
    z-index: 3;
}

.water-drop::after {
    content: '';
    position: absolute;
    top: 22%;
    left: 25%;
    width: 28%;
    height: 28%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    filter: blur(0.3px);
}

/* Viewport Corner Droplets */
.drop-corner-tl { top: 30px; left: 40px; width: 28px; height: 26px; }
.drop-corner-bl { bottom: 35px; left: 45px; width: 34px; height: 32px; }
.drop-corner-tr { top: 35px; right: 50px; width: 26px; height: 25px; }
.drop-corner-br { bottom: 40px; right: 45px; width: 30px; height: 28px; }

/* Card Droplets for Registration */
.drop-top-left-1 { top: 26px; left: 20px; width: 22px; height: 20px; transform: rotate(-15deg); }
.drop-top-left-2 { top: 54px; left: 24px; width: 13px; height: 12px; }
.drop-top-right-1 { top: 36px; right: 28px; width: 17px; height: 16px; }
.drop-mid-right-1 { top: 185px; right: 18px; width: 12px; height: 12px; }
.drop-mid-right-2 { top: 204px; right: 14px; width: 9px; height: 9px; }
.drop-mid-right-3 { top: 220px; right: 16px; width: 11px; height: 10px; }
.drop-bot-right-1 { bottom: 42px; right: 20px; width: 10px; height: 9px; }

/* Glassmorphism Card Container */
.glass-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    border: 1.5px solid var(--card-border);
    border-radius: 34px;
    padding: 34px 30px 28px;
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    box-shadow: 
        0 25px 55px -10px rgba(7, 30, 48, 0.35),
        inset 0 1.5px 2px rgba(255, 255, 255, 0.75),
        inset 0 -1.5px 2px rgba(255, 255, 255, 0.2);
    overflow: hidden;
    animation: fadeInScale 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Registration card width */
.glass-card.signup-card {
    max-width: 440px;
    padding: 28px 28px 24px;
}

/* Specular Glare */
.glass-glare {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.28) 0%, transparent 55%);
    pointer-events: none;
    z-index: 1;
}

/* Iridescent Soap-Bubble Aura Effects */
.iridescent-aura-top {
    position: absolute;
    top: -30px;
    right: -30px;
    width: 190px;
    height: 190px;
    background: radial-gradient(circle, 
        rgba(135, 206, 250, 0.45) 0%, 
        rgba(221, 160, 221, 0.35) 45%, 
        rgba(152, 251, 152, 0.25) 75%, 
        transparent 100%);
    filter: blur(14px);
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
}

.iridescent-aura-bottom {
    position: absolute;
    bottom: -35px;
    left: -35px;
    width: 170px;
    height: 170px;
    background: radial-gradient(circle, 
        rgba(147, 224, 255, 0.4) 0%, 
        rgba(216, 180, 254, 0.3) 50%, 
        rgba(167, 243, 208, 0.2) 80%, 
        transparent 100%);
    filter: blur(14px);
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
}

/* Card Header & Brand Logo */
.card-header {
    position: relative;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 200px;
}

.brand-logo {
    width: 100%;
    height: auto;
    max-height: 98px;
    object-fit: contain;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.35));
    transition: transform 0.4s ease;
    user-select: none;
}

.glass-card:hover .brand-logo {
    transform: scale(1.02);
}

/* Registration Title */
.registration-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--text-dark);
    margin-top: 6px;
    margin-bottom: 4px;
    text-align: center;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
}

/* Auth Form Base */
.auth-form {
    position: relative;
    z-index: 4;
    display: flex;
    flex-direction: column;
}

/* Field Block (Label on Top) */
.field-block {
    display: flex;
    flex-direction: column;
    margin-bottom: 11px;
}

.block-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-dark);
    text-transform: uppercase;
    margin-bottom: 4px;
    user-select: none;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
}

/* Translucent Input Containers */
.input-container {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: 14px;
    padding: 8px 12px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 
        inset 0 1px 1.5px rgba(255, 255, 255, 0.7),
        0 4px 14px rgba(0, 0, 0, 0.05);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.input-container.single-row-input {
    min-height: 40px;
    padding: 6px 12px;
}

.input-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
    pointer-events: none;
}

.input-container:focus-within {
    border-color: var(--field-focus-glow);
    background: rgba(255, 255, 255, 0.32);
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.95),
        0 0 16px rgba(255, 255, 255, 0.4);
}

.input-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-right: 8px;
    color: rgba(255, 255, 255, 0.95);
    flex-shrink: 0;
}

.field-icon {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    stroke-width: 1.8;
}

.input-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.input-label {
    font-size: 10.5px;
    font-weight: 400;
    color: var(--text-pure);
    letter-spacing: 0.2px;
    line-height: 1.2;
    margin-bottom: 1px;
    user-select: none;
    opacity: 0.92;
}

.text-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--primary-font);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-pure);
    padding: 0;
    line-height: 1.3;
}

.text-input.center-text {
    text-align: center;
}

.text-input::placeholder {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 400;
}

/* Two Columns Row (Age + Place) */
.form-row.two-cols-row {
    display: flex;
    gap: 12px;
}

.col-age {
    flex: 0 0 85px;
}

.col-place {
    flex: 1;
    min-width: 0;
}

/* Select Input */
.select-wrapper {
    position: relative;
    padding-right: 30px !important;
}

.select-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--primary-font);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-pure);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.select-input option {
    background: #1e3a4c;
    color: #ffffff;
}

.select-chevron {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
}

/* Grid Layout: Sex Selection & Credentials */
.form-grid-gender-creds {
    display: flex;
    gap: 12px;
    margin-bottom: 6px;
}

.sex-selection-block {
    flex: 0 0 100px;
}

.sex-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
}

.sex-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: 12px;
    padding: 6px 4px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.6);
    transition: all 0.2s ease;
    color: var(--text-pure);
}

.sex-btn .sex-symbol {
    font-size: 16px;
    line-height: 1;
    margin-bottom: 2px;
    opacity: 0.9;
}

.sex-btn .sex-text {
    font-family: var(--primary-font);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.sex-btn:hover {
    background: rgba(255, 255, 255, 0.32);
    border-color: rgba(255, 255, 255, 0.7);
}

.sex-btn.active {
    background: rgba(255, 255, 255, 0.36);
    border-color: #ffffff;
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.95),
        0 0 12px rgba(255, 255, 255, 0.3);
}

.sex-btn.active .sex-symbol,
.sex-btn.active .sex-text {
    opacity: 1;
    font-weight: 700;
}

.creds-stack {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Password Eye Toggle */
.toggle-password-btn {
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.85);
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.2s ease, transform 0.15s ease;
    margin-left: 4px;
}

.toggle-password-btn:hover {
    color: #ffffff;
    transform: scale(1.1);
}

.eye-icon {
    width: 17px;
    height: 17px;
}

/* Form Auxiliary */
.form-auxiliary {
    display: flex;
    justify-content: flex-end;
    margin-top: 1px;
    margin-bottom: 18px;
}

.link-btn {
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    font-family: var(--primary-font);
    font-size: 11.5px;
    font-weight: 400;
    color: var(--text-pure);
    text-decoration: underline;
    text-underline-offset: 3px;
    opacity: 0.92;
    transition: opacity 0.2s ease, text-shadow 0.2s ease;
}

.link-btn:hover {
    opacity: 1;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
}

/* Submit Pill Button */
.submit-btn {
    position: relative;
    width: 100%;
    background: linear-gradient(180deg, var(--btn-blue-top) 0%, var(--btn-blue-bot) 100%);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 25px;
    padding: 11px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-pure);
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.7),
        0 7px 20px var(--btn-blue-shadow);
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
    margin-top: 8px;
}

/* Signup Avatar Upload */
.signup-avatar-upload-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 12px;
}

.signup-avatar-preview-box {
    position: relative;
    width: 68px;
    height: 68px;
    margin-bottom: 4px;
}

.signup-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    background: #e2e8f0;
}

.signup-avatar-btn-overlay {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 26px;
    height: 26px;
    background: #30659a;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, background 0.2s ease;
}

.signup-avatar-btn-overlay:hover {
    transform: scale(1.1);
    background: #1e40af;
}

.signup-avatar-hint {
    font-size: 11px;
    color: var(--label-color);
    font-weight: 500;
}

.submit-btn.registration-btn {
    background: linear-gradient(180deg, var(--btn-reg-top) 0%, var(--btn-reg-bot) 100%);
    margin-top: 6px;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
    pointer-events: none;
}

.btn-text {
    font-family: var(--primary-font);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.submit-btn:hover {
    transform: translateY(-1.5px);
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.9),
        0 9px 25px rgba(24, 68, 114, 0.55);
    filter: brightness(1.06);
}

.submit-btn:active {
    transform: translateY(1px);
}

/* Spinner */
.btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
}

.submit-btn.loading .btn-spinner {
    display: inline-block;
}

/* Divider Wrap */
.divider-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 18px 0 14px;
    gap: 12px;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.32);
}

.divider-text {
    font-size: 11.5px;
    font-weight: 400;
    color: var(--text-pure);
    opacity: 0.85;
    letter-spacing: 0.2px;
    user-select: none;
}

/* Social Login */
.social-login-container {
    display: flex;
    justify-content: center;
}

.google-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--social-btn-bg);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 22px;
    padding: 7px 24px;
    min-width: 155px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 
        inset 0 1px 1.5px rgba(255, 255, 255, 0.35),
        0 4px 14px rgba(0, 0, 0, 0.15);
    transition: all 0.25s ease;
}

.google-login-btn:hover {
    background: rgba(18, 38, 48, 0.65);
    border-color: rgba(255, 255, 255, 0.55);
    transform: translateY(-1.5px);
}

.google-btn-text {
    font-family: var(--primary-font);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-pure);
    letter-spacing: 0.2px;
}

/* Card Footer */
.card-footer {
    margin-top: 14px;
    text-align: center;
}

.signup-prompt {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-pure);
    opacity: 0.92;
}

.signup-link {
    color: var(--text-pure);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
    margin-left: 2px;
    transition: text-shadow 0.2s ease, opacity 0.2s ease;
}

.signup-link:hover {
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    opacity: 1;
}

/* Modal Popup */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 15, 28, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    position: relative;
    background: rgba(255, 255, 255, 0.26);
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    border-radius: 24px;
    padding: 28px 24px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.8);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active .modal-card {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: #ffffff;
    cursor: pointer;
    opacity: 0.7;
}

.modal-icon-badge {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    color: #ffffff;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
}

.modal-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
    margin-bottom: 20px;
}

.modal-btn {
    background: linear-gradient(180deg, var(--btn-blue-top) 0%, var(--btn-blue-bot) 100%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: 9px 24px;
    color: #ffffff;
    font-family: var(--primary-font);
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(22, 45, 60, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    animation: toastIn 0.3s ease forwards;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.toast-success { border-color: rgba(90, 220, 150, 0.6); }
.toast.toast-error { border-color: rgba(255, 100, 100, 0.6); }

/* Keyframes */
@keyframes fadeInScale {
    from { opacity: 0; transform: translateY(15px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

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

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile Responsive & Touch Optimizations */
@media (max-width: 600px) {
    .login-wrapper {
        min-height: 100dvh;
        padding: max(16px, env(safe-area-inset-top)) 12px max(20px, env(safe-area-inset-bottom));
    }

    .glass-card {
        width: 100%;
        max-width: 440px;
        padding: 24px 18px 20px;
        border-radius: 24px;
    }

    .registration-title {
        font-size: 20px;
    }

    .form-row.two-cols-row {
        flex-direction: column;
        gap: 12px;
    }

    .col-age, 
    .col-place {
        width: 100% !important;
        flex: auto !important;
    }

    .form-grid-gender-creds {
        flex-direction: column;
        gap: 12px;
    }

    .sex-selection-block {
        flex: auto;
        width: 100%;
    }

    .sex-options {
        flex-direction: row;
        gap: 8px;
    }

    .brand-logo {
        max-height: 80px;
    }

    .text-input,
    .select-input {
        font-size: 14px;
        min-height: 42px;
    }

    .submit-btn {
        min-height: 46px;
        font-size: 13.5px;
    }

    .water-drop {
        opacity: 0.6;
    }
}

@media (max-width: 360px) {
    .glass-card {
        padding: 20px 14px 16px;
        border-radius: 20px;
    }

    .brand-logo {
        max-height: 68px;
    }

    .registration-title {
        font-size: 18px;
    }
}
