/* Remove yellow background on autofilled inputs */
      input:-webkit-autofill,
      input:-webkit-autofill:hover,
      input:-webkit-autofill:focus,
      input:-webkit-autofill:active {
          -webkit-background-clip: text !important;
          transition: background-color 5000s ease-in-out 0s !important;
          box-shadow: inset 0 0 20px 20px var(--color-blur) !important;
      }

      input:-webkit-autofill {
          -webkit-text-fill-color: var(--text-primary) !important;
      }

/* Backdrop */
.custom-modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 9999;
}

/* Modal Container */
.custom-modal-container {
    background-color: var(--bg-elevated);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    max-width: 400px;
    width: 100%;
    padding: var(--spacing-md);
    padding-top: 1.25rem;
    padding-bottom: var(--spacing-md);
    padding-right: var(--spacing-md);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    border: 1px solid var(--border-primary);
    border-top: 12px solid var(--border-primary);
    margin: 30vh 0 0 20px;
}

@keyframes pulseBorder {

    0%,
    100% {
        border-color: #cc3633;
    }

    50% {
        border-color: var(--border-hover);
    }
}

.alert-flash .custom-modal-container {
    animation: pulseBorder 1s ease-out 0s 3;
}

/* Header (Optional) */
.custom-modal-header {
    display: none;
}

/* Content Text */
.custom-modal-content {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    text-align: left;
    margin-left: 5px;
    font-weight: 500;
}

/* Links */
.custom-modal-content a {
    color: var(--accent-secondary);
    text-decoration: underline;
}

.custom-modal-content a:visited {
    color: var(--accent-secondary);
}

.custom-modal-content a:hover {
    color: var(--accent-secondary-hover);
}

/* Make content a flex row */
.custom-modal-content {
    display: flex;
    gap: 0.5rem;
}

/* Let the text span fill the rest, and wrap inside its box */
.custom-modal-content span {
    flex: 1 1 auto;
}

.modal-icon {
    font-size: 1.2rem;
    margin-right: 0rem;
    vertical-align: middle;
    flex: 0 0 auto;
    position: relative;
    top: 1px;
}

/* ⚠️ alert */
.modal-alert .modal-icon {
    color: #ff9800;
}

/* ❓ confirm */
.modal-confirm .modal-icon {
    color: #cc3633;
}

/* ✏️ prompt */
.modal-prompt .modal-icon {
    color: #1e90ff;
}

/* Prompt Input Field */
.custom-modal-input {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.custom-modal-input:focus {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* Button Group */
.custom-modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

/* Buttons */
.custom-modal-button {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 4px;
    font-size: var(--font-size-sm);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    cursor: pointer;
    border: none;
    font-weight: 600;
    transition: background-color var(--transition-fast);
}

/* Confirm Button */
.custom-modal-button:first-child {
    background-color: var(--accent-secondary);
    color: var(--text-inverse);
}

.custom-modal-button:first-child:hover {
    background-color: var(--accent-secondary-hover);
    color: var(--text-inverse);
}

/* Cancel Button or First Button */
.custom-modal-button:last-child {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.custom-modal-button:last-child:hover {
    background-color: var(--border-hover);
    color: var(--text-inverse);
}

/* ===========================
   Notifications
   =========================== */

.notification-wrapper {
    position: fixed;
    bottom: var(--spacing-md);
    right: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    z-index: 99999;
    pointer-events: none;
}

.notification {
    display: flex;
    align-items: center;
    background: var(--bg-elevated);
    padding: 0.75rem var(--spacing-sm);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    min-width: 280px;
    max-width: 380px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text-primary);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-primary);
    pointer-events: auto;
    transform-origin: right;
    opacity: 0;
    transform: translateX(50px);
    position: relative;
    overflow: hidden;
}

.notification-content {
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.notification i {
    margin-right: var(--spacing-md);
    font-size: var(--font-size-base);
}

.notification-message {
    font-size: var(--font-size-sm);
    flex-grow: 1;
    margin-right: var(--spacing-md);
}

.notification code {
    font-size: 0.8rem;
    color: var(--text-inverse);
    font-weight: 500;
    padding: .2em .4em;
    margin: 0;
    background-color: var(--bg-tertiary);
    border-radius: 6px;
}

.notification-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 3px;
    background: #ff3b30;
    border-radius: 0 0 0 var(--radius-md);
    transform-origin: left;
    width: 100%;
    will-change: transform;
    transform: scaleX(1);
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-primary) !important;
    opacity: 0.7;
    font-size: var(--font-size-lg);
    cursor: pointer;
    padding: var(--spacing-xs);
    display: flex;
    align-items: center;
    width: 20px;
    justify-content: center;
    transition: opacity var(--transition-fast);
    margin-left: var(--spacing-sm);
}

