/* Font Imports */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');

/* Apply box-sizing globally */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    /* COLORS */
    --primary: #003366; /* Navy, matching dashboard headers/buttons */
    --background: #f4f6f9; /* Light gray, matching body background */
    --card-bg: #ffffff; /* White, matching dashboard cards */
    --accent: #0d6efd; /* Bootstrap primary blue, for buttons/links */
    --error: #dc3545; /* Red, for error messages */
    --text: #333333; /* Dark gray, for readable text */
    --text-light: #666666; /* Lighter gray, for subtitles */

    /* FONTS */
    --primary-font: 'DM Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    /* RADII */
    --button-radius: 8px; /* Matching customer_form.ftl buttons */
    --card-radius: 12px; /* Matching dashboard cards */

    /* SIZES */
    --max-width: 1200px;
    --min-height: 600px;

    /* Typography */
    font-size: 17px;
    line-height: 30px;
    font-family: var(--primary-font);
}

/* Reset body margins, set positioning context, and center the container */
body {
    position: relative;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--background);
    font-family: var(--primary-font);
    overflow: hidden;
}

.container {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: stretch;
    width: 100%;
    max-width: var(--max-width);
    min-height: var(--min-height);
    padding: 0;
    margin: 0 auto;
    border-radius: var(--card-radius);
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1); /* Matching dashboard cards */
}

.left-column {
    flex: 1 1 0;
    background-image: url("/images/logo.png");
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    padding: 0;
    margin: 0;
}

.right-column {
    flex: 1;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border-radius: 0 var(--card-radius) var(--card-radius) 0;
}

/* Form Styles */
.form {
    width: 100%;
    max-width: 500px;
}

.form__title {
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--primary);
    text-align: center;
}

.form__subtitle {
    font-weight: 400;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-light);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
    color: var(--text);
}

.form-text {
    font-weight: 400;
    margin-bottom: 0.5rem;
    display: block;
    color: var(--text-light);
}

.input {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: var(--button-radius);
    font-size: 1rem;
    box-sizing: border-box;
    background-color: #e9ecef; /* Matching customer_form.ftl inputs */
}

.input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    background-color: var(--card-bg);
}

.btn {
    background-color: var(--accent);
    border: none;
    border-radius: var(--button-radius);
    color: var(--card-bg);
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.btn:hover {
    background-color: #0056b3; /* Darker blue, matching Bootstrap */
}

.btn:active {
    transform: scale(0.98);
}

.error-message {
    color: var(--error);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    display: none;
}

.link {
    color: var(--accent);
    font-size: 0.9rem;
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

/* Code Input Styling */
.code-container {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.code-input {
    width: 3rem;
    text-align: center;
    font-size: 1.5rem;
    border-radius: var(--button-radius);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        max-width: 100%;
        min-height: auto;
    }

    .left-column {
        width: 100%;
        height: 200px;
        border-radius: var(--card-radius) var(--card-radius) 0 0;
    }

    .right-column {
        width: 100%;
        border-radius: 0 0 var(--card-radius) var(--card-radius);
    }

    .form {
        max-width: 100%;
    }

    .code-container {
        justify-content: center;
    }
}

/* Loader Styles */
.loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid var(--accent);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 2s linear infinite;
    margin: 20px auto;
}

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