/* BLACK HEADER - matching Home Page */
.black-header {
    width: 100%;
    height: 100px;
    background-color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.header-content {
    width: 100%;
    max-width: 1400px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 40px;
    box-sizing: border-box;
}

.center-logo {
    position: relative;
    height: 58px;
}

.center-logo img {
    height: 58px;
    width: auto;
    cursor: pointer;
    transition: transform 0.2s ease;
}

/* Block selection on header elements */
.black-header,
.header-content,
.center-logo,
.center-logo img {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Remove old header styles */
.header        { display: none; }
.header-logo   { display: none; }
.header-logo-link { display: none; }

/* ─────────────────────── BASE ─────────────────────── */
body {
    font-family: Arial, sans-serif;
    background: url("https://i.postimg.cc/0yZsTQcy/matteblack.png") no-repeat top center fixed;
    background-size: cover;
    margin: 0;
    padding: 0;
    padding-top: 100px;
    animation: fade-in 1s ease-in;
    min-height: 100vh;
}

.profile-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 100px 20px 60px;
    max-width: 100%;
    box-sizing: border-box;
}

.profile-info {
    background-color: white;
    width: 100%;
    max-width: 700px;
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(255, 255, 255, 0.20);
    margin-top: 40px;
    padding: 90px 30px 24px;
    text-align: center;
    position: relative;
    box-sizing: border-box;
}

.profile-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 5px solid white;
    object-fit: cover;
    position: absolute;
    top: 160px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 2;
    background-color: #fff;
}

.profile-name {
    font-size: 28px;
    font-weight: bold;
    margin: 10px 0;
    color: #1c1e21;
}

.profile-bio {
    color: #65676B;
    font-size: 16px;
    line-height: 1.6;
    margin: 15px 0;
    padding: 0 15px;
}

#bioInput {
    width: 100%;
    max-width: 100%;
    margin: 20px auto;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #ddd;
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.20);
    resize: none;
    font-family: Arial, sans-serif;
    font-size: 16px;
    box-sizing: border-box;
    display: none;
}

/* ─────────────────────── BUTTONS ─────────────────────── */
.button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 25px;
}

/* Bio edit buttons row */
.button-row-main {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    width: 100%;
}

/* Main 4-button row: 2×2 grid on all screen sizes */
#mainButtonRow {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
}

/* Lifetime Winnings display */
.lifetime-winnings {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 6px;
    margin: 12px 0 4px;
    flex-wrap: wrap;
}

.lifetime-label {
    font-size: 14px;
    font-weight: 600;
    color: #65676B;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lifetime-value {
    font-size: 22px;
    font-weight: 700;
    color: #1c1e21;
}

.lifetime-unit {
    font-size: 13px;
    font-weight: 600;
    color: #65676B;
}

/* All buttons default */
button {
    padding: 12px 28px;
    margin: 0;
    border: none;
    border-radius: 25px;
    background-color: black;
    color: white;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.3s ease;
    min-width: 140px;
}

@media (hover: hover) {
    button:hover {
        background-color: #333;
        transform: translateY(-2px);
    }
}

@media (hover: none) {
    button:active {
        background-color: #333;
        transform: translateY(-2px);
    }
}

/* ─────────────────────── CROP MODAL (existing) ─────────────────────── */
#cropModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

#cropModalContent {
    background: white;
    padding: 20px;
    border-radius: 20px;
    text-align: center;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(255, 255, 255, 0.20);
}

.cropper-container {
    margin: 20px auto;
    max-width: 100%;
}

.cropper-container img {
    max-width: 100%;
    height: auto;
    max-height: 60vh;
}

.cropper-buttons {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.cropper-buttons button {
    flex: 1;
    min-width: 120px;
    padding: 14px;
    font-size: 16px;
}

/* ──────────────────── EDIT MODALS (username / email) ────────────────── */
.edit-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.edit-modal.is-open {
    display: flex;
}

.edit-modal-content {
    background: white;
    border-radius: 20px;
    padding: 32px 28px 28px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    text-align: left;
    box-sizing: border-box;
}

.edit-modal-title {
    font-size: 22px;
    font-weight: 700;
    color: #1c1e21;
    margin: 0 0 6px;
}

.edit-modal-subtitle {
    font-size: 14px;
    color: #65676B;
    margin: 0 0 24px;
    line-height: 1.5;
}

/* Form fields */
.edit-modal-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 18px;
}