.notification-close:hover {
    color: var(--text-inverse) !important;
    opacity: 1;
    background: none;
}

/* Type-specific styles */
.notification-info i {
    color: var(--accent-secondary);
}

.notification-info .notification-progress {
    background: var(--accent-secondary);
}

.notification i:not(.notification-close i) {
    font-size: var(--font-size-lg);
}

.notification-success i:not(.notification-close i, .notification-message i) {
    color: #22c55e;
}

.notification-success .notification-progress {
    background: #22c55e;
}

.notification-warning i:not(.notification-close i, .notification-message i) {
    color: #ff9800;
}

.notification-warning .notification-progress {
    background: #ff9800;
}

.notification-error i:not(.notification-close i, .notification-message i) {
    color: #cc3633;
}

.notification-error .notification-progress {
    background: #cc3633;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(50px);
    }
}

@keyframes progress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .notification-wrapper {
        bottom: 0;
        right: 0;
        left: 0;
        padding: var(--spacing-sm);
    }

    .notification {
        width: 100%;
        max-width: none;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }
}

/* ===========================
   AUTH MODAL
   =========================== */

.auth-container {
    width: 100%;
    max-width: 420px;
    background: var(--bg-tertiary);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-primary);
    margin: 0 auto;
    box-shadow: var(--shadow-md);
}

/* Center icon + title; keep close button pinned right */
.auth-header {
    --auth-center-nudge: 10px;
    /* ↔️ adjust this (6–14px usually) */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /* centers icon + title as a group */
    gap: var(--spacing-sm);
    margin: 0 auto;
    width: 100%;
    text-align: center;
    margin-bottom: var(--spacing-md);
    padding-right: 40px;
    /* room for close btn */
}

/* Nudge the centered pair to the right (exclude the close icon) */
.auth-header i:not(.close-auth-btn),
.auth-header span {
    transform: translateX(var(--auth-center-nudge));
}

.auth-header>* {
    margin: 0;
}

.auth-header i {
    /* left icon next to text */
    font-size: 32px;
    color: var(--text-primary);
}

.auth-header span {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Close button pinned right, unaffected by the nudge */
.auth-header i.close-auth-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    /* only vertical translate here */
    font-size: var(--font-size-lg);
    background-color: var(--bg-tertiary);
    padding: 5px;
    border-radius: 50%;
    cursor: pointer;
    margin-left: 0;
}

.auth-header i.close-auth-btn:hover {
    background-color: var(--border-hover);
}


.auth-separator {
    text-align: center;
    margin: 1.1rem 0;
    color: var(--text-primary);
    position: relative;
}

.auth-separator::before,
.auth-separator::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--text-tertiary);
    opacity: 0.25;
}

.auth-separator::before {
    left: 0;
}

.auth-separator::after {
    right: 0;
}

.auth-note {
    text-align: left;
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
    opacity: 0.8;
    font-size: var(--font-size-sm);
}

.auth-container .input-group {
    position: relative;
    margin-bottom: var(--spacing-md);
}

.auth-container .input-group input {
    width: 100%;
    padding: 12px 40px;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    background: var(--bg-secondary);
    outline: none;
    box-sizing: border-box;
}

