/* style.css – Coded Pages (Light Mode) */

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

:root {
    --cp-bg: #f9fafb;
    --cp-bg-elevated: #ffffff;
    --cp-surface: #ffffff;
    --cp-card: #ffffff;
    --cp-border-subtle: #e5e7eb;
    --cp-border-strong: #d1d5db;
    --cp-accent: #4f46e5;
    --cp-accent-soft: rgba(79, 70, 229, 0.06);
    --cp-accent-ring: rgba(129, 140, 248, 0.5);
    --cp-text: #020617;
    --cp-text-muted: #4b5563;
    --cp-text-soft: #6b7280;
    --cp-danger: #b91c1c;
    --cp-sidebar-bg: #f9fafb;
}

body.cp-body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
    background: radial-gradient(circle at top, #e5e7eb 0, #f9fafb 40%, #f9fafb 100%);
    color: var(--cp-text);
}

/* Layout: app shell */
.cp-app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
    background: radial-gradient(circle at top, #f3f4f6, #f9fafb 50%, #f9fafb);
}
.cp-page-description {
    font-size: 12px;
    color: var(--cp-text-soft);
    margin-top: 6px;
}
@media (max-width: 900px) {
    .cp-app-shell {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Sidebar */
.cp-sidebar {
    border-right: 1px solid var(--cp-border-subtle);
    background: var(--cp-sidebar-bg);
    padding: 20px 16px;
}

@media (max-width: 900px) {
    .cp-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--cp-border-subtle);
    }
}

.cp-sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 16px;
}

.cp-logo-dot {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: conic-gradient(from 180deg at 50% 50%, #4f46e5 0deg, #ec4899 120deg, #f97316 260deg, #4f46e5 360deg);
    box-shadow: 0 0 0 1px rgba(248, 250, 252, 0.9), 0 12px 30px rgba(148, 163, 184, 0.7);
}

.cp-logo-text {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0f172a;
}

.cp-sidebar-section {
    margin-top: 16px;
    padding: 10px 6px 4px;
    border-radius: 14px;
}

.cp-sidebar-section-muted {
    margin-top: 20px;
    background: #f1f5f9;
    border: 1px solid var(--cp-border-subtle);
}

.cp-sidebar-section-header {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cp-text-soft);
    margin-bottom: 6px;
}

/* Project nav */
.cp-project-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 4px;
}

.cp-project-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 9px;
    text-decoration: none;
    color: var(--cp-text-muted);
    font-size: 13px;
    border: 1px solid transparent;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 80ms ease;
}

.cp-project-nav-item:hover {
    background: #e5e7eb;
    border-color: var(--cp-border-subtle);
    color: var(--cp-text);
    transform: translateY(-0.5px);
}

.cp-project-nav-item.is-active {
    background: radial-gradient(circle at top left, rgba(79, 70, 229, 0.08), #e5e7eb);
    border-color: rgba(129, 140, 248, 0.8);
    color: #111827;
}

.cp-project-initial {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: #e5e7eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #111827;
}

.cp-project-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main */
.cp-main {
    padding: 20px 22px 24px;
}

@media (max-width: 900px) {
    .cp-main {
        padding: 16px 14px 20px;
    }
}

.cp-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

@media (max-width: 640px) {
    .cp-main-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

.cp-page-title {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #0f172a;
}

.cp-page-subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--cp-text-soft);
}

/* Cards */
.cp-card {
    background: var(--cp-card);
    border-radius: 18px;
    border: 1px solid var(--cp-border-subtle);
    box-shadow:
        0 0 0 0.5px rgba(148, 163, 184, 0.4),
        0 16px 40px rgba(15, 23, 42, 0.08);
    padding: 16px 16px 18px;
}

.cp-card-no-padding {
    padding: 14px 14px 16px;
}

.cp-card-header {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 12px;
}

.cp-card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: #0f172a;
}

.cp-card-description {
    font-size: 13px;
    color: var(--cp-text-soft);
    margin: 0;
}

.cp-card-empty {
    text-align: left;
}

.cp-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Buttons */
.cp-btn {
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    border: 1px solid transparent;
    background: #f3f4f6;
    color: var(--cp-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 500;
    transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 80ms ease;
}

.cp-btn-primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-color: rgba(129, 140, 248, 0.8);
    color: #f9fafb;
    box-shadow: 0 12px 30px rgba(79, 70, 229, 0.35);
}

.cp-btn-primary:hover {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    transform: translateY(-0.5px);
}

.cp-btn-ghost {
    background: #ffffff;
    border-color: var(--cp-border-subtle);
    color: var(--cp-text-muted);
}

.cp-btn-ghost:hover {
    background: #f3f4f6;
    border-color: var(--cp-border-strong);
    color: #111827;
}

.cp-btn-danger {
    border-color: rgba(239, 68, 68, 0.4);
    color: #b91c1c;
}

.cp-btn-danger:hover {
    border-color: rgba(239, 68, 68, 0.9);
    background: #fee2e2;
}

