* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --card-bg: #ffffff;
    --text-dark: #1f2933;
    --text-muted: #6b7280;
    --accent: #4361ee;
    --danger: #e63946;
    --border: #e5e7eb;
    --sidebar-width: 260px;
    --bottom-nav-height: 80px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: var(--text-dark);
}

.user-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 36px 24px 120px calc(var(--sidebar-width) + 24px);
    min-height: 100vh;
}

.user-card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 32px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.profile-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
    justify-content: center;
}

.profile-avatar-wrap {
    position: relative;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4361ee 0%, #4895ef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 34px;
    letter-spacing: 1px;
    overflow: hidden;
    border: 4px solid #f8fafc;
    box-shadow: 0 8px 18px rgba(67, 97, 238, 0.35);
    position: relative;
}

.avatar-initials {
    position: relative;
    z-index: 1;
    text-transform: uppercase;
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
    display: none;
}

.avatar-edit-btn {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background: var(--accent);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(67, 97, 238, 0.35);
}

.avatar-edit-btn i {
    font-size: 16px;
}

.profile-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.user-card .user-name {
    font-size: 22px;
    font-weight: 700;
    text-align: left;
}

.profile-email {
    color: var(--text-muted);
    font-size: 14px;
}

.account-card {
    background: #f8fafc;
    border-radius: 14px;
    padding: 20px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.account-ribbon {
    align-self: flex-start;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(67, 97, 238, 0.4);
    background: rgba(67, 97, 238, 0.12);
    color: #2b3a67;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
}

.info-label {
    font-weight: 700;
    color: var(--text-dark);
}

.info-value {
    color: var(--text-muted);
    text-align: right;
    word-break: break-word;
}

.favourites-row {
    text-decoration: none;
    border: 1px solid rgba(239, 68, 68, 0.24);
    border-radius: 10px;
    padding: 10px 12px;
    background: linear-gradient(90deg, rgba(254, 226, 226, 0.78), rgba(255, 241, 242, 0.36));
    transition: all 0.2s ease;
}

.favourites-row:hover {
    border-color: rgba(239, 68, 68, 0.46);
    background: linear-gradient(90deg, rgba(254, 202, 202, 0.74), rgba(255, 228, 230, 0.44));
}

.favourites-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.favourites-label i {
    color: #ef4444;
    font-size: 16px;
}

.favourites-value {
    font-weight: 400;
    font-size: inherit;
    white-space: nowrap;
    letter-spacing: 0.1px;
}

.settings-row {
    display: flex;
    justify-content: flex-end;
}

.settings-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid rgba(67, 97, 238, 0.4);
    background: rgba(67, 97, 238, 0.08);
    color: #2b3a67;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-btn:hover {
    border-color: var(--accent);
    background: rgba(67, 97, 238, 0.16);
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid rgba(230, 57, 70, 0.45);
    color: var(--danger);
    font-weight: 700;
    background: rgba(230, 57, 70, 0.06);
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    border-color: var(--danger);
    background: rgba(230, 57, 70, 0.12);
}

.logout-icon {
    width: 18px;
    height: 18px;
}

.edit-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 2000;
}

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

.pic-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 2050;
}

.pic-modal.open {
    display: flex;
}

.pic-modal-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
    padding: 20px;
}

.pic-modal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.profile-pic-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 10px;
    border: 1px solid rgba(67, 97, 238, 0.4);
    background: rgba(67, 97, 238, 0.08);
    color: #2b3a67;
    padding: 9px 12px;
    font-weight: 600;
    cursor: pointer;
}

.profile-pic-btn.danger {
    border-color: rgba(230, 57, 70, 0.45);
    background: rgba(230, 57, 70, 0.08);
    color: var(--danger);
}

.edit-modal-card {
    width: 100%;
    max-width: 560px;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.2);
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 24px;
}

.edit-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.edit-modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}

.edit-modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.edit-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.locked-field-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.locked-field-label i {
    color: var(--text-muted);
    font-size: 14px;
}