.auth-container .input-group input:focus {
    outline: 2px solid var(--accent-secondary);
}

/* Left icon (mail/lock) */
.auth-container .input-group i:first-of-type {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--text-secondary);
    opacity: 0.6;
    pointer-events: none;
}

/* Eye toggle icon */
.toggle-password {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-primary);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast), background-color var(--transition-fast);
}

.toggle-password:hover {
    opacity: 0.85;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
}

.auth-checkbox {
    display: flex;
    align-items: center;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.auth-checkbox input {
    margin-right: var(--spacing-md);
    cursor: pointer;
}

.auth-checkbox a {
    color: var(--accent-secondary);
    text-decoration: none;
}

.auth-checkbox a:hover {
    text-decoration: underline;
}

/* Recaptcha disclaimer (hidden) */
.auth-checkbox.recaptcha-disclaimer {
    display: none;
    align-items: center;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.recaptcha-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: calc(var(--spacing-md) - 4px);
}

.recaptcha-icon {
    color: var(--accent-secondary) !important;
    font-size: 1rem;
    margin-left: 4px;
}

.auth-button {
    width: 100%;
    padding: 10px;
    font-size: var(--font-size-base);
    background: var(--accent-primary);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background var(--transition-normal);
}

.auth-button:hover {
    background: var(--accent-primary-hover);
}

.auth-footer {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-sm);
    margin: var(--spacing-md) 0;
}

.auth-footer a {
    color: var(--accent-secondary);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-google-button {
    width: 100%;
    padding: 10px;
    font-size: var(--font-size-base);
    background: var(--accent-primary);
    color: var(--text-inverse);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: filter var(--transition-normal);
    margin-top: 0.5rem;
}

.auth-google-button:hover {
    background: var(--accent-primary-hover);
    outline: 2px solid var(--accent-secondary);
}

.google-icon {
    width: 16px;
    height: 16px;
    margin-right: 7px;
}

.auth-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.35);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
}

/* ===========================
   Notification Centre overrides (scoped)
   =========================== */

/* Widen + center the modal when used as a notification centre */
.custom-modal-container.notif-centre-container {
    max-width: 520px;
    margin: 15vh auto 0 auto;
    padding-top: 0;
    border-top-width: 12px;
    padding-left: 0;
    padding-right: 0;
}

/* Reset the inline icon+text flex row layout that .custom-modal-content had */
.custom-modal-content.notif-centre-wrapper {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-left: 0;
    text-align: left;
    font-weight: 400;
    font-size: var(--font-size-sm);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Centre the heading text */
.notif-centre-wrapper .notif-centre-title {
    width: 100%;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    padding: 0.75rem 0;
    padding-bottom: 0.25rem;
}

.notif-centre-wrapper .notif-centre-icon {
    font-size: 1.1rem;
    color: var(--text-primary);
    position: relative;
    top: 1px;
    margin: 0 var(--spacing-md);
    margin-right: var(--spacing-sm);
}

/* Scroll area */
.notif-centre-wrapper .notif-centre-list {
    max-height: 60vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border-primary);
    border-bottom: 1px solid var(--border-primary);
}

