@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* =========================
   GLOBAL RESET + BODY
========================= */
:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-strong: #1d4ed8;
    --accent: #8b5cf6;
    --border: #e2e8f0;
    --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;

    --page-bg: linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
    --auth-bg: linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
    --topbar-bg: rgba(255, 255, 255, 0.88);
    --topbar-border: rgba(226, 232, 240, 0.8);
    --sidebar-bg: linear-gradient(180deg, #14213d 0%, #0f172a 100%);
    --sidebar-text: white;
    --sidebar-item-hover: rgba(255, 255, 255, 0.12);
    --sidebar-action-bg: rgba(255, 255, 255, 0.1);
}

body.dark-mode {
    --bg: #0f172a;
    --surface: #111827;
    --surface-soft: #1f2937;
    --text: #f8fafc;
    --muted: #94a3b8;
    --primary: #60a5fa;
    --primary-strong: #3b82f6;
    --accent: #a78bfa;
    --border: #334155;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);

    --page-bg: linear-gradient(135deg, #111827 0%, #0f172a 100%);
    --auth-bg: linear-gradient(135deg, #111827 0%, #0f172a 100%);
    --topbar-bg: rgba(15, 23, 42, 0.94);
    --topbar-border: rgba(100, 116, 139, 0.16);
    --sidebar-bg: linear-gradient(180deg, #020617 0%, #111827 100%);
    --sidebar-text: #e2e7f3;
    --sidebar-item-hover: rgba(255, 255, 255, 0.14);
    --sidebar-action-bg: rgba(255, 255, 255, 0.12);
    --sidebar-shadow: -28px 0 60px rgba(0, 0, 0, 0.45);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', Arial, sans-serif;
    margin: 0;
    color: var(--text);
    background: var(--page-bg);
    min-height: 100vh;
}

body.dashboard,
body.admin {
    background: var(--page-bg);
    min-height: 100vh;
}

body.auth {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 28%),
        radial-gradient(circle at bottom right, rgba(139, 92, 246, 0.18), transparent 24%),
        var(--auth-bg);
}

body.dashboard > .content > h2,
body.admin > .content > h2 {
    width: 100%;
    text-align: center;
}

.dashboard .content,
.admin .content {
    flex-direction: column;
    align-items: center;
    width: min(1400px, calc(100% - 32px));
    margin: 0 auto;
}

/*Topbar & Sidebar */
.topbar {
    position: fixed;
    display: flex;
    align-items: center;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--topbar-bg);
    backdrop-filter: blur(16px);
    color: var(--text);
    padding: 14px 24px;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
    height: 74px;
    z-index: 999;
    border-bottom: 1px solid var(--topbar-border);
}

.sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(320px, 90vw);
    height: 100%;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: right 0.3s ease-out;
    z-index: 1000;
    box-shadow: var(--sidebar-shadow, -20px 0 40px rgba(15, 23, 42, 0.22));
    padding: 24px 18px 18px;
}

.sidebar.active {
    right: 0;
}

/* Sidebar buttons */
.sidebar-button,
.sidebar-button-2 {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 18px;
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-button {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    position: absolute;
    right: 68px;
    top: 18px;
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    position: absolute;
    right: 118px;
    top: 18px;
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary);
}

.theme-toggle img {
    display: block;
    width: 22px;
    height: 22px;
    object-fit: contain;
}

body.dark-mode .theme-toggle img {
    filter: invert(1);
}

.sidebar-button, .home-button { color: var(--text); }
.sidebar-button-2 { color: white; }

.sidebar-button:hover,
.sidebar-button-2:hover,
.home-button:hover {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary);
}

