:root {
    --primary-bg: hsl(220, 100%, 98%); /* Background of the whole page */
    --card-bg: hsl(0, 0%, 100%); /* Background of the login card and modal */
    --text-color: hsl(230, 2%, 35%); /* General text color */
    --label-color: hsl(0, 0%, 30%); /* Label text color */
    --input-border-radius: 15px; /* Rounded corners for inputs */
    --button-color: #673ab7; /* Button background color */
    --button-hover-color: #512da8; /* Button hover background color */
    --shadow-color: rgba(0, 0, 0, 0.08); /* Slightly stronger, more visible shadow */
    --logo-color: #512da8; /* Main color of the logo */
    --border-color: #e0e0e0; /* Light border color for inputs */
    --focus-border-color: #673ab7; /* Focus border color for inputs */
    --placeholder-color: hsl(230, 2%, 60%);
    --icon-color: #888; /* Color for ion-icons */
}

* {
    font-family: inter-ui, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";

    box-sizing: border-box; /* Include padding and border in element's total width and height */
}

body {
    -webkit-user-select: none; /* Safari support */
    user-select: none;
    overflow: hidden; /* Prevent scrolling if not needed */
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #673ab7, #512da8); /* Gradient background for the page */
    height: 100vh;
    margin: 0;
    padding: 20px; /* Add some padding for smaller screens */
}

.container-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 450px; /* Slightly wider for better desktop appeal */
    padding: 0 15px; /* Add horizontal padding for smaller screens */
}

.screen-1 {
    background: var(--card-bg);
    padding: 2.5em 2em; /* Adjusted padding */
    display: flex;
    flex-direction: column;
    align-items: center; /* Center content horizontally within the card */
    border-radius: 20px; /* Slightly less rounded corners for modern look */
    box-shadow: 0 15px 40px var(--shadow-color); /* Stronger, more modern shadow */
    width: 100%; /* Take full width of its parent (container-wrapper) */
    gap: 1.8em; /* Increased gap for better spacing */
}

.logo-container {
    margin-bottom: 1.5em; /* Space below the logo */
}

.logo {
    width: 90px; /* Adjust logo size */
    height: 90px;
}

form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5em; /* Space between form groups */
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.6em; /* Space between label and input */
    width: 100%;
}

.form-group label {
    color: var(--label-color);
    font-size: 0.95em;
    font-weight: 500;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--primary-bg); /* Lighter background for input field */
    border-radius: var(--input-border-radius);
    padding: 0.9em 1.2em; /* Padding inside the input wrapper */
    border: 1px solid var(--border-color); /* Light border */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--focus-border-color); /* Highlight border on focus */
    box-shadow: 0 0 0 3px rgba(103, 58, 183, 0.1); /* Subtle glow on focus */
}

.input-wrapper ion-icon {
    color: var(--icon-color);
    font-size: 1.3em;
    margin-right: 0.8em; /* Space between icon and input */
}

.input-wrapper input {
    flex-grow: 1; /* Input takes remaining space */
    border: none;
    outline: none;
    background: transparent; /* Match parent background */
    font-size: 1em;
    color: var(--text-color);
    padding: 0; /* Remove default input padding */
}

.input-wrapper input::placeholder {
    color: var(--placeholder-color);
    font-size: 0.9em;
}

.input-wrapper .show-hide {
    cursor: pointer;
    margin-left: 0.8em; /* Space between input and eye icon */
    color: var(--icon-color);
    font-size: 1.3em;
    transition: color 0.2s ease;
}

.input-wrapper .show-hide:hover {
    color: var(--text-color);
}

.login-button {
    padding: 1.1em 2.5em; /* Slightly more padding */
    background: var(--button-color);
    color: hsl(0, 0%, 100%);
    border: none;
    border-radius: var(--input-border-radius); /* Use same border-radius as inputs */
    font-weight: 600;
    font-size: 1.05em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    width: 100%; /* Full width button */
    margin-top: 1em; /* Space above button */
    box-shadow: 0 5px 15px rgba(103, 58, 183, 0.2); /* Button shadow */
}

.login-button:hover {
    background-color: var(--button-hover-color);
    transform: translateY(-3px); /* More pronounced lift on hover */
    box-shadow: 0 8px 20px rgba(103, 58, 183, 0.3);
}

.login-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(103, 58, 183, 0.1);
}

.footer-links {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 1.5em; /* Space above footer links */
    font-size: 0.85em;
    color: hsl(0, 0%, 45%);
}

.footer-links span, .footer-links a {
    color: var(--button-color); /* Consistent link color */
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links span:hover, .footer-links a:hover {
    color: var(--button-hover-color);
    text-decoration: underline;
}

/* --- Styling untuk Modal Lupa Kata Sandi --- */
.modal-overlay {
    display: flex; /* Changed from 'none' to 'flex' for easier handling by JS, default is hidden by JS */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6); /* Slightly darker overlay for better contrast */
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0; /* Start hidden for fade-in */
    visibility: hidden; /* Start hidden for fade-in */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 2.5em 2em;
    border-radius: 20px; /* Consistent with screen-1 */
    box-shadow: 0 15px 40px var(--shadow-color); /* Consistent with screen-1 */
    width: 100%;
    max-width: 450px; /* Consistent with screen-1 */
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transform: translateY(20px); /* Start slightly below for slide-up effect */
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
    opacity: 1;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 1.5em;
    color: var(--text-color);
    font-size: 1.6em; /* Slightly larger heading */
}

.modal-content p {
    color: var(--text-color);
    font-size: 0.95em;
    margin-bottom: 1.5em;
    line-height: 1.5; /* Better readability */
}

.modal-content .form-group {
    width: 100%;
    margin-bottom: 1.5em;
}

.close-button {
    color: var(--icon-color);
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2em; /* Larger close button */
    font-weight: normal; /* Less bold */
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-button:hover,
.close-button:focus {
    color: var(--button-color);
    text-decoration: none;
}

.modal-step {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
}

.modal-step.active {
    display: flex;
}

.modal-content .login-button {
    margin-top: 1.5em; /* Adjust margin for buttons inside modal */
}

.resend-help-links {
    text-align: center;
    margin-top: 1em;
    font-size: 0.85em;
    color: var(--text-color);
}

.resend-help-links a {
    color: var(--button-color);
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.resend-help-links a:hover {
    color: var(--button-hover-color);
    text-decoration: underline;
}

.success-message-text {
    font-size: 1.2em !important; /* Important to override general p style */
    color: var(--text-color);
    margin-bottom: 2em !important;
}

/* Responsiveness for smaller screens */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .screen-1, .modal-content {
        padding: 1.8em 1.2em; /* Reduced padding for smaller screens */
        border-radius: 15px; /* Slightly less rounded for compact feel */
    }

    .logo {
        width: 80px;
        height: 80px;
    }

    .form-group label {
        font-size: 0.9em;
    }

    .input-wrapper {
        padding: 0.7em 1em;
    }

    .input-wrapper ion-icon {
        font-size: 1.2em;
    }

    .input-wrapper input {
        font-size: 0.95em;
    }

    .login-button {
        padding: 1em 2em;
        font-size: 1em;
    }

    .footer-links {
        flex-direction: column;
        gap: 0.8em; /* Adjusted gap for stacked links */
        text-align: center;
        font-size: 0.8em;
    }

    .close-button {
        font-size: 1.8em;
        top: 10px;
        right: 15px;
    }

    .modal-content h3 {
        font-size: 1.4em;
    }

    .modal-content p {
        font-size: 0.85em;
    }

    .success-message-text {
        font-size: 1em !important;
    }
}