/* =========================================================
   JESF PROFILE PAGE
   Responsive + Mobile Friendly
========================================================= */

:root {
    --navy: #071d2f;
    --navy-2: #0a2438;
    --teal: #087f78;
    --teal-dark: #05655f;
    --teal-soft: #e8f3f2;
    --orange: #e58b32;
    --orange-dark: #cf7722;

    --text: #10243a;
    --muted: #64748b;
    --border: #dce3e9;

    --surface: #ffffff;
    --page: #f4f6f8;

    --success: #0a9b5b;
    --success-soft: #e9faf2;

    --danger: #d94b4b;
    --danger-soft: #fff0f0;

    --shadow: 0 12px 35px rgba(8, 29, 47, 0.08);

    --radius: 15px;
}


/* =========================================================
   RESET
========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    width: 100%;
    overflow-x: hidden;
}

body {
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    margin: 0;
    padding: 0;

    background: var(--page);
    color: var(--text);

    font-family: "DM Sans", sans-serif;
    font-size: 14px;
    line-height: 1.6;

    overflow-x: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
    max-width: 100%;
}

button {
    border: 0;
}

img {
    max-width: 100%;
}

a {
    color: inherit;
}


/* =========================================================
   LOADING
========================================================= */

.loading {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    background: var(--page);
    color: var(--navy);

    transition: opacity 0.25s ease;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 42px;
    height: 42px;

    border: 4px solid #d8e5e7;
    border-top-color: var(--teal);
    border-radius: 50%;

    animation: spin 0.8s linear infinite;

    margin-bottom: 12px;
}

.loading p {
    color: var(--muted);
    font-size: 13px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* =========================================================
   NAVBAR
========================================================= */

nav,
.top-nav {
    width: 100%;
    height: 68px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 32px;

    background: #ffffff;
    color: var(--text);

    border-bottom: 1px solid #e9ecef;

    position: sticky;
    top: 0;
    z-index: 1000;

    overflow: hidden;
}


/* Brand */

.nav-brand {
    min-width: 0;

    display: flex;
    align-items: center;

    gap: 10px;

    text-decoration: none;
    color: var(--text);

    flex: 1 1 auto;
}


/* Logo */

.nav-logo {
    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: transparent;
    border: none;
    box-shadow: none;

    padding: 0;
}

.nav-logo img {
    display: block;

    width: 42px;
    height: 42px;

    object-fit: contain;
}


/* Brand text */

.brand-text,
.nav-brand-text {
    min-width: 0;

    display: flex;
    flex-direction: column;
    justify-content: center;

    line-height: 1.15;
}


/* Title */

.nav-title {
    display: block;

    max-width: 100%;

    font-family: "Playfair Display", serif;
    font-size: 16px;
    font-weight: 700;

    color: #102a43;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Subtitle */

.nav-subtitle,
.nav-established {
    display: block;

    margin-top: 3px;

    font-family: "DM Sans", sans-serif;
    font-size: 8px;
    font-weight: 600;

    letter-spacing: 1.5px;

    color: var(--orange);

    white-space: nowrap;
}


/* Right side */

.nav-right {
    flex: 0 0 auto;

    display: flex;
    align-items: center;

    gap: 12px;

    margin-left: 15px;
}


/* User */

.nav-user {
    display: flex;
    align-items: center;

    gap: 8px;

    font-family: "DM Sans", sans-serif;
    font-size: 13px;
    font-weight: 600;

    color: #243b53;

    white-space: nowrap;
}


/* Avatar */

.nav-avatar {
    width: 38px;
    height: 38px;

    flex: 0 0 38px;

    border-radius: 50%;
    overflow: hidden;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #dff2f5;

    color: var(--teal);

    font-size: 12px;
    font-weight: 700;
}

.nav-avatar img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;
}


/* Logout */

.btn-logout {
    min-height: 36px;

    padding: 0 14px;

    border: none;
    border-radius: 7px;

    background: var(--navy);
    color: #ffffff;

    font-size: 12px;
    font-weight: 600;

    cursor: pointer;

    white-space: nowrap;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.btn-logout:hover {
    background: var(--teal);
    transform: translateY(-1px);
}


/* =========================================================
   MAIN LAYOUT
========================================================= */

.main {
    width: 100%;
    max-width: 1500px;

    margin: 0 auto;

    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);

    gap: 28px;

    padding: 38px 46px 60px;
}


/* =========================================================
   SIDEBAR
========================================================= */

.sidebar {
    width: 100%;
    min-width: 0;

    align-self: start;

    overflow: hidden;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius);

    box-shadow: var(--shadow);
}


