:root {
    --green: #7cb342;
    --green-light: #c5e1a5;
    --green-pale: #e8f5e9;
    --blue: #4a8fe7;
    --blue-light: #bbdefb;
    --blue-pale: #e3f2fd;
    --gold: #f0c040;
    --bg: #faf9f6;
    --bg-warm: #f5f3ee;
    --text: #2d2d2d;
    --text-mid: #6b7b6b;
    --text-light: #9ca3a0;
    --white: #ffffff;
    --red: #ef4444;
    --red-pale: #fee2e2;
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nd-page {
    position: relative;
    padding: 40px 20px 80px;
    min-height: 100vh;
    margin-top: 60px;
}

.nd-bg-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.nd-shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.4;
}

.nd-shape-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--blue-pale), transparent 70%);
    top: -80px;
    right: -80px;
}

.nd-shape-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--green-pale), transparent 70%);
    bottom: 10%;
    left: -80px;
}

.nd-container {
    max-width: 80%;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* Back Link */
.nd-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    margin-bottom: 24px;
    background: var(--white);
    border: 1px solid #e8e5e0;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-mid);
    transition: var(--transition);
    text-decoration: none;
}

    .nd-back-link:hover {
        border-color: var(--green);
        color: var(--green);
        transform: translateX(-2px);
    }

/* News Card */
.nd-card {
    background: var(--white);
    border-radius: 28px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.06);
    animation: ndFadeUp 0.5s ease both;
}

@keyframes ndFadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nd-header {
    margin-bottom: 24px;
}

.nd-meta {
    margin-bottom: 12px;
}

.nd-date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

.nd-title {
    font-size: 32px;
    font-weight: 900;
    color: var(--text);
    line-height: 1.25;
    letter-spacing: -0.5px;
    margin: 0;
}

/* Vote Bar */
.nd-vote-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-warm);
    border-radius: 16px;
    margin-bottom: 32px;
}

.nd-vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    background: var(--white);
    border: 2px solid #e8e5e0;
    color: var(--text-mid);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

    .nd-vote-btn:hover {
        border-color: var(--green);
        color: var(--green);
        background: var(--green-pale);
    }

    .nd-vote-btn.loading {
        opacity: 0.7;
        cursor: wait;
    }

        .nd-vote-btn.loading::after {
            content: '';
            width: 14px;
            height: 14px;
            border: 2px solid rgba(0,0,0,0.2);
            border-top-color: var(--text);
            border-radius: 50%;
            animation: ndSpin 0.6s linear infinite;
            margin-left: 4px;
        }

@keyframes ndSpin {
    to {
        transform: rotate(360deg);
    }
}

.nd-vote-btn.like {
    color: var(--green);
    border-color: var(--green-light);
}

    .nd-vote-btn.like:hover, .nd-vote-btn.like.active {
        background: var(--green);
        color: white;
        border-color: var(--green);
    }

.nd-vote-btn.dislike {
    color: var(--red);
    border-color: #fecaca;
}

    .nd-vote-btn.dislike:hover, .nd-vote-btn.dislike.active {
        background: var(--red);
        color: white;
        border-color: var(--red);
    }

.nd-vote-count {
    font-weight: 700;
    min-width: 20px;
    text-align: center;
    transition: var(--transition);
}

    .nd-vote-count.pulse {
        transform: scale(1.2);
    }

.nd-vote-sep {
    color: var(--text-light);
    font-size: 18px;
}

/* Content */
.nd-content {
    font-size: 17px;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 40px;
}

    .nd-content p {
        margin-bottom: 16px;
    }

    .nd-content a {
        color: var(--blue);
        text-decoration: none;
        border-bottom: 1px dashed var(--blue-light);
    }

        .nd-content a:hover {
            border-bottom-style: solid;
        }

/* Gallery */
.nd-gallery {
    margin-bottom: 32px;
}

.nd-gallery-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .nd-gallery-title::before {
        content: '';
        width: 4px;
        height: 18px;
        background: var(--green);
        border-radius: 2px;
    }

.nd-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.nd-gallery-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 4/3;
    cursor: zoom-in;
    transition: var(--transition);
}

    .nd-gallery-item:hover {
        transform: scale(1.02);
        box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    }

    .nd-gallery-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: var(--transition);
    }

.nd-gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.nd-gallery-item:hover .nd-gallery-overlay {
    opacity: 1;
}

/* Admin Actions */
.nd-admin-actions {
    display: flex;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid #f0eeeb;
}

.nd-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    border: none;
}

.nd-btn-edit {
    background: var(--blue-pale);
    color: var(--blue);
}

    .nd-btn-edit:hover {
        background: var(--blue);
        color: white;
    }

.nd-btn-delete {
    background: var(--red-pale);
    color: var(--red);
}

    .nd-btn-delete:hover {
        background: var(--red);
        color: white;
    }

/* Modal */
.nd-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

    .nd-modal-overlay.active {
        display: flex;
    }

.nd-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

    .nd-modal-content img {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 12px;
        box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    }

.nd-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    background: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

    .nd-modal-close:hover {
        background: var(--red);
        color: white;
    }

/* Toast Notifications */
.codex-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-warm);
    border: 1px solid #e8e5e0;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

    .codex-toast.show {
        transform: translateX(0);
        opacity: 1;
    }

    .codex-toast.success {
        border-color: var(--green-light);
        background: var(--green-pale);
    }

    .codex-toast.error {
        border-color: #fecaca;
        background: var(--red-pale);
    }

.codex-toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.codex-toast.success .codex-toast-icon {
    background: var(--green);
}

.codex-toast.error .codex-toast-icon {
    background: var(--red);
}

.codex-toast-msg {
    flex: 1;
    line-height: 1.4;
}

.codex-toast-close {
    margin-left: 8px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 18px;
    padding: 2px 6px;
    border-radius: 6px;
    transition: var(--transition);
}

    .codex-toast-close:hover {
        background: rgba(0,0,0,0.08);
        color: var(--text);
    }

/* Responsive */
@media (max-width: 768px) {
    .nd-card {
        padding: 24px;
    }

    .nd-title {
        font-size: 26px;
    }

    .nd-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .nd-admin-actions {
        flex-direction: column;
    }

    .nd-btn {
        width: 100%;
        justify-content: center;
    }

    .codex-toast {
        right: 16px;
        left: 16px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .nd-page {
        padding: 30px 12px;
    }

    .nd-gallery-grid {
        grid-template-columns: 1fr;
    }
}
