
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* Global styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Poppins", sans-serif;
    background: #e0e1e4;
    color: #333344;
    min-height: 100vh;
}

.profile-page {
    width: 100%;
    min-height: 100vh;
    padding: 45px 25px;
    background: #e0e1e4;
}

.profile-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

/* Profile header */
.profile-header {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 30px;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 17px;
    background: #ffffff;
    border: 1px solid #e5dcef;
    border-radius: 10px;
    color: #7950bd;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: 0.2s ease;
    box-shadow: 0 3px 12px rgba(179, 107, 255, 0.06);
}

.back-button:hover {
    background: #f7f0ff;
    border-color: #cdb0f2;
    transform: translateX(-2px);
}

.profile-title h1 {
    font-size: 30px;
    font-weight: 700;
    background: linear-gradient(90deg, #b36bff, #5865ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.profile-title p {
    color: #777788;
    font-size: 14px;
    margin-top: 3px;
}

/* Main profile card */
.profile-card {
    width: 100%;
    background: #ffffff;
    border: 1px solid #eee7f7;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 5px 20px rgba(100, 75, 130, 0.07);
}

/* Success and error messages */
.message {
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 20px;
    border-radius: 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: messageSlideIn 0.4s ease forwards;
}

.success-message {
    background: #edfbf3;
    border: 1px solid #b8e9cc;
    color: #23844e;
}

.error-message {
    background: #fff0f1;
    border: 1px solid #f4c5cb;
    color: #c3374b;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes messageSlideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-15px);
    }
}

/* Profile picture section */
.profile-picture-section {
    display: flex;
    align-items: center;
    gap: 30px;
    padding-bottom: 35px;
    margin-bottom: 35px;
    border-bottom: 1px solid #eee8f5;
}

.profile-picture-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

.profile-picture {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid transparent;
    background:
        linear-gradient(#ffffff, #ffffff) padding-box,
        linear-gradient(135deg, #b36bff, #5865ff) border-box;
    display: block;
}

img.profile-picture {
    cursor: zoom-in;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

img.profile-picture:hover {
    transform: scale(1.04);
    box-shadow: 0 0 24px rgba(137, 91, 255, 0.25);
}

img.profile-picture:focus-visible {
    outline: 3px solid #b36bff;
    outline-offset: 5px;
}

.default-profile {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5efff;
    color: #a16bfa;
    font-size: 55px;
}

.picture-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.change-picture-button {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 11px 18px;
    background: linear-gradient(90deg, #b36bff, #5865ff);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-family: "Poppins", sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: 0.2s ease;
}

.change-picture-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(88, 101, 255, 0.24);
}

.change-picture-button:active {
    transform: scale(0.97);
}

.picture-actions p {
    margin-top: 10px;
    color: #858091;
    font-size: 12px;
    line-height: 1.6;
}

/* Profile form */
.form-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 25px;
    background: linear-gradient(90deg, #b36bff, #5865ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.input-group {
    width: 100%;
}

.full-width {
    grid-column: span 2;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #4b4658;
    font-size: 13px;
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    width: 100%;
}

.input-wrapper > i:first-child {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9675c2;
    font-size: 14px;
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    height: 48px;
    padding: 0 45px;
    border: 1px solid #e1d8ed;
    border-radius: 10px;
    outline: none;
    background: #faf9fd;
    color: #302a3d;
    font-family: "Poppins", sans-serif;
    font-size: 14px;
    transition: 0.2s ease;
}

.input-wrapper input::placeholder {
    color: #aaa2b7;
}

.input-wrapper input:focus {
    background: #ffffff;
    border-color: #a66cf5;
    box-shadow: 0 0 0 3px rgba(179, 107, 255, 0.12);
}

.input-wrapper input[readonly] {
    background: #f1eff5;
    color: #898394;
    cursor: not-allowed;
}

.email-lock {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9690a3;
    font-size: 13px;
}

.input-note {
    display: block;
    margin-top: 6px;
    color: #858091;
    font-size: 11px;
}

/* Form action buttons */
.profile-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 35px;
    padding-top: 25px;
    border-top: 1px solid #eee8f5;
}

.cancel-button {
    height: 45px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #ded5eb;
    border-radius: 9px;
    color: #655a78;
    text-decoration: none;
    font-family: "Poppins", sans-serif;
    font-size: 13px;
    font-weight: 500;
    transition: 0.2s ease;
}

.cancel-button:hover {
    background: #f7f0ff;
    border-color: #c6a8ef;
    color: #7950bd;
}

.save-button {
    height: 45px;
    padding: 0 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 9px;
    background: linear-gradient(90deg, #b36bff, #5865ff);
    color: #ffffff;
    font-family: "Poppins", sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
}

.save-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(88, 101, 255, 0.24);
}

/* Profile picture preview overlay */
.picture-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(25, 20, 38, 0.72);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.picture-preview-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.picture-preview-box {
    position: relative;
    width: min(100%, 600px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 28px;
    background: #ffffff;
    border: 1px solid #e4d7f5;
    border-radius: 22px;
    box-shadow: 0 25px 80px rgba(30, 20, 50, 0.3);
    transform: scale(0.94);
    transition: transform 0.25s ease;
}

.picture-preview-overlay.show .picture-preview-box {
    transform: scale(1);
}

.picture-preview-box > img {
    display: block;
    width: min(100%, 500px);
    max-height: 70vh;
    object-fit: contain;
    border-radius: 14px;
    background: #f5f2fa;
    box-shadow: 0 0 25px rgba(179, 107, 255, 0.12);
}

.picture-preview-box > p {
    color: #655a78;
    font-size: 14px;
    font-weight: 500;
}

.picture-preview-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #b36bff, #5865ff);
    color: #ffffff;
    font-size: 19px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.picture-preview-close:hover {
    background: linear-gradient(135deg, #9950ef, #4653e8);
    transform: rotate(90deg);
}

/* Tablet and mobile layout */
@media (max-width: 700px) {
    .profile-page {
        padding: 25px 15px;
    }

    .profile-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 15px;
    }

    .profile-title h1 {
        font-size: 26px;
    }

    .profile-card {
        padding: 25px 20px;
    }

    .profile-picture-section {
        flex-direction: column;
        text-align: center;
    }

    .picture-actions {
        align-items: center;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: span 1;
    }

    .profile-actions {
        flex-direction: column-reverse;
    }

    .cancel-button,
    .save-button {
        width: 100%;
    }

    .picture-preview-overlay {
        padding: 14px;
    }

    .picture-preview-box {
        padding: 20px 14px;
        border-radius: 16px;
    }

    .picture-preview-box > img {
        max-height: 65vh;
    }

    .picture-preview-close {
        top: 8px;
        right: 8px;
    }
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
    .picture-preview-overlay,
    .picture-preview-box,
    img.profile-picture,
    .picture-preview-close,
    .change-picture-button,
    .save-button,
    .cancel-button,
    .back-button {
        transition: none;
    }
}
