/* ConnectBook - Facebook Inspired Production Stylesheet */

:root {
    --cb-primary: #1877f2;
    --cb-primary-hover: #166fe5;
    --cb-bg: #f0f2f5;
    --cb-surface: #ffffff;
    --cb-text: #050505;
    --cb-text-muted: #65676b;
    --cb-border: #ced0d4;
    --cb-border-light: #e4e6eb;
    --cb-hover-bg: #e4e6eb;
    --cb-card-radius: 8px;
    --cb-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    --cb-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

body {
    background-color: var(--cb-bg);
    color: var(--cb-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    padding-top: 56px;
    overflow-x: hidden;
}

/* NAVBAR */
.cb-navbar {
    height: 56px;
    background-color: var(--cb-surface);
    border-bottom: 1px solid var(--cb-border-light);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    z-index: 1030;
}

.cb-brand {
    font-size: 26px;
    font-weight: 800;
    color: var(--cb-primary) !important;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.cb-search-input {
    background-color: var(--cb-bg);
    border: none;
    border-radius: 50px;
    padding: 8px 16px 8px 36px;
    font-size: 14px;
    width: 220px;
    transition: all 0.2s ease;
}

.cb-search-input:focus {
    width: 280px;
    background-color: var(--cb-surface);
    box-shadow: 0 0 0 2px var(--cb-primary);
}

.cb-nav-pill {
    padding: 8px 24px;
    border-radius: 8px;
    color: var(--cb-text-muted);
    font-size: 20px;
    transition: all 0.15s ease;
    position: relative;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cb-nav-pill:hover {
    background-color: var(--cb-hover-bg);
    color: var(--cb-text);
}

.cb-nav-pill.active {
    color: var(--cb-primary);
}

.cb-nav-pill.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--cb-primary);
    border-radius: 2px 2px 0 0;
}

.cb-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--cb-hover-bg);
    color: var(--cb-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border: none;
    cursor: pointer;
    position: relative;
    transition: background 0.15s;
    text-decoration: none;
}

.cb-icon-btn:hover {
    background-color: #d8dadf;
    color: var(--cb-text);
}

.cb-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background-color: #e41e3f;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 5px;
    border: 2px solid var(--cb-surface);
}

/* CARDS */
.cb-card {
    background-color: var(--cb-surface);
    border-radius: var(--cb-card-radius);
    box-shadow: var(--cb-shadow);
    border: 1px solid var(--cb-border-light);
    margin-bottom: 16px;
}

/* SIDEBARS */
.cb-sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--cb-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: background 0.15s;
}

.cb-sidebar-link:hover {
    background-color: var(--cb-hover-bg);
    color: var(--cb-text);
}

.cb-sidebar-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* STORIES TRAY */
.cb-stories-tray {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.cb-stories-tray::-webkit-scrollbar {
    display: none;
}

.cb-story-card {
    flex: 0 0 115px;
    height: 190px;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
    background-size: cover;
    background-position: center;
}

.cb-story-card:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.cb-story-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.7) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px;
}

.cb-story-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid var(--cb-primary);
    object-fit: cover;
}

.cb-story-name {
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    line-height: 1.2;
}

.cb-create-story-card {
    background-color: var(--cb-surface);
    border: 1px solid var(--cb-border-light);
    display: flex;
    flex-direction: column;
}

.cb-create-story-top {
    height: 130px;
    overflow: hidden;
}

.cb-create-story-top img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cb-create-story-bottom {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-top: 14px;
}

.cb-create-story-btn {
    position: absolute;
    top: -16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--cb-primary);
    color: #fff;
    border: 3px solid var(--cb-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* CREATE POST BOX */
.cb-create-post-input {
    background-color: var(--cb-bg);
    border-radius: 20px;
    padding: 10px 16px;
    cursor: pointer;
    color: var(--cb-text-muted);
    transition: background 0.15s;
    border: 1px solid transparent;
}

.cb-create-post-input:hover {
    background-color: var(--cb-hover-bg);
}

.cb-post-btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--cb-text-muted);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: transparent;
    flex: 1;
}

.cb-post-btn-action:hover {
    background-color: var(--cb-hover-bg);
}

/* POST CARD */
.cb-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.cb-avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}