/* Photo */

.profile-photo-wrap {
    padding: 26px 20px 22px;

    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-circle {
    position: relative;

    width: 116px;
    height: 116px;

    flex: 0 0 116px;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    border-radius: 50%;
    border: 3px solid var(--teal);

    background: #e4f3f6;
    color: var(--teal);

    font-family: "Playfair Display", serif;
    font-size: 24px;
    font-weight: 700;

    cursor: pointer;
}

.photo-circle::after {
    content: "";

    position: absolute;
    inset: 4px;

    border: 1px solid rgba(229, 139, 50, 0.55);
    border-radius: 50%;

    pointer-events: none;
}

.photo-circle img {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;

    display: none;

    z-index: 2;
}

#photoInitials {
    position: relative;
    z-index: 1;
}

.photo-overlay {
    position: absolute;
    inset: 0;

    z-index: 4;

    display: flex;
    align-items: flex-end;
    justify-content: center;

    padding-bottom: 12px;

    background: linear-gradient(
        to top,
        rgba(7, 29, 47, 0.58),
        transparent 48%
    );

    color: #ffffff;

    opacity: 0;

    transition: opacity 0.2s ease;

    pointer-events: none;
}

.photo-circle:hover .photo-overlay {
    opacity: 1;
}

#photoInput {
    display: none;
}

