/* =============================================================================
   links-profile.css
   Shared styles for profile-show and profile-edit pages
   Sections:
     1. Profile Container & Header (banner / brief-header)
     2. Profile Picture (avatar)
     3. Profile Info & Meta
     4. Brief Cards
     5. Link Cards
     6. Modals & Overlays
     7. Utilities & Animations
   ============================================================================= */


/* =============================================================================
   1. PROFILE CONTAINER & HEADER
   Applies to:  .profile-container  /  .brief-header (show)  /  .banner (edit)
   ============================================================================= */

.profile-container {
    position: relative;
    width: 100%;
    overflow: visible;          /* must stay visible so avatar can overlap below */
    border-bottom-right-radius: 15px;
    border-bottom-left-radius: 15px;
}

/* -- Show page header -------------------------------------------------------- */
.brief-header {
    height: 150px;
    overflow: hidden;
    background: var(--app-surface-3, #eceff3);
    border-bottom-right-radius: 15px;
    border-bottom-left-radius: 15px;
}

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

/* -- Edit page header -------------------------------------------------------- */
.banner {
    height: 150px;
    overflow: hidden;
    position: relative;
    background-color: #b2b2b2;
    border-top-right-radius: 15px;
    border-top-left-radius: 15px;
}

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

/* Camera icon centered over banner (edit page) */
.camera-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 45px;
    height: 45px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

/* -- Responsive header heights ---------------------------------------------- */
@media (min-width: 768px) {
    .brief-header,
    .banner {
        height: 200px;
    }
}

@media (min-width: 1024px) {
    .brief-header,
    .banner {
        height: 250px;
    }
}


/* =============================================================================
   2. PROFILE PICTURE (AVATAR)
   Applies to:  .profile-picture  on both show and edit pages
   ============================================================================= */
/* =============================================================================
   2. PROFILE PICTURE (AVATAR)
   ============================================================================= */

.profile-picture {
    position: absolute;
    bottom: 0px;     /* half of 90px = avatar straddles header edge */
    left: 16px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 3px solid var(--app-surface, #fff);
    background-color: var(--app-surface, #fff);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

/* Override app.css .avatar-xxl which sets 5.125rem width/height */
.profile-picture .avatar,
.profile-picture .avatar-xxl {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50%;
    overflow: hidden;
    display: block;
    font-size: inherit !important;  /* neutralises the 1.70833rem font-size */
}

/* Override app.css img { vertical-align: middle } and avatar-img rules */
.profile-picture .avatar-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50%;
    display: block !important;
    vertical-align: top !important; /* kills the middle-align gap */
}

/* Camera icon — bottom-right of avatar, edit page only */
.profile-picture .camera-icon-small {
    position: absolute;
    bottom: 4px;
    right: 4px;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    width: 26px;
    height: 26px;
    background-color: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11;
    overflow: visible;
}

/* Spacer = exactly half the avatar height so form starts below avatar */
.spacer,
.spacer-50 {
    height: 45px;
}

@media (min-width: 768px) {
    .profile-picture {
        width: 100px;
        height: 100px;
        bottom: 0px;
    }

    .spacer,
    .spacer-50 {
        height: 50px;
    }
}


/* =============================================================================
   3. PROFILE INFO & META
   Applies to:  profile show page info section below the header
   ============================================================================= */

/* Fix Bootstrap row/col gutters on mobile so header bleeds edge-to-edge.
   Add  px-0 px-lg-3  to the col-lg-8 in profile-show.blade.php instead of
   the old  style="margin-left:-15px; margin-right:-25px;"  hack. */

/* Fix the row used as a bg wrapper */
.profile-container ~ .bg-white.row,
.col-lg-8 .bg-white.row {
    margin-left: 0;
    margin-right: 0;
}


/* =============================================================================
   4. BRIEF CARDS
   Applies to:  .brief-card  list in the briefs tab on the show page
   ============================================================================= */

.brief-card {
    transition: background-color 0.2s ease;
}

.brief-card:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Prevent link underlines inside brief cards */
.brief-card a:not(.btn-link) {
    text-decoration: none !important;
}

/* Keep the share button above the card link layer */
.brief-card .btn-link {
    z-index: 2;
    position: relative;
}


/* =============================================================================
   5. LINK CARDS
   Applies to:  .link-card  list in the links tab on the show page
   ============================================================================= */

.link-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.2s ease;
    overflow: hidden;
}

.link-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

/* Remove card-body padding from the links tab */
#links .card-body {
    padding-left: 0;
    padding-right: 0;
}

/* Full-width links list */
.links-list {
    width: 100%;
}

.links-list > div {
    padding-left: 0;
    padding-right: 0;
}

.link-card-body {
    padding: 1rem;
}

/* Social / link icon wrapper */
.social-icon-wrapper {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 10px;
    flex-shrink: 0;
}

.social-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Link text */
.link-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #111827;
}

.link-url {
    font-size: 0.875rem;
    color: #6b7280;
    text-decoration: none;
    display: block;
    word-break: break-all;
}

.link-url:hover {
    color: #3b82f6;
    text-decoration: underline;
}