.cb-avatar-profile {
    width: 168px;
    height: 168px;
    border-radius: 50%;
    border: 4px solid var(--cb-surface);
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.cb-post-author {
    font-weight: 600;
    color: var(--cb-text);
    text-decoration: none;
}

.cb-post-author:hover {
    text-decoration: underline;
}

.cb-post-time {
    font-size: 12px;
    color: var(--cb-text-muted);
    text-decoration: none;
}

.cb-post-text {
    font-size: 15px;
    line-height: 1.4;
    white-space: pre-line;
    word-break: break-word;
}

.cb-post-media img,
.cb-post-media video {
    width: 100%;
    max-height: 550px;
    object-fit: cover;
    border-top: 1px solid var(--cb-border-light);
    border-bottom: 1px solid var(--cb-border-light);
}

/* REACTIONS SYSTEM */
.cb-reaction-container {
    position: relative;
    display: inline-block;
    flex: 1;
}

.cb-reaction-box {
    position: absolute;
    bottom: 110%;
    left: 0;
    background: var(--cb-surface);
    border-radius: 30px;
    padding: 6px 12px;
    display: none;
    gap: 8px;
    box-shadow: var(--cb-shadow-lg);
    border: 1px solid var(--cb-border-light);
    z-index: 100;
    animation: popup 0.2s ease-out;
}

@keyframes popup {
    0% { transform: translateY(10px) scale(0.9); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.cb-reaction-container:hover .cb-reaction-box {
    display: flex;
}

.cb-reaction-btn {
    font-size: 26px;
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    line-height: 1;
}

.cb-reaction-btn:hover {
    transform: scale(1.4) translateY(-4px);
}

/* COMMENTS */
.cb-comment-bubble {
    background-color: var(--cb-bg);
    border-radius: 18px;
    padding: 8px 12px;
    display: inline-block;
    max-width: 90%;
    word-break: break-word;
}

.cb-comment-author {
    font-weight: 600;
    font-size: 13px;
    color: var(--cb-text);
    text-decoration: none;
}

.cb-comment-text {
    font-size: 14px;
    margin-top: 2px;
}

/* MESSENGER */
.cb-messenger-container {
    height: calc(100vh - 80px);
    background-color: var(--cb-surface);
    border-radius: var(--cb-card-radius);
    box-shadow: var(--cb-shadow);
    border: 1px solid var(--cb-border-light);
    overflow: hidden;
}

.cb-msg-list {
    height: 100%;
    overflow-y: auto;
    border-right: 1px solid var(--cb-border-light);
}

.cb-msg-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--cb-text);
    text-decoration: none;
    transition: background 0.15s;
}

.cb-msg-item:hover, .cb-msg-item.active {
    background-color: var(--cb-hover-bg);
}

.cb-chat-body {
    height: calc(100% - 130px);
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cb-bubble {
    max-width: 65%;
    padding: 9px 14px;
    border-radius: 18px;
    font-size: 14.5px;
    word-break: break-word;
    position: relative;
}

.cb-bubble-me {
    align-self: flex-end;
    background-color: var(--cb-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.cb-bubble-other {
    align-self: flex-start;
    background-color: var(--cb-bg);
    color: var(--cb-text);
    border-bottom-left-radius: 4px;
}

/* PROFILE HEADER */
.cb-profile-cover {
    height: 350px;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    position: relative;
    background-size: cover;
    background-position: center;
}

.cb-profile-header-info {
    position: relative;
    padding-bottom: 16px;
}

.cb-profile-avatar-wrap {
    margin-top: -80px;
    position: relative;
    display: inline-block;
}

/* REELS FEED */
.cb-reel-container {
    max-width: 420px;
    margin: 0 auto 24px;
    height: 720px;
    background: #000;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.cb-reel-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cb-reel-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: #fff;
}

/* UTILITIES */
.cursor-pointer {
    cursor: pointer;
}

/* MESSENGER VOICE NOTE PLAYER & WAVEFORM */
.cb-voice-player {
    min-width: 220px;
    padding: 8px 12px;
    border-radius: 18px;
    background: rgba(0, 0, 0, 0.05);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.cb-bubble-me .cb-voice-player {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}
.cb-bubble-other .cb-voice-player {
    background: #e4e6eb;
    color: #050505;
}
.cb-voice-play-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease;
}
.cb-voice-play-btn:active {
    transform: scale(0.92);
}
.cb-voice-waves {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
    flex-grow: 1;
}
.cb-wave-bar {
    width: 3px;
    background-color: currentColor;
    border-radius: 3px;
    opacity: 0.65;
    transition: height 0.2s ease, opacity 0.2s ease;
}
.cb-voice-player.playing .cb-wave-bar {
    animation: wavePulse 0.8s infinite ease-in-out alternate;
}
.cb-voice-player.playing .cb-wave-bar:nth-child(2) { animation-delay: 0.1s; }
.cb-voice-player.playing .cb-wave-bar:nth-child(3) { animation-delay: 0.2s; }
.cb-voice-player.playing .cb-wave-bar:nth-child(4) { animation-delay: 0.3s; }
.cb-voice-player.playing .cb-wave-bar:nth-child(5) { animation-delay: 0.15s; }
.cb-voice-player.playing .cb-wave-bar:nth-child(6) { animation-delay: 0.25s; }
.cb-voice-player.playing .cb-wave-bar:nth-child(7) { animation-delay: 0.35s; }
.cb-voice-player.playing .cb-wave-bar:nth-child(8) { animation-delay: 0.12s; }
.cb-voice-player.playing .cb-wave-bar:nth-child(9) { animation-delay: 0.22s; }
.cb-voice-player.playing .cb-wave-bar:nth-child(10) { animation-delay: 0.32s; }

@keyframes wavePulse {
    0% { transform: scaleY(0.4); opacity: 0.5; }
    100% { transform: scaleY(1.2); opacity: 1; }
}

/* MOBILE MESSENGER STYLES */
@media (max-width: 767.98px) {
    .cb-messenger-container {
        height: calc(100vh - 75px) !important;
        margin: 0 -12px;
    }
    .cb-msg-list {
        height: 100% !important;
        border-right: none !important;
    }
}

