/* BricksNexus Profile – Marketplace Profile Layout
   Uses marketplace.css variables: --sidebar-bg, --accent, --text-primary, --text-secondary, --card-bg, --border */

.profile-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--main-bg, #f1f5f9);
}

/* ========== Cover + avatar overlay ========== */
.profile-cover-section {
    position: relative;
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    flex-shrink: 0;
}

.profile-cover-wrap {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.profile-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-cover-img:not([src]),
.profile-cover-img[src=""] {
    display: none;
}

.profile-cover-placeholder {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
}

.profile-cover-wrap:has(.profile-cover-img[src]:not([src=""])) .profile-cover-placeholder {
    display: none;
}

.profile-avatar-overlay {
    position: absolute;
    bottom: 0;
    left: 2rem;
    transform: translateY(50%);
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.profile-avatar-wrap {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--card-bg, #fff);
    overflow: hidden;
    background: var(--sidebar-bg, #1e293b);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-avatar-img:not([src]),
.profile-avatar-img[src=""] {
    display: none;
}

.profile-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent, #3b82f6) 0%, #1d4ed8 100%);
    color: #fff;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.profile-avatar-wrap:has(.profile-avatar-img[src]:not([src=""])) .profile-avatar-placeholder {
    display: none;
}

.profile-edit-photos-dropdown {
    position: relative;
    margin-bottom: 0.5rem;
}

.profile-edit-photos-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(15, 23, 42, 0.7);
    color: #e5e7eb;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.profile-edit-photos-btn:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
}

.profile-edit-photos-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.25rem;
    min-width: 160px;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    padding: 0.25rem 0;
    z-index: 30;
    display: none;
}

.profile-edit-photos-menu.open {
    display: block;
}

.profile-edit-photos-menu button {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    border: none;
    background: none;
    color: #e5e7eb;
    font-family: inherit;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.profile-edit-photos-menu button:hover {
    background: rgba(51, 65, 85, 0.8);
}

.profile-file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

/* ========== Layout: sidebar + content ========== */
.profile-layout {
    display: flex;
    gap: 1.5rem;
    padding: 4rem 1.5rem 2rem;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.profile-sidebar {
    width: 280px;
    min-width: 280px;
    flex-shrink: 0;
}

.profile-sidebar-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 1.5rem;
}

.profile-sidebar-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    margin: 0 0 0.35rem 0;
    word-break: break-word;
}

.profile-sidebar-title {
    font-size: 0.9375rem;
    color: var(--accent, #3b82f6);
    font-weight: 500;
    margin: 0 0 0.75rem 0;
}

.profile-sidebar-bio {
    font-size: 0.875rem;
    color: var(--text-secondary, #64748b);
    line-height: 1.5;
    margin: 0 0 0.75rem 0;
    word-break: break-word;
}

.profile-sidebar-location {
    font-size: 0.8125rem;
    color: var(--text-secondary, #64748b);
    margin: 0 0 0.25rem 0;
}

.profile-sidebar-member-since {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    margin: 0 0 1rem 0;
}

.profile-edit-profile-btn {
    width: 100%;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--accent, #3b82f6);
    background: transparent;
    color: var(--accent, #3b82f6);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.profile-edit-profile-btn:hover {
    background: var(--accent, #3b82f6);
    color: #fff;
}

/* ========== Content: view toggle + tabs ========== */
.profile-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.profile-view-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.profile-view-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
}

.profile-view-toggle {
    display: flex;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    overflow: hidden;
    background: var(--card-bg, #fff);
}

.profile-view-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary, #64748b);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.profile-view-btn:hover {
    color: var(--text-primary, #0f172a);
    background: var(--main-bg, #f1f5f9);
}

.profile-view-btn.active {
    background: var(--accent, #3b82f6);
    color: #fff;
}

.profile-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
}

.profile-tab {
    padding: 0.65rem 1rem;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    color: var(--text-secondary, #64748b);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.profile-tab:hover {
    color: var(--text-primary, #0f172a);
}

.profile-tab.active {
    color: var(--accent, #3b82f6);
    border-bottom-color: var(--accent, #3b82f6);
}

.profile-tab-panel {
    display: none;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}

.profile-tab-panel.active {
    display: flex;
}

.profile-feed-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Reuse feed-card from marketplace in tab panels */
.profile-feed-list .feed-card {
    margin: 0;
}

/* ========== Empty state ========== */
.profile-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    background: var(--card-bg, #fff);
    border: 1px dashed var(--border, #e2e8f0);
    border-radius: 12px;
    text-align: center;
}

.profile-empty-illus {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-radius: 50%;
    flex-shrink: 0;
}

.profile-empty-text {
    font-size: 0.9375rem;
    color: var(--text-secondary, #64748b);
    margin: 0 0 1rem 0;
}

.profile-empty-btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    background: var(--accent, #3b82f6);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

.profile-empty-btn:hover {
    background: #2563eb;
}

.profile-publish-card {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--card-bg, #fff);
}

.profile-publish-card h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.profile-publish-card p {
    color: var(--text-secondary, #64748b);
    font-size: 0.875rem;
}

.profile-publish-toggle {
    position: relative;
    display: inline-flex;
    width: 54px;
    height: 32px;
    flex-shrink: 0;
}

.profile-publish-toggle input {
    position: absolute;
    inset: 0;
    opacity: 0;
}

.profile-publish-slider {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    background: #cbd5e1;
    position: relative;
    transition: background 0.2s;
}

.profile-publish-slider::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.28);
    transition: transform 0.2s;
}

.profile-publish-toggle input:checked + .profile-publish-slider {
    background: var(--accent, #3b82f6);
}

.profile-publish-toggle input:checked + .profile-publish-slider::after {
    transform: translateX(22px);
}

/* ========== Modal ========== */
.profile-modal {
    border: none;
    border-radius: 12px;
    padding: 0;
    max-width: 90vw;
    width: 440px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    background: var(--card-bg, #fff);
}

.profile-modal::backdrop {
    background: rgba(15, 23, 42, 0.5);
}

.profile-modal-inner {
    padding: 1.5rem;
}

.profile-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    margin: 0 0 1.25rem 0;
}

.profile-edit-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.profile-field label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
}

.profile-input {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--text-primary, #0f172a);
    background: var(--card-bg, #fff);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.profile-input::placeholder {
    color: var(--text-secondary, #64748b);
}

.profile-input:focus {
    outline: none;
    border-color: var(--accent, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.profile-textarea {
    resize: vertical;
    min-height: 80px;
}

.profile-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border, #e2e8f0);
}

.profile-btn {
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.profile-btn-secondary {
    border: 1px solid var(--border, #e2e8f0);
    background: transparent;
    color: var(--text-secondary, #64748b);
}

.profile-btn-secondary:hover {
    background: var(--main-bg, #f1f5f9);
    color: var(--text-primary, #0f172a);
}

.profile-btn-primary {
    border: none;
    background: var(--accent, #3b82f6);
    color: #fff;
}

.profile-btn-primary:hover {
    background: #2563eb;
}

/* ========== Private view: show "who expressed interest" ========== */
.profile-content[data-view="public"] .profile-interests-block {
    display: none;
}

.profile-interests-block {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border, #e2e8f0);
}

.profile-interests-heading {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary, #64748b);
    margin: 0 0 0.5rem 0;
}

.profile-interests-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.875rem;
    color: var(--text-primary, #0f172a);
}

.profile-interests-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.profile-interests-list li:last-child {
    border-bottom: none;
}

.profile-interest-initials {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-no-interests {
    font-size: 0.8125rem;
    color: var(--text-secondary, #64748b);
    font-style: italic;
    margin: 0;
}

/* Responsive: stack sidebar above content on small screens */
@media (max-width: 768px) {
    .profile-layout {
        flex-direction: column;
        padding-top: 5rem;
    }

    .profile-sidebar {
        width: 100%;
        min-width: 0;
    }

    .profile-publish-card {
        flex-direction: column;
        align-items: stretch;
    }

    .profile-sidebar-card {
        position: static;
    }

    .profile-avatar-overlay {
        left: 1rem;
    }

    .profile-avatar-wrap {
        width: 96px;
        height: 96px;
    }
}