.form-field input {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 14px;
}

.form-field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.form-field input[readonly] {
    background: #f3f4f6;
    color: #4b5563;
    cursor: not-allowed;
}

.form-field input[readonly]:focus {
    border-color: var(--border);
    box-shadow: none;
}

.edit-status {
    color: var(--danger);
    font-weight: 600;
    min-height: 18px;
}

.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.edit-cancel {
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #ffffff;
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 600;
}

.edit-save {
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: #ffffff;
    padding: 10px 18px;
    cursor: pointer;
    font-weight: 700;
}

@media (max-width: 980px) {
    .user-page {
        padding-left: 24px;
    }
}

@media (max-width: 768px) {
    .user-page {
        padding: 56px 16px calc(var(--bottom-nav-height) + 40px) 16px;
    }

    .user-card {
        padding: 24px;
    }

    .profile-header {
        flex-direction: column;
        gap: 14px;
    }

    .user-card .user-name,
    .profile-email {
        text-align: center;
    }

    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .info-value {
        text-align: left;
    }
}

html[data-theme='dark'] body {
    background: linear-gradient(135deg, #020617 0%, #111827 100%);
    color: #e2e8f0;
}

html[data-theme='dark'] .user-card,
html[data-theme='dark'] .account-card,
html[data-theme='dark'] .pic-modal-card,
html[data-theme='dark'] .edit-modal-card,
html[data-theme='dark'] .form-field input,
html[data-theme='dark'] .edit-cancel,
html[data-theme='dark'] .settings-btn,
html[data-theme='dark'] .logout-btn,
html[data-theme='dark'] .profile-pic-btn {
    background: #111827;
    border-color: #334155;
    color: #e2e8f0;
}

html[data-theme='dark'] .user-card,
html[data-theme='dark'] .account-card,
html[data-theme='dark'] .pic-modal-card,
html[data-theme='dark'] .edit-modal-card {
    box-shadow: 0 18px 36px rgba(2, 6, 23, 0.45);
}

html[data-theme='dark'] .user-card .user-name,
html[data-theme='dark'] .info-label,
html[data-theme='dark'] .account-ribbon,
html[data-theme='dark'] .edit-modal-header h3,
html[data-theme='dark'] .form-field label {
    color: #f8fafc;
}

html[data-theme='dark'] .profile-email,
html[data-theme='dark'] .info-value,
html[data-theme='dark'] .locked-field-label i,
html[data-theme='dark'] .edit-modal-close,
html[data-theme='dark'] .favourites-value {
    color: #94a3b8;
}

html[data-theme='dark'] .account-card,
html[data-theme='dark'] .favourites-row,
html[data-theme='dark'] .profile-pic-btn.danger {
    background: #0f172a;
}

html[data-theme='dark'] .favourites-row {
    border-color: rgba(248, 113, 113, 0.35);
}

html[data-theme='dark'] .favourites-row:hover {
    background: rgba(127, 29, 29, 0.28);
    border-color: rgba(248, 113, 113, 0.48);
}

html[data-theme='dark'] .settings-btn {
    background: rgba(37, 99, 235, 0.18);
    color: #bfdbfe;
}

html[data-theme='dark'] .settings-btn:hover {
    background: rgba(37, 99, 235, 0.3);
    border-color: #60a5fa;
}

html[data-theme='dark'] .logout-btn {
    background: rgba(127, 29, 29, 0.24);
    border-color: rgba(248, 113, 113, 0.5);
    color: #fca5a5;
}

html[data-theme='dark'] .logout-btn:hover {
    background: rgba(127, 29, 29, 0.36);
}

html[data-theme='dark'] .form-field input {
    background: #0f172a;
}

html[data-theme='dark'] .form-field input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

html[data-theme='dark'] .form-field input[readonly] {
    background: #1f2937;
    color: #9ca3af;
}

html[data-theme='dark'] .edit-modal,
html[data-theme='dark'] .pic-modal {
    background: rgba(2, 6, 23, 0.75);
}