/* Link action buttons */
.link-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.btn-icon {
    background: transparent;
    border: none;
    padding: 0.375rem;
    cursor: pointer;
    border-radius: 6px;
    color: #6b7280;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: #f3f4f6;
    color: #111827;
}

.btn-icon.text-danger:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Inline edit form inside a link card */
.link-edit-form {
    animation: slideDown 0.2s ease;
}


/* =============================================================================
   6. MODALS & OVERLAYS
   Applies to:  custom confirm modal and add-links modal on show page
   ============================================================================= */

.custom-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    pointer-events: none;
}

.custom-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    pointer-events: auto;
}

.custom-modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Confirm modal content box */
.custom-confirm-content {
    background: white;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    pointer-events: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
                0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.custom-confirm-header {
    padding: 24px 24px 16px;
    text-align: center;
}

.custom-confirm-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.custom-confirm-icon.bg-success { background-color: #28a745; }
.custom-confirm-icon.bg-danger  { background-color: #dc3545; }

.custom-confirm-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.custom-confirm-message {
    color: #6c757d;
    margin-bottom: 0;
}

.custom-confirm-body {
    padding: 16px 24px 24px;
}

.custom-confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.custom-confirm-btn {
    padding: 8px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.custom-confirm-btn-cancel          { background-color: #6c757d; color: white; }
.custom-confirm-btn-cancel:hover    { background-color: #5a6268; }
.custom-confirm-btn-confirm         { background-color: #007bff; color: white; }
.custom-confirm-btn-confirm:hover   { background-color: #0069d9; }
.custom-confirm-btn-danger          { background-color: #dc3545; color: white; }
.custom-confirm-btn-danger:hover    { background-color: #c82333; }

/* Alpine cloak */
[x-cloak] { display: none !important; }


/* =============================================================================
   7. UTILITIES & ANIMATIONS
   ============================================================================= */

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* =============================================================================
   8. PROFILE SHOW — header actions, info block, brief list
   ============================================================================= */

.ps-card { border-radius: 0 0 14px 14px; }

.ps-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 0;
    min-height: 44px;
}

.ps-icon-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
    color: var(--app-text-2);
}

.ps-icon-btn .material-icons { font-size: 18px; }

.ps-info { padding: 4px 16px 18px; }

.ps-name {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.25;
    margin: 0;
    color: var(--app-text);
    word-break: break-word;
}

.ps-handle { color: var(--app-muted); font-size: .9rem; }

.ps-bio {
    margin: 10px 0 0;
    color: var(--app-text);
    white-space: pre-line;
    line-height: 1.5;
}

.ps-bio--empty { color: var(--app-muted); font-size: .875rem; }

.ps-meta {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    color: var(--app-text-2);
    font-size: .875rem;
}

.ps-meta li {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.ps-meta .material-icons { font-size: 17px; color: var(--app-muted); }
.ps-meta a { color: var(--app-accent); }

.ps-private {
    font-size: .68rem;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
    color: var(--app-muted);
}

.ps-stats {
    display: flex;
    gap: 18px;
    margin-top: 12px;
    font-size: .9rem;
}

.ps-stats a, .ps-stats span { color: var(--app-muted); text-decoration: none; }
.ps-stats a:hover { text-decoration: underline; }
.ps-stats strong { color: var(--app-text); font-weight: 700; }

.ps-owner-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
}

.ps-owner-actions .btn.mb-2 { margin-bottom: 0 !important; }

/* -- Brief list -------------------------------------------------------------- */

.ps-briefs { display: flex; flex-direction: column; }

.ps-brief {
    position: relative;
    padding: 16px;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-surface);
}

.ps-brief:hover { background: var(--app-surface-2); }

.ps-brief-link {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.ps-brief-link:focus-visible { outline: 2px solid var(--app-accent); outline-offset: -2px; }

.ps-above { position: relative; z-index: 2; }

.ps-brief-title {
    font-size: 1rem;
    font-weight: 800;
    margin: 0 0 2px;
    color: var(--app-text);
    line-height: 1.35;
}

.ps-brief-meta {
    display: flex;
    gap: 6px;
    font-size: .8125rem;
    color: var(--app-muted);
    margin-bottom: 8px;
}

.ps-brief-meta a { color: var(--app-muted); }
.ps-brief-meta a:hover { color: var(--app-accent); }

.ps-brief-excerpt {
    margin: 0;
    color: var(--app-text-2);
    font-size: .9rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ps-brief-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    color: var(--app-muted);
    font-size: .8125rem;
}

.ps-brief-stat { display: inline-flex; align-items: center; gap: 4px; }
.ps-brief-stat .material-icons { font-size: 18px; }

.ps-brief-share {
    border: 0;
    background: transparent;
    color: var(--app-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ps-brief-share:hover { background: var(--app-accent-soft); color: var(--app-accent); }
.ps-brief-share .material-icons { font-size: 18px; }

.ps-empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--app-muted);
}

.ps-empty > .material-icons { font-size: 44px; opacity: .55; }
.ps-empty-title { font-weight: 700; color: var(--app-text); margin: 8px 0 2px; }
.ps-empty-text { font-size: .875rem; margin: 0 0 14px; }