.edit-modal-field label {
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.edit-modal-field input {
    padding: 13px 14px;
    border-radius: 12px;
    border: 1.5px solid #ddd;
    font-size: 16px;         /* prevents iOS auto-zoom */
    font-family: Arial, sans-serif;
    color: #1c1e21;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    width: 100%;
}

.edit-modal-field input:focus {
    border-color: #000;
}

.edit-modal-field input.input-error {
    border-color: #e53935;
}

.edit-modal-field input.input-success {
    border-color: #43a047;
}

/* Hint text below inputs */
.field-hint {
    font-size: 12px;
    margin-top: 5px;
    min-height: 16px;
    display: block;
}

.field-hint.hint-error   { color: #e53935; }
.field-hint.hint-success { color: #43a047; }
.field-hint.hint-info    { color: #65676B; }

/* Modal action buttons */
.edit-modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.edit-modal-buttons button {
    flex: 1;
    padding: 13px;
    font-size: 15px;
    min-width: 0;
}

.btn-cancel {
    background-color: #f0f0f0 !important;
    color: #444 !important;
}

@media (hover: hover) {
    .btn-cancel:hover {
        background-color: #e0e0e0 !important;
        transform: translateY(-2px);
    }
}

@media (hover: none) {
    .btn-cancel:active {
        background-color: #e0e0e0 !important;
    }
}

.btn-save {
    background-color: #000 !important;
    color: #fff !important;
}

/* Disabled state */
button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
}

/* ─────────────────── BACKGROUND BLUR WHEN MODAL OPEN ─────────────────── */
body.modal-open .black-header,
body.modal-open .profile-container {
    filter: blur(5px);
    transition: filter 0.25s ease;
}

/* ─────────────────────── ANIMATIONS ─────────────────────── */
@keyframes fade-in {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

.edit-modal.is-open .edit-modal-content {
    animation: modal-in 0.2s ease forwards;
}

/* ─────────────────────── MOBILE (≤800px) ─────────────────── */
@media screen and (max-width: 800px) {
    .black-header { height: 90px; }
    .header-content { padding: 0 20px; }
    .center-logo { height: 48px; }
    .center-logo img { height: 48px; }

    body { padding-top: 90px; }

    .profile-container { padding: 85px 15px 40px; }

    .profile-info {
        width: 100%;
        max-width: none;
        margin-top: 30px;
        padding: 80px 20px 18px;
        border-radius: 18px;
    }

    .profile-photo {
        width: 120px;
        height: 120px;
        top: 138px;
        border-width: 4px;
    }

    .profile-name { font-size: 24px; margin: 10px 0; }

    .profile-bio { font-size: 15px; padding: 0 10px; }

    #bioInput {
        padding: 12px;
        font-size: 15px;
        margin: 15px 0;
    }

    .button-container {
        flex-direction: column;
        gap: 12px;
        padding: 0 10px;
    }

    .button-row-main {
        width: 100%;
        gap: 10px;
    }

    #mainButtonRow {
        gap: 10px;
        max-width: none;
    }

    button {
        width: 100%;
        min-width: 0;
        padding: 14px 10px;
        font-size: 14px;
    }

    #cropModalContent {
        padding: 15px;
        border-radius: 16px;
        max-height: 95vh;
    }

    .cropper-buttons button {
        padding: 14px;
        font-size: 16px;
    }

    .edit-modal-content {
        padding: 24px 18px 20px;
        border-radius: 16px;
    }

    .edit-modal-title { font-size: 20px; }

    .edit-modal-buttons { gap: 10px; }
    .edit-modal-buttons button { padding: 13px 10px; font-size: 14px; }
}

/* ─────────────────────── REFERRAL SECTION ─────────────────────── */
/* The section now just holds the clickable underlined trigger label */
.referral-section {
    margin-top: 28px;
    text-align: center;
}

.referral-label {
    font-size: 13px;
    font-weight: 600;
    color: #65676B;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

/* The underlined trigger text */
#referralTrigger {
    color: #65676B;
    text-decoration: underline;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: color 0.2s ease;
}

#referralTrigger:hover {
    color: #1c1e21;
}

/* Referral link box — used inside the modal */
.referral-link-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: #f5f5f5;
    border: 1.5px dashed #ccc;
    border-radius: 14px;
    padding: 14px 18px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.referral-link-box:hover {
    background: #ececec;
    border-color: #aaa;
}

#referralLinkText {
    font-size: 12px;
    color: #1c1e21;
    word-break: break-all;
    font-family: monospace;
}

.referral-copy-hint {
    font-size: 11px;
    color: #65676B;
}

/* ─────────────────────── REFERRAL MODAL ─────────────────────── */
/* Inherits .edit-modal / .edit-modal-content base styles.
   Only overrides needed for the referral-specific layout are here. */
.referral-modal-content {
    /* Centre the content inside the modal panel */
    text-align: center;
}

.referral-modal-content .edit-modal-title {
    text-align: center;
}

.referral-modal-content .edit-modal-subtitle {
    text-align: center;
}

/* Fade-in animation for the referral modal panel */
@keyframes referral-modal-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#referralModal.is-open .referral-modal-content {
    animation: referral-modal-fade-in 0.25s ease forwards;
}

/* ─────────────────────── REFERRAL TOTAL EARNED ─────────────────────── */
.referral-total {
    font-size: 13px;
    font-weight: 600;
    color: #65676B;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    margin: 16px 0 0;
}

.referral-total strong {
    color: #1c1e21;
}