.different-data {
    position: absolute;
    text-align: left;
    padding: 12px;
    top: 78px;
    right: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-out {
    position: absolute;
    text-align: center;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.95rem;
    bottom: 18px;
    right: 12px;
    left: 12px;
    cursor: pointer;
    background: var(--sidebar-action-bg);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

/* Admin + Dashboard menu items */
.different-data .manage-users,
.different-data .upload-projects,
.different-data .upload-resume,
.different-data .edit-profile,
.different-data .resume,
.different-data .experience,
.different-data .projects,
.different-data .home,
.different-data .contact {
    text-align: left;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.95rem;
    cursor: pointer;
    width: 100%;
    color: rgba(255, 255, 255, 0.9);
    transition: background 0.2s ease, transform 0.2s ease;
}

.different-data .manage-users:hover,
.different-data .upload-projects:hover,
.different-data .upload-resume:hover,
.different-data .edit-profile:hover,
.different-data .resume:hover,
.different-data .experience:hover,
.different-data .projects:hover,
.different-data .home:hover,
.different-data .contact:hover,
.log-out:hover {
    background: var(--sidebar-item-hover);
    transform: translateX(2px);
}

/* =========================
   LOGIN + SIGNUP (AUTH PAGES)
========================= */
.log-in,
.sign-up {
    background: rgba(255, 255, 255, 0.9);
    padding: 36px 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.7);
    width: min(440px, 100%);
}

body.dark-mode .log-in,
body.dark-mode .sign-up {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

/* Titles */
.log-in h1,
.sign-up h1 {
    margin: 0 0 24px;
    text-align: center;
    font-size: 1.8rem;
    color: var(--text);
}

/* Forms */
.log-in form,
.sign-up form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.log-in input,
.sign-up input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.log-in input:focus,
.sign-up input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.password-field {
    position: relative;
    width: 100%;
}

.sign-up .password-field > input {
    padding-right: 82px;
}

.auth-card.sign-up .password-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1;
}

.auth-card.sign-up .password-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

/* Split authentication experience */
.auth-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
    align-items: stretch;
    width: min(1080px, 100%);
    height: min(720px, calc(100vh - 48px));
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.68);
    border-radius: 30px;
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.14);
}

.auth-layout > * {
    min-width: 0;
}

.auth-card.log-in,
.auth-card.sign-up {
    position: relative;
    display: flex;
    align-self: stretch;
    flex-direction: column;
    justify-content: center;
    width: auto;
    padding: clamp(32px, 4vw, 52px);
    border: 0;
    border-radius: 0;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    box-shadow: none;
}

.auth-card form {
    width: min(100%, 380px);
    margin: 0 auto;
}

.auth-card.sign-up form {
    gap: 10px;
}

.auth-card.sign-up label {
    margin-bottom: 4px;
}

.auth-card .theme-toggle {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 42px;
    height: 42px;
    margin: 0;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
    z-index: 2;
}

.auth-card .theme-toggle:hover {
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.16);
}

.auth-intro {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(40px, 7vw, 86px);
    overflow: hidden;
    color: #eff6ff;
    background: linear-gradient(145deg, #1e40af 0%, #2563eb 48%, #7c3aed 100%);
}

.auth-intro::before,
.auth-intro::after {
    position: absolute;
    border-radius: 50%;
    content: '';
    pointer-events: none;
}

.auth-intro::before {
    width: 310px;
    height: 310px;
    top: -150px;
    right: -115px;
    background: rgba(255, 255, 255, 0.12);
}

.auth-intro::after {
    width: 210px;
    height: 210px;
    bottom: -110px;
    left: -85px;
    background: rgba(15, 23, 42, 0.14);
}

.auth-intro > * {
    position: relative;
    z-index: 1;
}

.auth-intro__eyebrow,
.demo-account > span {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-intro__eyebrow {
    color: rgba(255, 255, 255, 0.72);
}

.auth-intro h2 {
    max-width: 480px;
    margin: 14px 0 18px;
    color: white;
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 1.12;
    letter-spacing: -0.04em;
}

.auth-intro > p {
    max-width: 500px;
    margin: 0;
    color: rgba(239, 246, 255, 0.88);
    font-size: 0.98rem;
    line-height: 1.72;
}

.portfolio-pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    align-self: flex-start;
    margin-top: 24px;
    padding: 12px 18px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 999px;
    color: #1e40af;
    background: #fff;
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.portfolio-pdf-link span {
    font-size: 1.15rem;
    line-height: 1;
}

.portfolio-pdf-link:hover {
    transform: translateY(-2px);
    background: #eff6ff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
}

.portfolio-pdf-link:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.7);
    outline-offset: 4px;
}

