:root {
    --ndl-orange: #ab3402;
	--ndl-orange-dark: #8f2b01;
    --ndl-blue:   #0289ab;
    --ndl-purple: #6702ab;
    --ndl-bg:     #0f1117;
    --ndl-card:   #1b1e27;
    --ndl-text:   #e6e6e6;
}

* {
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top, #151823, var(--ndl-bg));
    color: var(--ndl-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ndl-card h1 {
    position: relative;
    padding-left: 14px;
}

.ndl-card h1::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10%;
    height: 80%;
    width: 4px;
    background: var(--ndl-orange);
    border-radius: 2px;
}

.ndl-card {
    background: var(--ndl-card);
    border-radius: 14px;
    padding: 32px;
    box-shadow: 0 30px 80px rgba(0,0,0,.5);
    border-top: 4px solid var(--ndl-blue);
}

.ndl-logo {
    display: block;
    margin: 0 auto 20px;
    max-height: 200px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    font-weight: 600;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    opacity: .85;
}

input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    border: none;
    background: #0e1016;
    color: #fff;
    margin-bottom: 16px;
}

input:focus {
    outline: 2px solid var(--ndl-blue);
}

button {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, var(--ndl-blue), var(--ndl-purple));
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    opacity: .9;
}

.error {
    background: rgba(171,52,2,.15);
    border-left: 4px solid var(--ndl-orange);
    padding: 10px 12px;
    margin-bottom: 16px;
    font-size: 14px;
}

.ndl-page {
    width: 100%;
    display: flex;
    justify-content: center;
}

.ndl-container {
    max-width: 1100px;
    padding: 0 20px;
}

.ndl-select {
    width: 100%;
    padding: 12px 40px 12px 14px;
    border-radius: 8px;
    border: none;
    background:
        linear-gradient(135deg, var(--ndl-blue), var(--ndl-purple)) right 12px center / 10px 10px no-repeat,
        #0e1016;
    color: #fff;
    appearance: none;
    cursor: pointer;
}

.ndl-select:focus {
    outline: 2px solid var(--ndl-blue);
}

.ndl-back:hover {
    background:#151823;
}

.ndl-back {
    display:inline-block;
    padding:8px 12px;
    border-radius:8px;
    background: linear-gradient(
        135deg,
        var(--ndl-orange),
        var(--ndl-purple)
    );
    color:#fff;
    text-decoration:none;
    font-weight:500;
}

.ndl-back:hover {
    background:#151823;
}

.ndl-divider {
    height: 2px;
    width: 60%;
    margin: 24px auto;
    border-radius: 2px;

    background: linear-gradient(
        to right,
        transparent 0%,
        var(--ndl-orange) 20%,
        var(--ndl-orange) 80%,
        transparent 100%
    );

    animation: ndl-divider-breathe 4.5s ease-in-out infinite;
    opacity: 0.85;
}

/* Breathing animation */
@keyframes ndl-divider-breathe {
    0% {
        clip-path: inset(0 45% 0 45%);
        opacity: 0.5;
    }
    50% {
        clip-path: inset(0 0 0 0);
        opacity: 1;
    }
    100% {
        clip-path: inset(0 45% 0 45%);
        opacity: 0.5;
    }
}

.project-name-input {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color .15s ease, background .15s ease;
}

.project-name-input:focus {
    border-color: var(--ndl-orange);
    background: rgba(255,255,255,0.06);
    outline: none;
}

.project-save-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.project-saved {
    display: none;
    font-size: 13px;
    color: var(--ndl-orange);
    transition: opacity .3s ease;
}

.project-card {
    position: relative; /* ← THIS is the key line */

    background: var(--ndl-card);
    padding: 26px 24px;
    border-radius: 16px;

    border: 1px solid rgba(255,255,255,0.08);
    border-left: 5px solid var(--ndl-purple);

    text-decoration: none;
    color: #fff;

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

    transition:
        transform .18s ease,
        box-shadow .18s ease,
        border-color .18s ease;
}

.project-card strong {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .2px;
}

.project-card small {
    opacity: .7;
    margin-top: 4px;
}

.project-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.45);
    border-left-color: var(--ndl-orange);
}

.project-card::after {
    content: '↗';
    position: absolute;
    top: 16px;
    right: 16px;
    opacity: 0.35;
    transition: opacity .15s ease;
}

.project-card:hover::after {
    opacity: 0.8;
}

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

/* =====================
   PAGE: PROJECTS
===================== */
body.page-projects {
    align-items: flex-start;
    padding-top: 80px;
}

.page-projects .projects {
    max-width: 900px;
    width: 100%;
    padding: 0 20px;
}

.page-projects .top-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-bottom: 30px;
    text-align: center;
}

.page-projects .project-badge {
    height: 100px;
}

.page-projects .projects-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.page-projects .projects-subtitle {
    font-size: 14px;
    opacity: .65;
    margin-top: 4px;
}

.page-projects .logout {
    margin-top: 6px;
    color: var(--ndl-blue);
    text-decoration: none;
    font-size: 14px;
}

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

.page-projects .project-card {
    background: var(--ndl-card);
    padding: 22px;
    border-radius: 12px;
    border-left: 4px solid var(--ndl-purple);
    text-decoration: none;
    color: #fff;
    transition: transform .15s ease;
}

