/* --- Base Variables & Core Layout --- */
:root {
    --photo-width: 120px;
    --photo-height: 120px;
}

body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, sans-serif;
    background-color: #f0f2f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 600px; /* Limits overall card size */
    padding: 20px;
    box-sizing: border-box;
}

.card-container {
    background-color: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.title {
    text-align: center;
    margin-top: 0;
    margin-bottom: 2rem;
    color: #333;
}

/* --- The Form Grid Layout --- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr; /* Stack everything in one clean column by default */
    gap: 1.5rem;
}

/* --- THE FIX: Photo Upload Section --- */
.select-photo {
    /* Spans across the entire grid area cleanly */
    grid-column: 1 / -1; 
    
    /* Flexbox layout to perfectly align items vertically down the exact middle */
    display: flex;
    flex-direction: column;
    align-items: center; 
    justify-content: center;
    width: 100%; 
}

.photo-frame {
    border: 2px solid blue;
    height: var(--photo-height);
    width: var(--photo-width);
    border-radius: 50%;
    overflow: hidden; /* Fixes image clipping to circle */
    box-sizing: border-box;
    background-color: #eaeaea; /* Light placeholder color before image loads */
}

#imagePreview {
    object-fit: cover;
    display: none; /* Remember: Toggle to 'block' via JS when image loads */
    height: 100%;
    width: 100%;
}

.upload-image {
    display: flex;
    justify-content: center;
    width: 100%;
}

.custom-browse-btn {
    display: inline-block;
    margin: 1.5rem 0 0 0; /* Clear bottom margin to avoid shifting */
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s;
}

.custom-browse-btn:hover {
    background-color: #0056b3;
}

/* --- Form Fields & Grid Inner Inputs --- */
.text-field {
    display: grid;
    /* Automatically creates a 2-column layout if space allows, otherwise drops to 1 */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 1.2rem;
    width: 100%;
}

.text-field-input {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.text-field-input label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
}

.text-field-input input {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.text-field-input input:focus {
    border-color: #007bff;
}

/* --- Save Button --- */
.btn-container {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

.save.btn {
    width: 100%;
    max-width: 200px;
    padding: 12px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.save.btn:hover {
    background-color: #218838;
}
