/* === Reset & base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --red:       #c0392b;
    --red-dark:  #96281b;
    --black:     #111;
    --white:     #fff;
    --grey-50:   #f8f8f8;
    --grey-100:  #efefef;
    --grey-300:  #ccc;
    --grey-500:  #888;
    --grey-700:  #444;
    --radius:    6px;
    --shadow:    0 2px 12px rgba(0,0,0,.12);
    --font:      'Segoe UI', system-ui, sans-serif;
}

html { font-size: 16px; }
body {
    font-family: var(--font);
    color: var(--black);
    background: var(--grey-50);
    min-height: 100vh;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Auth layout === */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 440px;
}

.auth-card--wide { max-width: 600px; }

.auth-logo { text-align: center; margin-bottom: 1.5rem; }

.site-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--red);
    letter-spacing: -0.5px;
}

.auth-heading {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--grey-700);
}

.auth-switch {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--grey-500);
    font-size: .9rem;
}

/* === Profile layout === */
.site-header {
    background: var(--black);
    color: var(--white);
    padding: .875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-header .site-title { font-size: 1.25rem; }

.user-greeting {
    font-size: .9rem;
    color: var(--grey-300);
    margin-right: 1rem;
}

.profile-main {
    max-width: 680px;
    margin: 2rem auto;
    padding: 0 1rem 4rem;
}

.page-heading {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.profile-section {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--grey-100);
    color: var(--red);
}

.profile-section h3 .hint {
    font-weight: 400;
    font-size: .8rem;
    color: var(--grey-500);
}

/* === Form elements === */
.field { margin-bottom: 1.1rem; }
.field:last-child { margin-bottom: 0; }

.field label {
    display: block;
    font-size: .875rem;
    font-weight: 500;
    margin-bottom: .35rem;
    color: var(--grey-700);
}

.input-group {
    position: relative;
    display: flex;
    align-items: stretch;
}

.input-group-addon {
    background: var(--grey-100);
    border: 1.5px solid var(--grey-300);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    padding: .6rem .75rem;
    font-size: .95rem;
    font-weight: 600;
    color: var(--grey-700);
    display: flex;
    align-items: center;
    gap: .4rem;
    white-space: nowrap;
}

.input-group input {
    flex: 1;
    border-radius: 0 var(--radius) var(--radius) 0;
    border-left: none;
    margin: 0;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="tel"],
.field input[type="number"],
.field select,
.field textarea {
    display: block;
    width: 100%;
    padding: .6rem .75rem;
    border: 1.5px solid var(--grey-300);
    border-radius: var(--radius);
    font-size: .95rem;
    font-family: var(--font);
    color: var(--black);
    background: var(--white);
    transition: border-color .15s;
}

.field textarea {
    resize: vertical;
    min-height: 70px;
    line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(192,57,43,.1);
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
    background: var(--grey-100);
    color: var(--grey-500);
    cursor: not-allowed;
}

.field input[type="file"] {
    font-size: .875rem;
    padding: .4rem 0;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.hint {
    font-size: .78rem;
    color: var(--grey-500);
    margin-top: .3rem;
}

/* === Fieldsets (role & address) === */
.role-fields,
.address-fields {
    border: 1.5px solid var(--grey-100);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.1rem;
    background: var(--white);
}

.role-fields legend,
.address-fields legend {
    font-size: .8rem;
    font-weight: 700;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 0 .4rem;
    margin-bottom: .75rem;
}

/* === Radio group === */
.radio-group {
    display: flex;
    gap: 1.5rem;
    margin-top: .4rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .95rem;
    cursor: pointer;
    color: var(--black);
}

.radio-label input[type="radio"] {
    accent-color: var(--red);
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .65rem 1.25rem;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border: 2px solid transparent;
    transition: background .15s, border-color .15s, color .15s;
    text-decoration: none;
}

.btn--primary {
    background: var(--red);
    color: var(--white);
    border-color: var(--red);
}
.btn--primary:hover {
    background: var(--red-dark);
    border-color: var(--red-dark);
    text-decoration: none;
    color: var(--white);
}

.btn--ghost {
    background: transparent;
    color: var(--grey-300);
    border-color: var(--grey-500);
}
.btn--ghost:hover {
    color: var(--white);
    border-color: var(--white);
    text-decoration: none;
}

.btn--full { width: 100%; margin-top: .5rem; }
.btn--sm { padding: .4rem .85rem; font-size: .8rem; }

/* === Flash messages === */
.flash {
    border-radius: var(--radius);
    padding: .75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: .9rem;
    line-height: 1.5;
}

.flash--success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash--error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* === Certificate link === */
.cert-current {
    font-size: .875rem;
    margin-bottom: .5rem;
    color: var(--grey-700);
}

/* === Form actions === */
.form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: .5rem;
}

/* === Responsive === */
@media (max-width: 520px) {
    .field-row { grid-template-columns: 1fr; }
    .auth-card { padding: 2rem 1.25rem; }
    .profile-main { padding: 0 .75rem 3rem; }
}
