/* 
 * Combined CSS for Circle Sign-in Pages
 * Contains styles for:
 * - index.html (Sign in)
 * - signup.html (Create account)
 * - verification.html (Verification code)
 */

/* ==================== */
/* Base Styles - Common */
/* ==================== */
:root {
    /* Light mode colors */
    --bg-color: #ffffff;
    --text-primary: #000000;
    --text-secondary: #555555;
    --text-muted: #888888;
    --border-color: #dddddd;
    --input-bg: #ffffff;
    --card-bg: #ffffff;
    --button-bg: #000000;
    --button-text: #ffffff;
    --button-hover: #333333;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --link-color: #555555;
    --focus-color: #000000;
    --divider-color: #eeeeee;
    --alt-button-bg: #f5f5f5;
    --alt-button-hover: #eeeeee;
    --toggle-bg: #f5f5f5;
    --toggle-active: #000000;
}

.dark-mode {
    /* Dark mode colors */
    --bg-color: #121212;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --text-muted: #777777;
    --border-color: #333333;
    --input-bg: #1e1e1e;
    --card-bg: #1e1e1e;
    --button-bg: #ffffff;
    --button-text: #000000;
    --button-hover: #e6e6e6;
    --shadow-color: rgba(0, 0, 0, 0.25);
    --link-color: #aaaaaa;
    --focus-color: #ffffff;
    --divider-color: #333333;
    --alt-button-bg: #2a2a2a;
    --alt-button-hover: #333333;
    --toggle-bg: #333333;
    --toggle-active: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Exo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Background - Common */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.5;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.3s ease;
}

.bg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.5;
}

.light-bg {
    display: block;
}

.dark-bg {
    display: none;
}

.dark-mode .light-bg {
    display: none;
}

.dark-mode .dark-bg {
    display: block;
}