/* Empty state */
.notif-centre-wrapper .notif-centre-empty {
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* Rows ------------------------------------------------------- */
.notif-centre-wrapper .notif-row {
    display: flex;
    gap: var(--spacing-sm);
    padding: 1.25rem var(--spacing-md);
    padding-bottom: var(--spacing-md);
    background: var(--bg-elevated);
    border-left: none;
    border-right: none;
    border-top: none;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.notif-centre-wrapper .notif-row:first-of-type {
    border-top: none;
}

.notif-centre-wrapper .notif-row:last-of-type {
    border-bottom: none;
}

.notif-centre-wrapper .notif-row:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

/* Unread indicator */
.notif-centre-wrapper .notif-row.notif-unread {
    border-color: var(--accent-secondary);
    background-color: rgba(59, 130, 246, 0.20);
}

.notif-centre-wrapper .notif-row.notif-unread:hover {
    background-color: rgba(59, 130, 246, 0.30);
}

.notif-row-context {
    color: var(--text-secondary);
}

.notif-row-username {
    font-style: normal;
    color: var(--text-inverse);
    font-weight: 700;
}

.notif-centre-wrapper .notif-row .notif-project-name {
    text-decoration: none;
    font-style: normal;
    color: var(--text-primary);
    font-weight: 600;
}

.notif-centre-wrapper .notif-row .notif-project-name:hover {
    text-decoration: underline;
    color: var(--accent-secondary);
}

.notif-centre-wrapper .notif-row .notif-action {}

/* Avatar */
.notif-centre-wrapper .notif-row-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    border: 1px solid var(--border-primary);
    background: none;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    margin-right: var(--spacing-md);
}

.notif-centre-wrapper .notif-row-avatar img {
    border-radius: 50%;
}

.custom-modal-container.notif-centre-container .custom-modal-buttons {
    padding: 0 var(--spacing-md);
    margin-top: 0;
}

.notif-centre-wrapper .notif-row-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.notif-centre-wrapper .notif-row-avatar-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    font-weight: 600;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

/* Badge with notif type icon */
.notif-centre-wrapper .notif-row-type-icon {
    position: absolute;
    bottom: -10px;
    right: -10px;
    font-size: 1rem;
    background: var(--accent-secondary);
    color: var(--text-inverse);
    border-radius: 50%;
    line-height: 1;
    padding: 3px;
    pointer-events: none;
    border: 2px solid var(--bg-tertiary);
}

.notif-row-type-icon.notif-icon-comment {
    background: var(--accent-secondary);
    color: var(--text-inverse);
}

.notif-row-type-icon.notif-icon-like {
    background-color: #cc3633;
    color: #fff;
}

.notif-row-type-icon.notif-follow {
    background-color: #22c55e;
    color: #fff;
}

.notif-row-type-icon.notif-reply {
    background-color: #0ea5e9;
    color: #fff;
}

/* Body */
.notif-centre-wrapper .notif-row-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

/* Username / handle row */
.notif-centre-wrapper .notif-row-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    display: none;
}

.notif-row-username,
.notif-row-handle,
.notif-row-project,
.notif-row-avatar {
    text-decoration: underline;
    color: var(--accent-secondary);
    cursor: pointer;
    font: inherit;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
}

.notif-row-username,
.notif-row-handle {
    text-decoration: none !important;
    color: var(--text-primary) !important;
}

.notif-row-username:hover,
.notif-row-handle:hover {
    text-decoration: underline !important;
    color: var(--accent-secondary) !important;
}

.notif-row-username {
    font-weight: 600;
}

.notif-row-handle {
    opacity: 0.8;
    font-size: 0.85em;
}

.notif-row-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
    gap: 1rem;
}

.notif-centre-wrapper .notif-row-project {
    text-decoration: none;
    align-self: flex-start;
    margin-top: .25rem;
    margin-bottom: .25rem;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 4px;
    font-size: var(--font-size-sm);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    cursor: pointer;
    border: thin solid var(--border-primary);
    font-weight: 600;
    background-color: transparent;
    color: var(--text-primary) !important;
    margin-left: auto;
}

.notif-centre-wrapper .notif-row-project:hover {
    background-color: var(--accent-secondary);
    color: var(--text-inverse) !important;
    border-color: transparent !important;
}

.notif-centre-wrapper .notif-row:hover .notif-row-project {
    border: thin solid var(--border-hover);
}

/* Message text (respect your link colors) */
.notif-centre-wrapper .notif-row-msg {
    line-height: 1.5;
    padding-right: var(--spacing-xs);
}

.notif-centre-wrapper .notif-row-msg a {
    color: var(--accent-secondary);
    text-decoration: underline;
}

.notif-centre-wrapper .notif-row-msg a:visited {
    color: var(--accent-secondary);
}

/* Timestamp */
.notif-centre-wrapper .notif-row-time {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    opacity: 0.8;
    margin-top: 0.5rem;
}