.page-projects .project-card:hover {
    transform: translateY(-4px);
    border-left-color: var(--ndl-blue);
}

/* =====================
   PROJECT CARD DIVIDER
===================== */
.project-divider {
    height: 2px;
    width: 70%;
    margin: 14px auto 0;
    border-radius: 2px;

    background: linear-gradient(
        to right,
        transparent 0%,
        var(--ndl-orange) 20%,
        var(--ndl-orange) 80%,
        transparent 100%
    );

    opacity: 0.6;
    animation: project-divider-breathe 5.5s ease-in-out infinite;
}

@keyframes project-divider-breathe {
    0% {
        clip-path: inset(0 45% 0 45%);
        opacity: 0.4;
    }
    50% {
        clip-path: inset(0 0 0 0);
        opacity: 0.75;
    }
    100% {
        clip-path: inset(0 45% 0 45%);
        opacity: 0.4;
    }
}

@media (prefers-reduced-motion: reduce) {
    .project-divider {
        animation: none;
        clip-path: inset(0 0 0 0);
        opacity: 0.7;
    }
}

/* =====================
   PAGE: ADMIN
===================== */
body.page-admin {
    align-items: flex-start;
    padding-top: 60px;
}

body.page-admin-home {
    align-items: flex-start;
    padding-top: 80px;
}

.admin-container {
    max-width: 900px;
    width: 100%;
    padding: 0 20px;
}

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

.admin-card {
    background: var(--ndl-card);
    padding: 22px;
    border-radius: 12px;
    border-left: 4px solid var(--ndl-blue);
    color: #fff;
    text-decoration: none;
}

.admin-card:hover {
    border-left-color: var(--ndl-purple);
}

.ndl-card.ndl-card-spaced {
    margin-bottom: 30px;
}

.admin-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.admin-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.admin-meta {
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-meta-label {
    font-size: 14px;
    opacity: .75;
}

.admin-logout {
    font-size: 14px;
    color: var(--ndl-blue);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
}

.admin-footer {
    margin-top: 40px;
    padding-top: 20px;
    margin-bottom: 50px;
    border-top: 1px solid #2a2d3a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    opacity: .85;
}

.admin-project-create-form {
    display: grid;
    grid-template-columns: 2fr 1.5fr 3fr auto;
    gap: 14px;
    align-items: start;
}

.admin-permissions-form {
    display: grid;
    grid-template-columns: 2fr 2fr auto auto;
    gap: 14px;
    align-items: end;
}

.admin-user-create-form {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr auto;
    gap: 12px;
    align-items: start;
}

.label-spacer {
    visibility: hidden;
}

.btn-full {
    width: 100%;
}

.form-align-end {
    align-self: end;
}

.btn-compact {
    padding: 4px 10px;
    font-size: 13px;
}

.btn-danger-dark {
    background: #3a1111;
}

.btn-danger-wide {
    grid-column: 1 / -1;
    background: #4a1515;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table.admin-table-projects thead tr {
    border-bottom: 1px solid #2a2d3a;
}

.admin-table.admin-table-projects tbody tr {
    border-bottom: 1px solid #1f2230;
}

.admin-table.admin-table-users thead tr {
    border-bottom: 1px solid #333;
}

.admin-table.admin-table-users tbody tr {
    border-bottom: 1px solid #222;
}

.project-rename-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 240px;
}

.project-rename-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inline-actions {
    display: inline-flex;
    gap: 6px;
}

.status-active {
    color: #0f0;
}

.status-disabled {
    color: #aaa;
}

.status-locked {
    color: #f55;
}

.status-immune {
    color: #0f0;
}

.user-actions-grid {
    display: grid;
    grid-template-columns: auto auto;
    gap: 6px 8px;
}

.admin-audit-card {
    max-width: 1000px;
}

/* =====================
   UTILITIES
===================== */
.text-center {
    text-align: center;
}

.mt-10 {
    margin-top: 10px;
}

.link-ndl-blue {
    color: var(--ndl-blue);
}

.text-danger {
    color: #f55;
}

.text-success {
    color: #0f0;
}

/* =====================
   ADMIN NAV
===================== */
a[href="/logout.php"]:hover {
    background: rgba(2, 137, 171, 0.15);
}

.ndl-admin-nav {
    margin-bottom: 30px;
}

.ndl-nav-toggle {
    display: none;
    background: #0e1016;
    border: none;
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.ndl-nav-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ndl-admin-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: #cfd3ff;
    background: #0e1016;
    font-weight: 500;
}

.ndl-admin-nav a:hover {
    background: #151823;
}

.ndl-admin-nav a.active {
    background: linear-gradient(
        135deg,
        var(--ndl-orange),
        var(--ndl-purple)
    );
    color: #fff;
}

.ndl-admin-nav .icon {
    font-size: 16px;
}

/* =====================
   MOBILE BEHAVIOR
===================== */
@media (max-width: 768px) {
    .ndl-nav-toggle {
        display: inline-block;
        margin-bottom: 10px;
    }

    .ndl-nav-links {
        display: none;
        flex-direction: column;
        gap: 8px;
    }

    .ndl-admin-nav.open .ndl-nav-links {
        display: flex;
    }
}