/* Theme Toggle - Common */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--toggle-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toggle-icon {
    font-size: 18px;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.dark-icon {
    display: none;
}

.light-icon {
    display: block;
}

.dark-mode .dark-icon {
    display: block;
}

.dark-mode .light-icon {
    display: none;
}

/* Card Container Structure - Common */
.login-wrapper,
.signup-wrapper,
.verification-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.login-container,
.signup-container,
.verification-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-card,
.signup-card,
.verification-card {
    width: 100%;
    max-width: 400px;
    text-align: center;
    padding: 28px 24px;
    border-radius: 20px;
    background-color: var(--card-bg);
    box-shadow: 0 10px 30px var(--shadow-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease-out forwards;
}

.login-card::before,
.signup-card::before,
.verification-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    opacity: 0.8;
}

/* Divider Styles */
.divider {
    display: flex;
    align-items: center;
    margin: 16px 0;
    color: var(--text-muted);
}

.divider-line {
    flex: 1;
    height: 1px;
    background-color: var(--divider-color);
    margin: 0;
    transform: translateY(1px);
}

.divider-text {
    padding: 0 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
}

/* Social Login Styles */
.social-btn {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 600;
}

.logo img {
    max-width: 50px;
    height: auto;
}

/* Typography - Common */
h1 {
    font-size: 28px;
    color: var(--text-primary);
    margin: 16px 0 8px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.brand-text {
    position: relative;
    font-weight: 700;
    background: linear-gradient(90deg, var(--button-bg) 0%, var(--button-hover) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    padding-bottom: 2px;
}

.dark-mode .brand-text {
    background: linear-gradient(90deg, var(--button-text) 0%, var(--button-hover) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 16px;
    font-weight: 400;
    letter-spacing: -0.2px;
}

.subtitle strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Form Elements - Common */
.login-form,
.signup-form,
.verification-form {
    width: 100%;
}

.input-group {
    position: relative;
    margin-bottom: 6px;
    margin-top: 12px;
    text-align: left;
    transition: all 0.3s ease;
}

/* Input group focus styling handled through child elements */

.input-group {
    margin-bottom: 6px; /* Spacing between input and its error message */
    margin-top: 12px; /* Added spacing between input groups */
}

.input-group:first-of-type {
    margin-top: 0; /* No top margin for the first input */
}

.input-icon-wrapper {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.input-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    filter: var(--icon-filter, none);
    transition: opacity 0.3s ease;
}

.dark-mode .input-icon {
    --icon-filter: invert(1);
}

/* Button Styles - Common */
.continue-btn,
.submit-btn {
    width: 100%;
    padding: 16px;
    margin-top: 24px; 
    background-color: var(--button-bg);
    color: var(--button-text);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.continue-btn::after,
.submit-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.dark-mode .continue-btn::after,
.dark-mode .submit-btn::after {
    background: rgba(0, 0, 0, 0.3);
}

.continue-btn:hover,
.submit-btn:hover {
    background-color: var(--button-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--shadow-color);
}

.continue-btn:active,
.continue-btn.pressed,
.submit-btn:active,
.submit-btn.pressed {
    transform: translateY(1px);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.continue-btn:active::after,
.submit-btn:active::after {
    animation: ripple 1s;
    opacity: 0;
}

.continue-btn.loading::before,
.submit-btn.loading::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: var(--button-text);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Footer - Common */
.footer {
    margin-top: 44px;
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    padding-bottom: 10px;
}

.create-account {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
}

.create-account::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: var(--button-bg);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease;
}

.create-account:hover {
    color: var(--button-bg);
}

.create-account:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

.dark-mode .create-account:hover {
    color: var(--text-primary);
}

.dark-mode .create-account::after {
    background-color: var(--text-primary);
}

.secured-by {
    display: flex;
    color: var(--text-primary);
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    line-height: 1;
}

.secured-by:hover {
    opacity: 1;
}

.crox-logo {
    width: 18px;
    height: 18px;
}

.secured-by:hover .crox-logo {
    transform: rotate(10deg);
}

.crox-text {
    font-weight: 600;
}

.dark-mode .crox-logo {
    --logo-filter: brightness(0.9) invert(0.9);
}

/* Animations - Common */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Additional animation for input groups */
.input-group.shake {
    animation: shake 0.4s ease-in-out;
}

/* Social Login Styles */
.social-login {
    width: 100%;
    margin: 8px 0 46px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.social-btn {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 1.5px solid var(--border-color);
    background-color: var(--alt-button-bg);
    color: var(--text-primary);
}

.social-btn:hover {
    background-color: var(--alt-button-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.social-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.social-icon {
    width: 18px;
    height: 18px;
}

.dark-mode .social-icon {
    --icon-filter: invert(1);
}


/* ===================== */
/* Login Page Specifics  */
/* ===================== */

/* Login Form */
.login-form .input-group,
.signup-form .input-group {
    margin-bottom: 6px; /* Space between input and error message */
    margin-top: 12px; /* Space between input groups */
}

.login-form .input-group:first-of-type,
.signup-form .input-group:first-of-type {
    margin-top: 0; /* No top margin for first input */
}

input[type="email"],
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 16px 16px 16px 48px;
    background: var(--input-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    font-size: 16px;
    color: var(--text-primary);
    transition: all 0.3s;
    position: relative;
    z-index: 1;
}

input[type="email"]::placeholder,
input[type="text"]::placeholder,
input[type="password"]::placeholder {
    color: var(--text-muted);
    transition: color 0.3s ease, transform 0.3s ease;
}

input[type="email"]:focus,
input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--focus-color);
}

/* Button Animation */
.btn-text {
    margin-right: 8px;
    transition: transform 0.3s ease;
}

.btn-icon {
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.continue-btn:hover .btn-text,
.submit-btn:hover .btn-text {
    transform: translateX(-4px);
}

.continue-btn:hover .btn-icon,
.submit-btn:hover .btn-icon {
    opacity: 1;
    transform: translateX(0);
}

.continue-btn.loading .btn-text,
.continue-btn.loading .btn-icon,
.submit-btn.loading .btn-text,
.submit-btn.loading .btn-icon {
    opacity: 0;
}

/* ===================== */
/* Signup Page Specifics */
/* ===================== */

/* Password Input */
.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    color: var(--text-secondary);
}

.password-toggle i {
    font-size: 18px;
    transition: color 0.2s;
}

.password-toggle:hover i {
    color: var(--text-primary);
}

/* Ensure password input has proper right padding for the eye icon */
input[type="password"] {
    padding-right: 48px;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
    color: var(--text-muted);
    transition: color 0.3s ease, transform 0.3s ease;
}

input[type="email"]:focus,
input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--focus-color);
}

/* ========================= */
/* Verification Page Specifics */
/* ========================= */

/* Verification Message */
.verification-message {
    background-color: rgba(0, 0, 0, 0.03);
    border-left: 3px solid var(--button-bg);
    padding: 16px 20px;
    border-radius: 8px;
    margin: 24px 0 16px;
    text-align: left;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.dark-mode .verification-message {
    background-color: rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--button-text);
}

/* Modern Verification Code Input */


.verification-code-wrapper {
    position: relative;
    width: 100%;
    transition: all 0.3s ease;
    padding: 0px 0;
}

.verification-code-input {
    position: absolute;
    width: 100%;
    height: 60px;
    opacity: 0;
    z-index: 2;
    cursor: text;
    letter-spacing: 42px; /* Spread the text under the digits */
    font-size: 0; /* Hide the actual input characters */
    padding-left: 15px; /* Offset to align with the displayed digits */
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: textfield;
    caret-color: transparent;
}

.verification-code-input:focus {
    outline: none;
}

.code-digits {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 0 auto;
}

.code-digit {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background-color: var(--input-bg);
    border: 1.5px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.dark-mode .code-digit {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.code-digit::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--button-bg);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.dark-mode .code-digit::before {
    background: var(--button-text);
}

.code-digit::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--button-bg), var(--button-hover));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 1;
}

.dark-mode .code-digit::after {
    background: linear-gradient(90deg, var(--button-text), var(--button-hover));
}

.code-digit.active {
    border-color: var(--focus-color);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.dark-mode .code-digit.active {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.code-digit.filled {
    border-color: var(--button-bg);
}

.dark-mode .code-digit.filled {
    border-color: var(--button-text);
}

.code-digit.filled::after {
    transform: scaleX(1);
}

.code-digit.filled::before {
    opacity: 0.03;
}

.dark-mode .code-digit.filled::before {
    opacity: 0.1;
}

.code-digit span {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.code-digit.filled span {
    transform: scale(1.05);
}

.verification-code-wrapper.error .code-digit {
    border-color: #ff3b30;
    animation: shake 0.4s ease-in-out;
    box-shadow: 0 0 0 1px rgba(255, 59, 48, 0.1);
}

.verification-code-wrapper.error .code-digit::after {
    background: #ff3b30;
    transform: scaleX(1);
}

/* Success state */
.verification-code-wrapper.success .code-digit {
    border-color: #34c759;
    box-shadow: 0 0 0 1px rgba(52, 199, 89, 0.1);
}

.verification-code-wrapper.success .code-digit::after {
    background: #34c759;
    transform: scaleX(1);
}

.verification-code-wrapper.success .code-digit::before {
    background: #34c759;
    opacity: 0.05;
}

.dark-mode .verification-code-wrapper.success .code-digit::before {
    opacity: 0.15;
}

/* Resend Code */
.resend-code {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 16px; /* Increased for better spacing after error message */
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.resend-code a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    display: none;
    position: relative;
    transition: all 0.2s;
}

.resend-code a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: var(--button-bg);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease;
}

.resend-code a:hover {
    color: var(--button-bg);
}

.resend-code a:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

.dark-mode .resend-code a:hover {
    color: var(--text-primary);
}

.dark-mode .resend-code a::after {
    background-color: var(--text-primary);
}

.timer {
    font-weight: 500;
    color: var(--text-muted);
}

/* Error Message Styling */
.error-message {
    color: #ff3b30;
    font-size: 13px;
    margin-top: 2px;
    margin-bottom: 16px; /* Increased to add more space after error message */
    display: none;
    animation: fadeIn 0.3s ease-out;
    text-align: left;
    padding-left: 16px;
    font-weight: 500;
    letter-spacing: -0.2px;
    line-height: 1.2;
    transform: translateY(-2px);
    opacity: 0;
    transition: all 0.3s ease;
    height: 16px; /* Fixed height to maintain consistent spacing */
}

.error-message.visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Input Error State */
.input-group.error input {
    border-color: #ff3b30;
    box-shadow: 0 0 0 1px rgba(255, 59, 48, 0.1);
}

.input-group.error .input-icon {
    opacity: 0.9;
    filter: brightness(0.9) sepia(1) saturate(5) hue-rotate(320deg);
}

.dark-mode .input-group.error .input-icon {
    filter: brightness(0.9) sepia(1) saturate(5) hue-rotate(320deg) invert(1);
}

/* Forgot Password Link */
.forgot-password {
    text-align: right;
    margin-top: 8px;
    margin-bottom: 16px;
}

.forgot-password a {
    color: var(--link-color);
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s ease;
    position: relative;
}

.forgot-password a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: var(--button-bg);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease;
}

.forgot-password a:hover {
    color: var(--button-bg);
}

.forgot-password a:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

.dark-mode .forgot-password a:hover {
    color: var(--text-primary);
}

.dark-mode .forgot-password a::after {
    background-color: var(--text-primary);
}

/* Code Input Error State */
.code-inputs input.error {
    border-color: #ff3b30;
    animation: shake 0.4s ease-in-out;
    box-shadow: 0 0 0 1px rgba(255, 59, 48, 0.1);
}

/* ===================== */
/* Responsive Styles     */
/* ===================== */
@media (min-width: 1200px) {
    .login-card,
    .signup-card,
    .verification-card {
        max-width: 450px;
        padding: 36px 32px;
    }
}

@media (max-width: 768px) {
    .login-card,
    .signup-card,
    .verification-card {
        max-width: 400px;
        padding: 28px 24px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
        overflow: hidden;
    }
    
    .login-wrapper,
    .signup-wrapper,
    .verification-wrapper {
        align-items: stretch;
        padding: 0;
        height: 100%;
    }
    
    .login-container,
    .signup-container,
    .verification-container {
        height: 100%;
    }
    
    .login-card,
    .signup-card,
    .verification-card {
        max-width: 100%;
        height: 100%;
        padding: 24px 20px;
        border-radius: 0;
        box-shadow: none;
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow-y: auto;
        animation: none;
    }
    
    .login-card::before,
    .signup-card::before,
    .verification-card::before {
        height: 3px;
    }
    
    .continue-btn,
    .submit-btn {
        margin-top: 20px; 
        padding: 16px;
    }
    
    h1 {
        font-size: 22px;
        margin: 16px 0 8px;
    }
    
    .subtitle {
        font-size: 15px;
        margin-bottom: 20px;
    }
    
    input[type="email"],
    input[type="text"],
    input[type="password"] {
        padding: 16px 16px 16px 44px;
        font-size: 15px;
    }
    
    input[type="password"] {
        padding-right: 44px;
    }
    
    .input-icon-wrapper {
        left: 14px;
        width: 16px;
        height: 16px;
    }
    
    .password-toggle {
        right: 14px;
    }
    
    .code-inputs {
        gap: 6px;
        margin: 24px auto 24px;
        max-width: 280px;
    }
    
    .code-inputs input {
        height: 45px;
        font-size: 18px;
    }
    
    .resend-code,
    .login-link {
        font-size: 13px;
    }
    
    .theme-toggle {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }
    
    .footer {
        margin-top: auto;
        padding-bottom: 24px;
        font-size: 13px;
    }
}
