/* ================================================================================
   STYLESHEET: creator.css
   CREATED:    2026-03-15
   MODIFIED:   2026-03-15
   PURPOSE:    Creator page styles — bio, portrait, nav pill, edit mode, works grid
   ================================================================================ */

/* ========== CREATOR PAGE ========== */
/* 2026-02-25 - Creator bio/portrait page */

#page-creator {
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}
/* 2026-03-15 - Creator right panel: matches detail page padding pattern */
#creatorRight {
    /* 2026-03-16 - Right panel: grows from 760→900px, image column takes the rest */
    flex: 1 1 760px;
    min-width: 760px;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overflow-y: auto;
    /* 2026-03-16 - 60px right/bottom padding so content doesn't crowd edges */
    padding: 0 60px 60px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 2026-03-15 - Left column: portrait image vertically centered, matches detail-left padding */
.creator-left {
    /* 2026-03-16 - Left column fills remaining space; won't shrink until right panel hits 760px min */
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
    /* 2026-03-15 - visible so image scales naturally instead of cropping on narrow windows */
    overflow: visible;
    /* 2026-03-15 - Use app-padding so left edge mirrors backbar and stays centered on resize */
    /* 2026-03-15 - Right padding 48px to avoid crowding between image and vtabs */
    padding: 24px 48px 36px var(--app-padding);
}
.creator-portrait {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
}
.creator-placeholder {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    font-weight: 300;
    color: #999;
    font-family: Georgia, 'Times New Roman', serif;
}

/* 2026-03-14 - Creator title block: fixed position matching detail page (120px top) */
/* 2026-03-15 - Align title with vtabs panel content */
#page-creator .detail-title-block {
    flex-shrink: 0;
    padding: 120px 0 16px 0;
    margin-bottom: 0;
}
/* 2026-03-15 - Title size now shared via base .detail-title in detail.css */
/* 2026-03-09 - Title + edit button inline row */
.creator-title-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.creator-title-row .detail-title {
    flex: 1;
    min-width: 0;
}
.creator-title-row .creator-edit-btn {
    flex-shrink: 0;
    margin-top: 8px;
}
/* 2026-03-11 - Nationality line directly under creator name */
.creator-nationality {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 400;
    font-style: italic;
}
/* Subtitle line under creator name */
.creator-dates {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 400;
}
/* 2026-03-09 - Medium line under dates */
.creator-medium {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-top: 6px;
    font-style: italic;
}

