/* ========================================
   USER PAGES - BASE LAYOUT
   ======================================== */
html {
    overflow-y: auto;
    scrollbar-gutter: auto;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.auth-short-page {
    min-height: 100svh;
}

body.auth-short-page .navbar {
    position: sticky;
    top: 0;
    min-height: var(--navbar-height, 60px);
}

.site-container {
    flex: 1 0 auto;
    width: min(1200px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 3rem;
}

.user-page-container {
    max-width: 520px;
    padding-top: 90px;
}

.user-page-container.user-page-container-centered {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100vh - var(--navbar-height));
    padding-top: calc(var(--navbar-height) + 1rem);
    padding-bottom: 1rem;
}

.user-page-container.user-page-container-centered .panel,
.user-page-container.user-page-container-centered .user-panel {
    margin-top: 0;
    margin-bottom: 0;
}

.user-page-container.user-page-container-wide {
    max-width: 760px;
}

/* ========================================
   USER PANELS
   ======================================== */
.panel {
    background: rgba(0, 0, 0, 0.75);
    border-radius: 8px;
    padding: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.user-panel {
    padding: 1.25rem;
    border-radius: 8px;
}

/* ========================================
   TYPOGRAPHY & TEXT
   ======================================== */
a {
    color: var(--primary-red);
    text-decoration: none;
}

a:hover {
    color: var(--primary-red-hover);
}

.user-title {
    margin: 0 0 1rem;
    font-size: 1.6rem;
    line-height: 1.2;
}

.user-subtitle {
    margin: 0 0 1.5rem;
    color: #b3b3b3;
    font-size: 0.95rem;
}

.user-text-muted {
    color: #b3b3b3;
}

.user-link-row {
    margin-top: 1.5rem;
    color: #b3b3b3;
}

.user-inline-link {
    margin: 0;
    font-size: 0.9rem;
}

.form-message {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    min-height: 20px;
    transition: opacity 0.2s ease;
}

.form-message:empty {
    display: none;
}

.user-message {
    margin-top: 1rem;
}

.username-highlight {
    color: var(--primary-red);
}

/* ========================================
   FORM LAYOUT
   ======================================== */
.user-form-stack {
    display: grid;
    gap: 1rem;
}

.user-field {
    display: grid;
    gap: 0.5rem;
}

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

.user-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.5rem;
}

.user-btn-center {
    justify-content: center;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
input,
select {
    width: 100%;
    min-height: 44px;
    background: #333;
    border: none;
    outline: none;
    border-radius: 4px;
    color: #fff;
    font-size: 1rem;
    padding: 0 20px;
}

input:disabled {
    background: #1f1f1f;
    color: var(--text-secondary);
    opacity: 0.75;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

select {
    padding: 0 48px 0 20px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    background-color: #333;
    background-image:
        linear-gradient(45deg, transparent 50%, #ffffff 50%),
        linear-gradient(135deg, #ffffff 50%, transparent 50%);
    background-position:
        calc(100% - 22px) 50%,
        calc(100% - 16px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

/* ========================================
   USER BUTTONS & BUTTON-LIKE LINKS
   ======================================== */
.user-panel .btn,
.user-panel .button-link,
.user-panel form button,
.user-panel form a.btn {
    min-height: 44px;
    font-size: 1rem;
}

button,
.button-link {
    background: var(--primary-red);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

button:hover,
.button-link:hover {
    background: var(--primary-red-hover);
    color: #fff;
}

.button-link {
    display: inline-block;
    padding: 0.7rem 1rem;
    border-radius: 0.75rem;
    margin-top: 0.75rem;
}

.user-action-link.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 20px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    color: var(--text-primary);
    text-decoration: none;
}

.user-action-link.btn:hover,
.user-action-link.btn:focus,
.user-action-link.btn:focus-visible,
.user-action-link.btn:visited,
.user-action-link.btn:active {
    color: var(--text-primary);
    text-decoration: none;
}

/* ========================================
   PASSWORD FIELDS
   ======================================== */
.password-field {
    position: relative;
    display: block;
    width: 100%;
}

.password-field input {
    width: 100%;
    padding-right: 80px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    margin: 0;
    line-height: 1;
    width: auto;
    min-width: auto;
    height: auto;
    display: inline;
    box-shadow: none;
}

.password-toggle:hover {
    color: var(--text-primary);
    background: none;
    transform: translateY(-50%);
}

.password-toggle:focus {
    outline: 2px solid var(--primary-red);
    outline-offset: 2px;
    background: none;
}

.password-toggle:active {
    background: none;
}

/* ========================================
   ACCOUNT PAGE
   ======================================== */
.user-account-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.user-account-avatar {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    font-size: 1.45rem;
}

.user-account-heading {
    margin: 0;
}

.user-account-subtitle {
    margin: -0.25rem 0 0;
    color: #b3b3b3;
}

/* ========================================
   RESPONSIVE - TABLET / LAPTOP
   ======================================== */
@media screen and (min-width: 640px) {
    .site-container {
        width: min(1200px, calc(100% - 2rem));
        padding: 2rem 0 4rem;
    }

    .user-page-container {
        padding-top: 120px;
    }

    .user-page-container.user-page-container-centered {
        min-height: auto;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    .user-page-container.user-page-container-centered .panel,
    .user-page-container.user-page-container-centered .user-panel {
        margin-top: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .panel,
    .user-panel {
        padding: 2rem;
    }

    .user-title {
        font-size: 2rem;
    }

    .user-subtitle {
        font-size: 1rem;
    }

    .form-message {
        font-size: 0.95rem;
    }

    .user-field-row {
        grid-template-columns: 1fr 1fr;
    }

    .user-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .user-account-avatar {
        width: 56px;
        height: 56px;
        flex-basis: 56px;
        font-size: 1.6rem;
    }
}

body.auth-short-page .user-page-container.user-page-container-centered {
    min-height: calc(100vh - var(--navbar-height, 60px));
    min-height: calc(100svh - var(--navbar-height, 60px));
    padding-top: 1rem;
    padding-bottom: 1rem;
}

@media screen and (min-width: 640px) {
    body.auth-short-page .user-page-container.user-page-container-centered {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    body.auth-short-page .user-page-container.user-page-container-centered .panel,
    body.auth-short-page .user-page-container.user-page-container-centered .user-panel {
        margin-top: 0;
        margin-bottom: 0;
    }
}