.cp-btn-full {
    width: 100%;
}

/* Forms */
.cp-form-vertical {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cp-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cp-label-text {
    font-size: 12px;
    color: var(--cp-text-soft);
}

.cp-input {
    border-radius: 999px;
    border: 1px solid var(--cp-border-subtle);
    background: #ffffff;
    color: var(--cp-text);
    padding: 7px 12px;
    font-size: 13px;
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.cp-input::placeholder {
    color: #9ca3af;
}

.cp-input:focus {
    border-color: rgba(129, 140, 248, 0.9);
    box-shadow: 0 0 0 1px var(--cp-accent-ring);
    background: #ffffff;
}

/* Form grid */
.cp-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 18px;
    align-items: end;
    padding-top: 2px;
    border-top: 1px dashed var(--cp-border-subtle);
    margin-top: 4px;
    padding-top: 12px;
}

@media (max-width: 720px) {
    .cp-form-grid {
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
    }
}

.cp-form-grid-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 8px 14px;
}

@media (max-width: 720px) {
    .cp-form-grid-fields {
        grid-template-columns: minmax(0, 1fr);
    }
}

.cp-form-grid-actions {
    display: flex;
    justify-content: flex-end;
}

.cp-danger-zone {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px dashed var(--cp-border-subtle);
    display: flex;
    justify-content: flex-end;
}

/* Pages list */
.cp-pages-list-wrap {
    border-radius: 12px;
    border: 1px dashed var(--cp-border-subtle);
    padding: 3px;
    background: #f8fafc;
}

.cp-page-list {
    list-style: none;
    margin: 0;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cp-page-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 9px;
    border-radius: 11px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
}

.cp-page-item-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.cp-handle {
    border: none;
    background: #f3f4f6;
    border-radius: 999px;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    cursor: grab;
    font-size: 13px;
}

.cp-handle:active {
    cursor: grabbing;
}

.cp-page-text {
    min-width: 0;
}

.cp-page-title-row {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.cp-page-name {
    font-size: 13px;
    font-weight: 500;
    color: #0f172a;
}

.cp-page-url {
    font-size: 12px;
    color: #6b7280;
    text-decoration: none;
    word-break: break-all;
}

.cp-page-url:hover {
    color: #111827;
}

.cp-inline-form {
    margin: 0;
}

.cp-icon-btn {
    border: none;
    background: #f9fafb;
    color: #6b7280;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    font-size: 11px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--cp-border-subtle);
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.cp-icon-btn:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #b91c1c;
}

.cp-page-item-ghost {
    opacity: 0.5;
    border-style: dashed;
}

/* Empty text */
.cp-empty-text {
    font-size: 13px;
    color: var(--cp-text-soft);
    margin: 4px 2px 8px;
}

/* Public page layout */
.cp-body-public {
    background: radial-gradient(circle at top, #e5e7eb 0, #f9fafb 55%, #f9fafb);
}

.cp-public-wrapper {
    max-width: 1100px;
    margin: 24px auto 28px;
    padding: 0 14px;
}
.cp-page-item-editing {
    border-color: rgba(129, 140, 248, 0.8);
    box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.25);
}

.cp-page-edit-link {
    font-size: 11px;
    color: #4f46e5;
    text-decoration: none;
    margin-top: 2px;
}

.cp-page-edit-link:hover {
    text-decoration: underline;
}

.cp-public-header {
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

@media (max-width: 640px) {
    .cp-public-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Grid */
.cp-page-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 960px) {
    .cp-page-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .cp-page-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.cp-grid-card {
    border-radius: 16px;
    border: 1px solid var(--cp-border-subtle);
    background: #ffffff;
    box-shadow:
        0 0 0 0.5px rgba(148, 163, 184, 0.4),
        0 16px 40px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.cp-grid-card-meta {
    margin: 4px 0 4px;
    font-size: 14px;          /* 🔹 As requested */
    color: #6b7280;           /* Muted grey */
}

.cp-grid-card-desc {
    margin: 4px 0 0;
    font-size: 13px;
    color: #4b5563;
}
.cp-thumb-link {
    display: block;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

/* 🔴 Thumbnail size changed here: 240 x 320 */
.cp-thumb {
    width: 240px;
    height: 320px;
    overflow: hidden;
    border-radius: 0;          /* no rounded corners */
    margin: 10px auto 8px;
    background: #f3f4f6;
    display: flex;
    align-items: flex-start;   /* align screenshot to top */
    justify-content: center;
}

.cp-thumb img {
    width: 100%;
    height: 100%;              /* force it to fill 240 x 320 */
    display: block;
    object-fit: cover;         /* crop the sides if needed */
    object-position: top;      /* keep the top in view */
}

.cp-grid-card-body {
    padding: 10px 12px 11px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cp-grid-card-title {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
}

.cp-grid-card-url {
    font-size: 12px;
    color: #6b7280;
    text-decoration: none;
    word-break: break-all;
}

.cp-grid-card-url:hover {
    color: #111827;
}