:root {
    --primary-color: #4a69bd;
    --secondary-color: #6a89cc;
    --background-color: #f8f9fa;
    --card-bg-color: #ffffff;
    --text-color: #343a40;
    --light-text-color: #6c757d;
    --border-color: #dee2e6;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;
}

header {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
}

main {
    padding: 2rem 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

@media (max-width: 992px) {
    .container {
        grid-template-columns: 1fr;
    }
}

.form-container, .results-container {
    background: var(--card-bg-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

h2 {
    color: var(--primary-color);
    margin-top: 0;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

fieldset {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

legend {
    padding: 0 0.5rem;
    color: var(--light-text-color);
    font-weight: bold;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

label a {
    color: inherit;
    text-decoration: none;
}

label a:hover {
    text-decoration: underline;
}

/* --- FINAL, CORRECTED PASSWORD TOGGLE STYLES --- */
.password-wrapper {
    position: relative;
    margin-bottom: 1rem; 
}

/* Make the input inside the wrapper take up the full width */
.password-wrapper input {
    width: 100%;
    margin-bottom: 0;
    /* Create a dedicated empty space on the right for the button */
    padding-right: 3.5rem; /* 56px */
    box-sizing: border-box;
}

.toggle-password {
    /* Position the button absolutely within the relative wrapper */
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    height: 45px;
    width: 2.5rem; /* Match the padding on the input */

    /* Style the button to be invisible with a centered icon */
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--light-text-color);
}

/* Remove the default blue outline when the button is clicked */
.toggle-password:focus {
    outline: none;
}
/* ----------------------------------------------- */

input[type="text"],
input[type="password"],
input[type="number"],
select {
    width: 100%;
    padding: 0.75rem;
    height: 45px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 105, 189, 0.2);
}

.info {
    font-size: 0.85rem;
    color: var(--light-text-color);
    margin-top: -0.75rem;
    margin-bottom: 1rem;
}

button {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background: var(--secondary-color);
}

#generate-btn:disabled {
    background-color: var(--light-text-color);
    cursor: not-allowed;
}

.results-container table {
    width: 100%;
    border-collapse: collapse;
}

.results-container th, .results-container td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle; 
}

.availability-cell {
    text-align: center;
}

.results-container th {
    background-color: #f1f3f5;
}

.results-container tr:last-child td {
    border-bottom: none;
}

.status-btn {
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    background-color: var(--secondary-color);
    transition: opacity 0.2s;
    white-space: nowrap; 
}

.status-btn:hover {
    opacity: 0.8;
}

.status-btn.available { background-color: var(--success-color); }
.status-btn.taken { background-color: var(--danger-color); }
.status-btn.checking { background-color: #ffc107; color: #333; }


.loader {
    border: 5px solid #f3f3f3;
    border-radius: 50%;
    border-top: 5px solid var(--primary-color);
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-bottom: 1rem;
}

footer {
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
    background-color: #e9ecef;
    color: var(--light-text-color);
    font-size: 0.9rem;
}