.portfolio-pdf-link[aria-busy="true"] {
    cursor: wait;
    opacity: 0.8;
    pointer-events: none;
}

.pdf-download-status {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 1.4em;
    margin: 12px 0 0;
    color: rgba(239, 246, 255, 0.92);
    font-size: 0.88rem;
    line-height: 1.5;
}

.pdf-download-status[hidden] {
    display: none;
}

.pdf-download-status.is-error {
    color: #ffe0e0;
}

.pdf-download-spinner {
    width: 0.9em;
    height: 0.9em;
    flex: 0 0 auto;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: button-spin 0.7s linear infinite;
}

.demo-account {
    width: min(100%, 360px);
    margin-top: 30px;
    padding: 18px 20px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(12px);
}

.demo-account > span {
    color: rgba(255, 255, 255, 0.72);
}

.demo-account p {
    margin: 9px 0 0;
    color: white;
    line-height: 1.65;
}

.auth-login .auth-card { animation: auth-card-in-left 0.6s cubic-bezier(.22, .8, .25, 1) both; }
.auth-login .auth-intro { animation: auth-panel-in-right 0.6s cubic-bezier(.22, .8, .25, 1) both; }
.auth-signup .auth-intro { animation: auth-panel-in-left 0.6s cubic-bezier(.22, .8, .25, 1) both; }
.auth-signup .auth-card { animation: auth-card-in-right 0.6s cubic-bezier(.22, .8, .25, 1) both; }

body.auth.auth-leaving .auth-login .auth-card,
body.auth.auth-leaving .auth-signup .auth-intro { animation: auth-leave-left 0.32s ease-in both; }

body.auth.auth-leaving .auth-login .auth-intro,
body.auth.auth-leaving .auth-signup .auth-card { animation: auth-leave-right 0.32s ease-in both; }

@keyframes auth-card-in-left { from { opacity: 0; transform: translateX(-38px); } to { opacity: 1; transform: translateX(0); } }
@keyframes auth-card-in-right { from { opacity: 0; transform: translateX(38px); } to { opacity: 1; transform: translateX(0); } }
@keyframes auth-panel-in-left { from { opacity: 0; transform: translateX(-50px); } to { opacity: 1; transform: translateX(0); } }
@keyframes auth-panel-in-right { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }
@keyframes auth-leave-left { to { opacity: 0; transform: translateX(-42px); } }
@keyframes auth-leave-right { to { opacity: 0; transform: translateX(42px); } }

/* Keep entered values and placeholders readable in every theme. */
input,
textarea,
select {
    color: var(--text);
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
    opacity: 1;
}

select option {
    background: var(--surface);
    color: var(--text);
}

/* Buttons */
.log-in button,
.sign-up button {
    padding: 13px 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.log-in button:hover,
.sign-up button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(37, 99, 235, 0.25);
}

.log-in button:disabled,
.sign-up button:disabled {
    cursor: wait;
    opacity: 0.75;
}

.button-spinner {
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    margin-right: 8px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: button-spin 0.7s linear infinite;
    vertical-align: -0.1em;
}

.is-disabled {
    pointer-events: none;
    opacity: 0.55;
}

.content-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 100px;
    color: var(--muted);
}

.content-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(37, 99, 235, 0.16);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: button-spin 0.7s linear infinite;
}

/* Image Loading Spinners & Transitions */
.img-loading-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-soft, #f1f5f9);
    overflow: hidden;
}

.img-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 26px;
    height: 26px;
    border: 3px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--primary, #2563eb);
    border-radius: 50%;
    animation: button-spin 0.7s linear infinite;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.img-loading-target {
    opacity: 0;
    transition: opacity 0.35s ease;
}

.img-loading-target.img-loaded,
img.img-loaded {
    opacity: 1;
}

.img-loaded > .img-spinner,
.img-loaded + .img-spinner {
    opacity: 0;
    visibility: hidden;
}