/* 2026-03-09 - Creator nav pill (matches gallery/home pill style) */
.creator-pill {
    display: flex;
    align-items: center;
    position: absolute;
    /* Center over the right pane (left col is 55%, right is 45%) */
    left: 77.5%;
    transform: translateX(-50%);
    width: fit-content;
    min-width: 200px;
    max-width: 340px;
    height: 44px;
    background: #ececee;
    border-radius: 22px;
    padding: 0 16px;
    cursor: pointer;
    overflow: visible;
}
.creator-pill:active { opacity: 0.7; }
.creator-pill-label {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    text-align: center;
}
.creator-pill-chevron {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    margin-left: 4px;
    opacity: 0.5;
    transition: transform 0.2s ease;
}
.creator-pill-chevron.open {
    transform: rotate(180deg);
}
/* Creator dropdown */
/* 2026-03-15 - Creator dropdown: same look as home, but positioned relative to icon button */
.creator-pill-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 432px;
    box-sizing: border-box;
    max-height: 400px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #d9d9dd;
    border-radius: 22px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 200;
    padding: 4px 0;
    flex-direction: column;
}
.creator-pill-dropdown.open { display: flex; }
.creator-pill-dropdown .creator-pill-search {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    background: #fff;
}
.creator-pill-dropdown #creatorPillList {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.creator-pill-search {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 8px 27px;
    border-bottom: 1px solid #eee;
    z-index: 1;
    /* 2026-03-15 - Relative for clear button positioning */
    display: flex;
    align-items: center;
}
.creator-pill-search input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 30px 8px 12px;
    font-size: 14px;
    font-family: var(--font-family);
    outline: none;
}
/* 2026-03-15 - Clear X button inside search input */
.creator-search-clear {
    position: absolute;
    right: 34px;
    display: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: #aaa;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    color: #fff;
    padding: 0;
    box-sizing: border-box;
}
.creator-pill-search input:focus {
    border-color: var(--accent-color, #007AFF);
    background: #fff;
}
.creator-pill-search input::placeholder {
    color: #aaa;
}
/* 2026-03-09 - Increased side padding +15px */
/* 2026-03-15 - Flex row for portrait thumbnail + name */
.creator-pill-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 31px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s ease;
}
.creator-pill-item:hover { background: #f5f5f7; }
/* 2026-03-15 - Small round portrait thumbnail in creator dropdown */
.creator-dd-portrait {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.creator-dd-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0e0e2;
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 600;
}
/* 2026-03-15 - Works count inline after creator name */
.creator-dd-count {
    margin-left: 6px;
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 400;
}
.creator-pill-item.active {
    font-weight: 600;
    color: var(--accent-color, #007AFF);
}
.creator-pill-empty {
    padding: 16px;
    font-size: 13px;
    color: var(--text-tertiary);
    text-align: center;
}
/* Hide pill in edit mode */
#page-creator.editing .creator-pill { display: none; }

/* 2026-03-09 - Creator page section spacing (scoped, doesn't affect detail page) */
#page-creator .info-section {
    padding: 20px 0 0 0;
    margin-top: 20px;
    border-top: 1px solid #efefef;
}
#page-creator .info-section:first-child {
    margin-top: 24px;
}
#page-creator .info-section-header {
    font-size: 12px;
    letter-spacing: 0.6px;
    color: #999;
    font-weight: 500;
    margin-bottom: 12px;
    padding-left: 0;
}
#page-creator .info-section-body {
    font-size: 15px;
    line-height: 1.7;
}
/* 2026-03-14 - Tab section fills remaining space; tab bar fixed, panels scroll */
/* 2026-03-15 - Creator page uses .vtabs from components.css */
#creatorTextTabs {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-top: 1px solid #e8e8e8;
    margin-top: 25px;
    padding-top: 20px;
}
#creatorTextTabs .vtabs {
    flex: 1;
    min-height: 0;
}
#creatorTextTabs .vtabs-panels {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
#creatorTextTabs .vtab-panel.active {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 12px 0 0;
}
#creatorTextTabs .vtab-panel.active > * {
    overflow: visible;
}

