/**
 * Shared Thread View Styles
 * Read-only public view for shared threads
 * Mobile-first responsive design
 */

/* Container */
.shared-thread-view {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #0a0a0f;
}

/* Loading State */
.shared-thread-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: #fff;
    gap: 16px;
}

.shared-thread-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #4AABC2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Error State */
.shared-thread-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: #fff;
    text-align: center;
    padding: 24px;
    gap: 16px;
}

.shared-thread-error .error-icon {
    font-size: 48px;
}

.shared-thread-error h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.shared-thread-error p {
    margin: 0;
    color: rgba(255, 255, 255, 0.6);
}

.shared-thread-error .retry-btn {
    padding: 12px 32px;
    background: linear-gradient(135deg, #4AABC2, #3A9BB2);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.shared-thread-error .retry-btn:hover {
    background: linear-gradient(135deg, #5BBCD3, #4AABC2);
}

.shared-thread-error .home-link {
    color: #4AABC2;
    text-decoration: none;
}

.shared-thread-error .home-link:hover {
    text-decoration: underline;
}

/* Header */
.shared-thread-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: rgba(15, 15, 25, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 100;
}

.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
    flex-shrink: 0;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.shared-thread-title-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.shared-thread-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shared-thread-badge {
    padding: 4px 10px;
    background: rgba(74, 171, 194, 0.15);
    border: 1px solid rgba(74, 171, 194, 0.3);
    border-radius: 20px;
    font-size: 12px;
    color: #4AABC2;
    white-space: nowrap;
    flex-shrink: 0;
}

.shared-thread-header-spacer {
    width: 40px;
    flex-shrink: 0;
}

/* Content */
.shared-thread-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    padding-bottom: 100px;
    /* Space for fork button */
}

/* Empty State */
.shared-thread-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: rgba(255, 255, 255, 0.5);
}

/* Messages List */
.shared-messages-list {
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-width: 900px;
    margin: 0 auto;
}

/* Message Turn */
.shared-message-turn {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* User Message */
.shared-user-message {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.shared-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #4AABC2, #3A9BB2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
    order: 2;
}

.shared-user-bubble {
    max-width: 70%;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(74, 171, 194, 0.15), rgba(74, 171, 194, 0.05));
    border: 1px solid rgba(74, 171, 194, 0.2);
    border-radius: 16px 16px 4px 16px;
}

.shared-user-bubble p {
    margin: 0;
    color: #fff;
    font-size: 15px;
    line-height: 1.5;
}

/* Responses Grid */
.shared-responses-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.shared-single-response {
    max-width: 80%;
}

/* Response Card */
.shared-response-card {
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
}

.shared-response-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.shared-model-tag {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4AABC2, #3A9BB2);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.shared-model-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.shared-model-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shared-model-provider {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shared-model-badge-verified {
    width: 18px;
    height: 18px;
    background: rgba(74, 171, 194, 0.2);
    border-radius: 50%;
    color: #4AABC2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}

.shared-response-body {
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    line-height: 1.6;
}

.shared-response-body p {
    margin: 0 0 12px;
}

.shared-response-body p:last-child {
    margin-bottom: 0;
}

/* Fork Button Container */
.shared-fork-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 24px;
    background: linear-gradient(180deg, transparent, rgba(10, 10, 15, 0.95) 30%);
    display: flex;
    justify-content: center;
    z-index: 100;
}

.shared-fork-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 48px;
    background: linear-gradient(135deg, #CB9275 0%, #B87A5E 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 32px rgba(203, 146, 117, 0.25);
    position: relative;
    overflow: hidden;
}

.shared-fork-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: 0.5s;
}

.shared-fork-btn:hover::before {
    left: 100%;
}

.shared-fork-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 40px rgba(203, 146, 117, 0.35);
    border-color: rgba(255, 255, 255, 0.2);
}

.shared-fork-btn .fork-icon {
    font-size: 20px;
    margin-bottom: 2px;
}

.shared-fork-btn .fork-text {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.shared-fork-btn .fork-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .shared-thread-header {
        padding: 12px 16px;
    }

    .shared-thread-title {
        font-size: 16px;
    }

    .shared-thread-badge {
        display: none;
    }

    .shared-thread-content {
        padding: 16px;
        padding-bottom: 100px;
    }

    .shared-responses-grid {
        grid-template-columns: 1fr;
    }

    .shared-user-bubble {
        max-width: 85%;
    }

    .shared-single-response {
        max-width: 100%;
    }

    .shared-fork-container {
        padding: 12px 16px;
    }

    .shared-fork-btn {
        width: 100%;
        padding: 14px 32px;
    }
}

/* iPhone Safe Area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .shared-fork-container {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .shared-thread-content {
        padding-bottom: calc(100px + env(safe-area-inset-bottom));
    }
}

/* Header Icon Button (for share button in main header) */
.header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}