#page-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(241, 245, 249, 0.68);
    backdrop-filter: blur(12px);
    color: var(--text);
    animation: page-loading-fade-in 0.22s ease-out;
}

body.dark-mode #page-loading-overlay {
    background: rgba(2, 6, 23, 0.72);
}

.page-loading-card {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 18px;
    width: min(340px, 100%);
    padding: 30px 28px 26px;
    overflow: hidden;
    text-align: center;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    border: 1px solid color-mix(in srgb, var(--border) 78%, white);
    border-radius: 24px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
}

.page-loading-card::before {
    content: '';
    position: absolute;
    width: 170px;
    height: 170px;
    top: -95px;
    right: -72px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.16);
    filter: blur(12px);
}

.page-loading-mark {
    position: relative;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 5px;
    width: 54px;
    height: 54px;
    padding: 12px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.28);
}

.page-loading-mark span {
    width: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    animation: page-loading-pulse 0.9s ease-in-out infinite alternate;
}

.page-loading-mark span:nth-child(1) { height: 14px; animation-delay: -0.35s; }
.page-loading-mark span:nth-child(2) { height: 25px; animation-delay: -0.18s; }
.page-loading-mark span:nth-child(3) { height: 18px; }

.page-loading-copy {
    position: relative;
    display: grid;
    gap: 5px;
}

.page-loading-eyebrow {
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.page-loading-title {
    font-size: 1rem;
    font-weight: 700;
}

.page-loading-bar {
    position: relative;
    width: 100%;
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.page-loading-bar span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    animation: page-loading-progress 1.15s ease-in-out infinite;
}

@keyframes page-loading-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes page-loading-pulse {
    from { transform: scaleY(0.58); opacity: 0.62; }
    to { transform: scaleY(1); opacity: 1; }
}

@keyframes page-loading-progress {
    from { transform: translateX(-115%); }
    to { transform: translateX(255%); }
}

@media (prefers-reduced-motion: reduce) {
    #page-loading-overlay,
    .page-loading-mark span,
    .page-loading-bar span {
        animation: none;
    }
}

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

/* Small links */
.log-in p,
.sign-up p {
    font-size: 0.9rem;
    text-align: center;
    text-decoration: underline;
    cursor: pointer;
    border-radius: 30px;
    margin: 10px auto 0;
    color: var(--primary);
}

.log-in .theme-toggle,
.sign-up .theme-toggle {
    position: static;
    right: auto;
    top: auto;
    margin-bottom: 18px;
}

.log-in p { width: 80px; }
.sign-up p { width: 155px; }

.log-in p:hover,
.sign-up p:hover { color: var(--primary-strong); }

/* Show password checkbox */
.log-in label,
.sign-up label {
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    cursor: pointer;
    margin-left: 4px;
    margin-bottom: 10px;
    user-select: none;
}

.log-in label input[type="checkbox"],
.sign-up label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
    cursor: pointer;
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.log-in label input[type="checkbox"]:checked,
.sign-up label input[type="checkbox"]:checked {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-color: transparent;
}

.log-in label input[type="checkbox"]:checked::after,
.sign-up label input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.8rem;
}

.log-in label:hover input[type="checkbox"],
.sign-up label:hover input[type="checkbox"] {
    border-color: var(--primary);
}

/* ========================= 
       ALERT MSG SYLES
========================= */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
}

.toast {
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 0.95rem;
    min-width: 220px;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.error   { background: #ffe8e8; color: #c0392b; border-left: 4px solid #c0392b; }
.toast.success { background: #eafbf0; color: #27ae60; border-left: 4px solid #27ae60; }
.toast.info    { background: #eaf3ff; color: #2c5fdb; border-left: 4px solid #2c5fdb; }

/* =============================
    CONFIRMATION MODAL STYLES
============================== */

#confirm-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    padding: 20px;
    background: rgba(15, 23, 42, 0.56);
    backdrop-filter: blur(8px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

#confirm-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

#confirm-box {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 30px 28px 26px;
    max-width: 390px;
    width: 90%;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
    text-align: center;
    transform: translateY(12px) scale(0.96);
    transition: transform 0.2s ease;
}

#confirm-box::before {
    content: '';
    position: absolute;
    z-index: -1;
    width: 180px;
    height: 180px;
    top: -112px;
    right: -70px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.2);
    filter: blur(14px);
}

#confirm-overlay.active #confirm-box {
    transform: translateY(0) scale(1);
}

.confirm-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin: 0 auto 14px;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.24);
    font-size: 1.35rem;
    font-weight: 800;
}