/* Works in collection grid */
/* 2026-03-14 - Works grid: auto-rows prevents cards from stretching to fill row */
/* 2026-03-15 - Fixed 180px columns; columns/rows adjust to fit, cards don't stretch */
.creator-works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 180px);
    grid-auto-rows: min-content;
    gap: 12px;
    margin-top: 8px;
}
.creator-work-card {
    cursor: pointer;
    border-radius: var(--card-radius);
    overflow: hidden;
    background: #fff;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.creator-work-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-hover-shadow);
}
/* 2026-03-09 - Uses shared .img-contain for rounded uncropped images */
.creator-work-card .work-card-img {
    width: calc(100% - 16px);
    aspect-ratio: 4 / 3;
    margin: 8px auto 0;
    border-radius: 6px;
}
.creator-work-card .work-card-title {
    padding: 8px 10px 2px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* 2026-03-09 - Richer work cards: date + category below title */
.creator-work-card .work-card-meta {
    padding: 0 10px 8px;
    font-size: 11px;
    color: var(--text-tertiary);
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 2026-03-09 - Shared class: uncropped image with rounded corners.
   CSS sets layout; JS (applyImgRadius) calculates where object-fit:contain
   places the visible image and applies clip-path with exact insets. */
.img-contain {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
    padding: 0 16px;
}
.img-contain img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* 2026-03-09 - Bio truncation with Show More (Apple-style) */
.creator-bio-text {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
}
.creator-bio-text.clamped {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.creator-bio-toggle {
    display: inline-block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--accent-color, #007AFF);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    border: none;
    background: none;
    padding: 0;
    font-family: inherit;
}
.creator-bio-toggle:hover {
    text-decoration: underline;
}

/* 2026-03-14 - Creator page responsive @media queries removed (desktop-only) */

/* 2026-03-09 - Creator edit mode */
.creator-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    color: #666;
}
.creator-edit-btn:hover {
    background: #f0f0f0;
    color: #333;
}

/* Edit mode: swap read-only sections for form fields */
/* 2026-03-14 - View mode must be flex column to pass layout to title + tabs */
/* Scoped to #creatorRight so it doesn't affect .creator-view-mode inside .creator-left */
#creatorRight > .creator-view-mode { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#page-creator .creator-edit-mode { display: none; }
#page-creator.editing .creator-view-mode { display: none !important; }
#page-creator.editing .creator-edit-mode { display: block; }

/* Edit mode topbar buttons */
.creator-edit-topbar {
    display: none;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}
#page-creator.editing .creator-edit-topbar { display: flex; }
#page-creator.editing #creatorEditBtn { display: none !important; }

.creator-edit-topbar .btn-cancel {
    background: none;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 6px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
}
.creator-edit-topbar .btn-cancel:hover { background: #f5f5f5; }
.creator-edit-topbar .btn-save {
    background: var(--accent-color);
    border: none;
    border-radius: 20px;
    padding: 6px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #fff;
    font-weight: 500;
}
.creator-edit-topbar .btn-save:hover { opacity: 0.9; }
.creator-edit-topbar .btn-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Form fields in edit mode */
.creator-edit-field {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    background: #fff;
}
.creator-edit-field:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(107, 129, 144, 0.15);
}
.creator-edit-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.creator-edit-group {
    margin-bottom: 16px;
}
/* 2026-03-10 - Remove Links button beside Intro/Bio labels */
.creator-remove-links-btn {
    font-size: 11px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-tertiary);
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.creator-remove-links-btn:hover {
    color: var(--text-primary);
    border-color: #bbb;
}
textarea.creator-edit-field {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

/* Portrait upload overlay in edit mode */
.creator-portrait-upload {
    display: none;
    position: relative;
    cursor: pointer;
}
#page-creator.editing .creator-portrait-upload { display: flex; }
#page-creator.editing .creator-portrait,
#page-creator.editing .creator-placeholder { display: none !important; }

.creator-portrait-upload .portrait-preview {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}
.creator-portrait-upload .portrait-upload-hint {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    pointer-events: none;
    white-space: nowrap;
}
.portrait-placeholder-upload {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #999;
    border: 2px dashed #bbb;
}

/* Delete creator button */
.creator-delete-section {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.btn-delete-creator {
    background: none;
    border: 1px solid #e53e3e;
    border-radius: 20px;
    padding: 8px 20px;
    cursor: pointer;
    font-size: 13px;
    color: #e53e3e;
    width: 100%;
}
.btn-delete-creator:hover { background: #fff5f5; }

/* ========== RESPONSIVE: single-pane below 1200px ========== */
/* 2026-03-16 - Stack portrait above bio; page scrolls until title sticks (matches detail page) */
@media (max-width: 1200px) {
    /* Let page-creator be the single scroll container */
    #page-creator .detail-main {
        flex-direction: column;
        overflow: visible;
        flex: none;
    }
    .creator-left {
        flex: none;
        /* 2026-03-16 - min-height so caption isn't clipped; grows to fit */
        min-height: 340px;
        /* 2026-03-16 - 50px top padding above portrait in narrow mode */
        padding: 50px var(--app-padding) 16px;
        overflow: visible;
    }
    /* 2026-03-16 - Right panel: fixed to viewport height so tabs scroll internally */
    #creatorRight {
        flex: none;
        width: 100%;
        max-width: 800px;
        margin: 0 auto;
        height: calc(100vh - 72px);
        padding: 0 24px;
    }
    #page-creator .detail-title-block {
        padding-left: 0;
        padding-top: 24px;
    }
}