.photo-upload-btn {
    margin-top: 14px;

    min-height: 34px;

    padding: 0 13px;

    border-radius: 7px;

    background: var(--teal-soft);
    color: var(--teal);

    font-size: 12px;
    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.photo-upload-btn:hover {
    background: #d8ecea;
    transform: translateY(-1px);
}

.photo-upload-btn:disabled {
    opacity: 1;
    cursor: pointer;
}


/* Sidebar information */

.sidebar-name {
    padding: 0 18px;

    color: var(--text);

    font-family: "Playfair Display", serif;
    font-size: 19px;
    font-weight: 600;

    text-align: center;

    word-break: break-word;
    overflow-wrap: anywhere;
}

.sidebar-batch,
.sidebar-profession {
    padding: 0 18px;

    color: var(--muted);

    font-size: 12px;

    text-align: center;

    overflow-wrap: anywhere;
}

.sidebar-profession {
    margin-top: 2px;
}


/* Status */

.status-badge {
    width: max-content;
    max-width: calc(100% - 36px);

    margin: 13px auto 18px;

    padding: 5px 10px;

    display: flex;
    align-items: center;

    gap: 7px;

    border-radius: 999px;

    background: var(--success-soft);
    color: var(--success);

    font-size: 11px;
    font-weight: 700;
}

.status-dot {
    width: 7px;
    height: 7px;

    flex: 0 0 7px;

    border-radius: 50%;

    background: var(--success);
}

.sidebar-divider {
    width: 100%;
    height: 1px;

    background: var(--border);
}


/* Sidebar navigation */

.sidebar-nav {
    list-style: none;

    padding: 13px 12px;

    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 4px;

    list-style: none;
}

.sidebar-nav a,
.sidebar-nav a:visited,
.sidebar-nav a:hover,
.sidebar-nav a:active {
    text-decoration: none !important;
}

.sidebar-link {
    width: 100%;
    min-height: 40px;

    padding: 0 13px;

    display: flex;
    align-items: center;

    gap: 10px;

    border-radius: 8px;

    text-decoration: none;

    color: #6a7890;

    font-size: 13px;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.sidebar-link:hover {
    background: #f0f6f5;
    color: var(--teal);
}

.sidebar-link.active {
    background: var(--teal-soft);
    color: var(--teal);

    font-weight: 600;
}

.nav-icon {
    width: 18px;

    flex: 0 0 18px;

    text-align: center;

    font-size: 13px;
}


/* Stats */

.sidebar-stats {
    width: 100%;

    display: grid;
    grid-template-columns: 1fr 1fr;

    border-top: 1px solid var(--border);
}

.sidebar-stat {
    min-width: 0;

    padding: 15px 8px;

    text-align: center;
}

.sidebar-stat + .sidebar-stat {
    border-left: 1px solid var(--border);
}

.sidebar-stat .num {
    display: block;

    color: var(--navy);

    font-family: "Playfair Display", serif;
    font-size: 17px;
    font-weight: 700;
}

.sidebar-stat .lbl {
    display: block;

    margin-top: 1px;

    color: var(--muted);

    font-size: 10px;

    text-transform: uppercase;

    letter-spacing: 0.5px;
}


/* =========================================================
   CONTENT
========================================================= */

.content {
    width: 100%;
    min-width: 0;
}

.page-heading {
    margin-bottom: 20px;
}

.page-title {
    max-width: 100%;

    color: var(--navy);

    font-family: "Playfair Display", serif;
    font-size: 38px;
    font-weight: 600;

    line-height: 1.15;

    overflow-wrap: anywhere;
}

.page-sub {
    margin-top: 3px;

    color: #627693;

    font-size: 13px;
}


/* =========================================================
   ALERT
========================================================= */

.alert {
    display: none;

    align-items: center;

    gap: 9px;

    margin-bottom: 16px;

    padding: 11px 14px;

    border-radius: 9px;

    font-size: 13px;
}

.alert.show {
    display: flex;
}

.alert.success {
    background: var(--success-soft);
    color: var(--success);
}

.alert.error {
    background: var(--danger-soft);
    color: var(--danger);
}


/* =========================================================
   CARD
========================================================= */

.card {
    width: 100%;
    min-width: 0;

    margin-bottom: 20px;

    padding: 25px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius);

    box-shadow: 0 7px 25px rgba(8, 29, 47, 0.045);

    scroll-margin-top: 25px;
}

.card-header {
    min-height: 40px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    padding-bottom: 17px;
    margin-bottom: 20px;

    border-bottom: 1px solid var(--border);
}

.card-title {
    min-width: 0;

    display: flex;
    align-items: center;

    gap: 10px;

    color: var(--navy);

    font-size: 16px;
    font-weight: 700;
}

.card-title-icon {
    color: var(--teal);
}

.card-actions {
    display: flex;
    align-items: center;

    gap: 8px;

    flex-wrap: wrap;
}


/* Buttons */

.btn-edit,
.btn-save,
.btn-cancel {
    min-height: 36px;

    padding: 0 13px;

    border-radius: 8px;

    cursor: pointer;

    font-size: 12px;
    font-weight: 700;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.btn-edit {
    background: #f0f3f6;
    color: var(--navy);
}

.btn-edit:hover {
    background: #e6ebef;
}

.btn-save {
    display: none;

    background: var(--teal);
    color: #ffffff;
}

.btn-save:hover {
    background: var(--teal-dark);
}

.btn-cancel {
    display: none;

    background: #f2f3f5;
    color: #5f6b78;
}

.btn-cancel:hover {
    background: #e8eaed;
}


/* =========================================================
   FORM
========================================================= */

.form-grid {
    width: 100%;

    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);

    gap: 18px;
}

.form-grid.single {
    grid-template-columns: minmax(0, 1fr);
}

.bio-grid {
    margin-top: 18px;
}

.form-group {
    min-width: 0;
}

.form-group label {
    display: block;

    margin-bottom: 6px;

    color: var(--navy);

    font-size: 11px;
    font-weight: 700;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    min-width: 0;

    border: 1px solid #d9e1e8;
    border-radius: 8px;

    background: #f8fafb;

    color: #536a86;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}

.form-group input,
.form-group select {
    height: 42px;

    padding: 0 12px;
}

.form-group textarea {
    min-height: 105px;

    padding: 11px 12px;

    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: rgba(8, 127, 120, 0.7);

    box-shadow: 0 0 0 3px rgba(8, 127, 120, 0.08);

    background: #ffffff;
}

.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    opacity: 1;
    cursor: default;
}

.form-group input:not(:disabled),
.form-group select:not(:disabled),
.form-group textarea:not(:disabled) {
    background: #ffffff;
}


/* =========================================================
   ACTIVITY
========================================================= */

.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;

    gap: 13px;

    padding: 13px 0;

    border-bottom: 1px solid #edf0f3;
}