.confirm-title {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 700;
}

#confirm-box p {
    font-size: 0.95rem;
}

#confirm-message {
    margin: 0 0 22px;
    color: var(--muted);
    line-height: 1.55;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: stretch;
}

.confirm-actions button {
    flex: 1;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.confirm-actions button:hover {
    transform: translateY(-1px);
}

#confirm-cancel-btn {
    background: var(--surface-soft);
    border-color: var(--border);
    color: var(--text);
}

#confirm-ok-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.22);
}

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

@media (max-width: 768px) {
    .sidebar {
        width: 75%;
    }

    .log-in,
    .sign-up {
        width: 90vw;
        max-width: 400px;
    }

    .log-in label  { left: 78%; }
    .sign-up label { left: 85%; }

    body.auth {
        display: block;
        padding: 16px;
    }

    .auth-layout {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 0;
        margin: 0 auto;
        border-radius: 24px;
    }

    .auth-layout .auth-intro {
        order: 1;
    }

    .auth-layout .auth-card {
        order: 2;
    }

    .auth-card.log-in,
    .auth-card.sign-up {
        width: 100%;
        max-width: none;
        padding: 38px 26px;
    }

    .auth-card .theme-toggle {
        top: 16px;
        right: 16px;
    }

    .auth-intro {
        padding: 38px 28px;
    }

    .auth-intro h2 {
        font-size: 2rem;
    }
}

@media (max-width: 540px) {
    body.auth {
        align-items: flex-start;
        padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
    }

    .auth-layout {
        width: 100%;
        border-radius: 20px;
    }

    .auth-intro {
        min-height: 0;
        padding: 30px 24px 28px;
    }

    .auth-intro h2 {
        margin: 10px 0 12px;
        font-size: clamp(1.7rem, 8vw, 2rem);
        line-height: 1.16;
    }

    .auth-intro > p {
        font-size: 0.9rem;
        line-height: 1.58;
    }

    .demo-account {
        width: 100%;
        margin-top: 20px;
        padding: 14px 16px;
        border-radius: 14px;
    }

    .demo-account p {
        font-size: 0.9rem;
        line-height: 1.55;
    }

    .auth-card.log-in,
    .auth-card.sign-up {
        padding: 58px 22px 30px;
    }

    .auth-card form {
        max-width: none;
    }

    .log-in h1,
    .sign-up h1 {
        margin-bottom: 20px;
        font-size: 1.55rem;
    }

    .log-in input,
    .sign-up input {
        min-height: 48px;
        padding: 12px 13px;
        font-size: 16px;
    }

    .log-in label,
    .sign-up label {
        min-height: 28px;
        margin-bottom: 4px;
        font-size: 0.9rem;
    }

    .log-in button,
    .sign-up button {
        min-height: 48px;
        margin-top: 4px;
    }

    .auth-card .theme-toggle {
        top: 14px;
        right: 14px;
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
}

@media (max-width: 360px) {
    .auth-intro {
        padding: 26px 20px 24px;
    }

    .auth-card.log-in,
    .auth-card.sign-up {
        padding-right: 18px;
        padding-left: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-login .auth-card,
    .auth-login .auth-intro,
    .auth-signup .auth-card,
    .auth-signup .auth-intro,
    body.auth.auth-leaving .auth-login .auth-card,
    body.auth.auth-leaving .auth-login .auth-intro,
    body.auth.auth-leaving .auth-signup .auth-card,
    body.auth.auth-leaving .auth-signup .auth-intro {
        animation: none;
    }
}