.activity-item:first-child {
    padding-top: 0;
}

.activity-item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.activity-icon {
    width: 38px;
    height: 38px;

    flex: 0 0 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 9px;

    background: var(--teal-soft);
}

.activity-content {
    min-width: 0;
}

.activity-title {
    color: var(--navy);

    font-size: 13px;
    font-weight: 700;

    overflow-wrap: anywhere;
}

.activity-desc {
    margin-top: 2px;

    color: var(--muted);

    font-size: 12px;

    overflow-wrap: anywhere;
}

.activity-time {
    margin-top: 5px;

    color: #8a98aa;

    font-size: 10px;
}


/* =========================================================
   SECURITY
========================================================= */

.security-content {
    width: 100%;
    min-width: 0;

    display: grid;

    grid-template-columns:
        minmax(0, 0.8fr)
        minmax(0, 1.2fr);

    gap: 30px;
}

.security-info {
    min-width: 0;
}

.security-info h3 {
    color: var(--navy);

    font-family: "Playfair Display", serif;

    font-size: 18px;
}

.security-info p {
    margin-top: 5px;

    color: var(--muted);

    font-size: 12px;
}

.password-form {
    min-width: 0;

    display: grid;

    gap: 13px;
}

.btn-password {
    width: max-content;
    max-width: 100%;

    min-height: 39px;

    padding: 0 15px;

    border-radius: 8px;

    background: var(--navy);
    color: #ffffff;

    cursor: pointer;

    font-size: 12px;
    font-weight: 700;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.btn-password:hover {
    background: var(--navy-2);
    transform: translateY(-1px);
}


/* =========================================================
   TOAST
========================================================= */

.toast {
    position: fixed;

    right: 24px;
    bottom: 24px;

    z-index: 10000;

    width: max-content;
    max-width: min(340px, calc(100vw - 28px));

    padding: 12px 16px;

    border-radius: 9px;

    background: var(--navy);
    color: #ffffff;

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);

    font-size: 12px;
    font-weight: 600;

    opacity: 0;
    visibility: hidden;

    transform: translateY(12px);

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease,
        transform 0.25s ease;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.info {
    background: var(--navy);
}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 1100px) {

    nav,
    .top-nav {
        padding: 0 24px;
    }

    .main {
        grid-template-columns: 235px minmax(0, 1fr);

        gap: 22px;

        padding: 30px 24px 50px;
    }

    .nav-title {
        font-size: 15px;
    }

    .security-content {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   TABLET / SMALL LAPTOP
========================================================= */

@media (max-width: 850px) {

    .main {
        grid-template-columns: 1fr;

        padding: 26px 20px 45px;
    }

    .sidebar {
        width: 100%;

        display: grid;

        grid-template-columns: 190px minmax(0, 1fr);

        align-items: center;
    }

    .profile-photo-wrap {
        grid-row: span 2;

        border-right: 1px solid var(--border);
    }

    .sidebar-name,
    .sidebar-batch,
    .sidebar-profession,
    .status-badge {
        margin-left: 15px;
        margin-right: 15px;
    }

    .sidebar-divider {
        grid-column: 1 / -1;
    }

    .sidebar-nav {
        grid-column: 1 / -1;
    }

    .sidebar-stats {
        grid-column: 1 / -1;
    }

    .page-title {
        font-size: 34px;
    }
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 700px) {

    nav,
    .top-nav {
        width: 100%;
        height: 64px;

        padding: 0 14px;
    }

    .nav-brand {
        gap: 8px;

        min-width: 0;
    }

    .nav-logo,
    .nav-logo img {
        width: 38px;
        height: 38px;
    }

    .nav-title {
        max-width: 180px;

        font-size: 13px;
    }

    .nav-subtitle,
    .nav-established {
        max-width: 180px;

        overflow: hidden;
        text-overflow: ellipsis;

        font-size: 7px;
    }

    .nav-right {
        gap: 6px;

        margin-left: 8px;
    }

    .nav-user > span,
    .nav-user span {
        display: none;
    }

    .nav-avatar {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .btn-logout {
        min-height: 34px;

        padding: 0 10px;

        font-size: 11px;
    }

    .main {
        width: 100%;

        display: block;

        padding: 18px 12px 35px;
    }

    .sidebar {
        width: 100%;

        display: block;

        margin-bottom: 20px;
    }

    .profile-photo-wrap {
        border-right: 0;
    }

    .page-heading {
        margin-bottom: 16px;
    }

    .page-title {
        font-size: 30px;
    }

    .page-sub {
        font-size: 12px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 18px;

        border-radius: 12px;
    }

    .card-header {
        align-items: flex-start;

        flex-direction: column;

        gap: 12px;
    }

    .card-actions {
        width: 100%;

        justify-content: flex-start;
    }

    .security-content {
        grid-template-columns: 1fr;

        gap: 20px;
    }
}


/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 480px) {

    nav,
    .top-nav {
        height: 62px;

        padding: 0 10px;
    }

    .nav-logo,
    .nav-logo img {
        width: 34px;
        height: 34px;
    }

    .nav-title {
        max-width: 145px;

        font-size: 12px;
    }

    .nav-subtitle,
    .nav-established {
        display: none;
    }

    .nav-right {
        gap: 5px;

        margin-left: 5px;
    }

    .nav-avatar {
        width: 32px;
        height: 32px;

        flex-basis: 32px;
    }

    .btn-logout {
        min-height: 32px;

        padding: 0 8px;

        font-size: 10px;
    }

    .main {
        padding: 14px 10px 30px;
    }

    .sidebar {
        border-radius: 12px;
    }

    .profile-photo-wrap {
        padding: 22px 15px 18px;
    }

    .photo-circle {
        width: 110px;
        height: 110px;

        flex-basis: 110px;
    }

    .sidebar-name {
        font-size: 18px;
    }

    .sidebar-nav {
        padding: 10px;
    }

    .sidebar-link {
        min-height: 42px;

        padding: 0 11px;

        font-size: 13px;
    }

    .page-title {
        font-size: 27px;
    }

    .card {
        padding: 15px;
    }

    .card-title {
        font-size: 14px;
    }

    .card-actions {
        width: 100%;
    }

    .btn-edit,
    .btn-save,
    .btn-cancel {
        min-height: 35px;

        padding: 0 11px;

        font-size: 11px;
    }

    .form-group input,
    .form-group select {
        height: 40px;
    }

    .security-content {
        gap: 18px;
    }

    .toast {
        left: 14px;
        right: 14px;
        bottom: 14px;

        width: auto;
        max-width: none;
    }
}


/* =========================================================
   VERY SMALL PHONES
========================================================= */

@media (max-width: 360px) {

    .nav-title {
        max-width: 125px;
    }

    .btn-logout {
        padding: 0 7px;
    }

    .main {
        padding-left: 8px;
        padding-right: 8px;
    }

    .card {
        padding: 13px;
    }

    .sidebar-link {
        font-size: 12px;
    }

    .page-title {
        font-size: 25px;
    }
}


/* =========================================================
   MOBILE SAFETY
   Prevent horizontal overflow from any child element
========================================================= */

@media (max-width: 700px) {

    .main,
    .content,
    .sidebar,
    .card,
    .form-grid,
    .security-content,
    .activity-item {
        max-width: 100%;
        min-width: 0;
    }

    .activity-item {
        overflow: hidden;
    }

    .activity-content {
        min-width: 0;
        overflow: hidden;
    }

    table {
        max-width: 100%;
    }
}