/* STORIES.CSS - Rail de stories no topo da Home + viewer fullscreen + composer */

/* ==================== RAIL ==================== */
.stories-rail {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    overflow-x: auto;
    padding: 14px 16px;
    margin-bottom: 24px; /* mesmo espaçamento dos outros blocos da Home */
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.stories-rail::-webkit-scrollbar { height: 6px; }
.stories-rail::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
.stories-rail .loading-spinner { padding: 18px 0; }

.story-bubble {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 72px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

.story-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, var(--color-primary), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.2s ease;
}
.story-bubble:hover .story-ring { transform: scale(1.05); }
.story-ring.viewed { background: var(--color-border); }

.story-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-bg-card);
    background: var(--color-bg-card);
    display: block;
}

.story-type-badge {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: var(--shadow-sm);
}

/* Bubble de criar */
.story-ring-add {
    background: none;
    border: 2px dashed var(--color-primary);
    padding: 1px;
}
.story-add-avatar { position: relative; width: 100%; height: 100%; border-radius: 50%; }
.story-add-avatar .story-avatar-img { opacity: 0.55; border: none; }
.story-add-plus {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), #a855f7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    border: 2px solid var(--color-bg-card);
}

.story-bubble-name {
    font-size: 12px;
    color: var(--color-text);
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* ==================== VIEWER FULLSCREEN ==================== */
.story-viewer-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}
.story-viewer-overlay.active {
    display: flex;
    animation: storyFadeIn 0.25s ease;
}

.story-viewer-frame {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.story-viewer-progress {
    display: flex;
    gap: 4px;
    padding: 10px 10px 0;
}
.story-progress-seg {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}
.story-progress-seg-fill {
    height: 100%;
    width: 0;
    background: #fff;
    border-radius: 2px;
}
@keyframes storyProgress {
    from { width: 0%; }
    to { width: 100%; }
}

.story-viewer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    color: #fff;
    z-index: 2;
}
.story-viewer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.6);
}
.story-viewer-meta { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.story-viewer-meta strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-viewer-meta span { font-size: 12px; opacity: 0.85; }
.story-viewer-close,
.story-viewer-delete {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: background 0.2s ease;
}
.story-viewer-close:hover,
.story-viewer-delete:hover { background: rgba(255, 255, 255, 0.32); }

.story-viewer-content {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    user-select: none;
    touch-action: manipulation;
}
.story-viewer-img,
.story-viewer-video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.story-viewer-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 28px 16px 18px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
    color: #fff;
    font-size: 15px;
    line-height: 1.4;
}

/* Card gerado (story sem foto: aniversário / só texto) */
.story-viewer-card {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 32px;
    text-align: center;
    background: linear-gradient(135deg, var(--color-primary), #a855f7);
    color: #fff;
}
.story-viewer-card-emoji { font-size: 92px; line-height: 1; }
.story-viewer-card-text { font-size: 22px; font-weight: 600; max-width: 340px; line-height: 1.35; }
.story-card-birthday { background: linear-gradient(135deg, #ff9a3c, #ff6f91); }
.story-card-recado { background: linear-gradient(135deg, #2196f3, #6d00ff); }
.story-card-bastidores { background: linear-gradient(135deg, #11998e, #38ef7d); }
.story-card-free { background: linear-gradient(135deg, var(--color-primary), #a855f7); }

/* Barra de ações (curtir) */
.story-viewer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 18px;
}
.story-like-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    padding: 9px 16px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.1s ease;
}
.story-like-btn:hover { background: rgba(255, 255, 255, 0.22); }
.story-like-btn:active { transform: scale(0.92); }
.story-like-btn svg { width: 22px; height: 22px; transition: fill 0.2s ease; }
.story-like-btn.liked { color: #ff3b6b; }
.story-like-btn.liked svg { stroke: #ff3b6b; }
.story-like-count { min-width: 6px; }

/* ==================== COMPOSER ==================== */
.story-composer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2010;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
}
.story-composer-overlay.active {
    display: flex;
    animation: storyFadeIn 0.25s ease;
}
.story-composer {
    width: 100%;
    max-width: 440px;
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 20px;
    max-height: 90vh;
    overflow-y: auto;
}
.story-composer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.story-composer-header h3 { margin: 0; font-size: 18px; color: var(--color-text); }
.story-composer-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--color-text-light);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: background 0.2s ease;
}
.story-composer-close:hover { background: var(--color-hover); }

.story-composer-types { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.story-type-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-bg-card);
    color: var(--color-text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.story-type-pill:hover { border-color: var(--color-primary); }
.story-type-pill.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    font-weight: 600;
}

.story-composer-drop {
    display: block;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 18px;
    text-align: center;
    cursor: pointer;
    margin-bottom: 14px;
    transition: border-color 0.2s ease;
}
.story-composer-drop:hover { border-color: var(--color-primary); }
.story-composer-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--color-text-light);
}
.story-drop-icon { font-size: 32px; }
.story-drop-text { font-size: 13px; }
.story-preview-img { max-width: 100%; max-height: 240px; border-radius: var(--radius-md); object-fit: contain; }
.story-preview-video { max-width: 100%; max-height: 240px; border-radius: var(--radius-md); object-fit: contain; }

.story-composer-caption {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    color: var(--color-text);
    background: var(--color-bg-card);
    margin-bottom: 12px;
    box-sizing: border-box;
}
.story-composer-caption:focus { outline: none; border-color: var(--color-primary); }

.story-composer-footer { display: flex; align-items: center; justify-content: space-between; }
.story-caption-count { font-size: 12px; color: var(--color-text-light); }
.story-composer-submit {
    background: linear-gradient(135deg, var(--color-primary), #a855f7);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}
.story-composer-submit:hover { opacity: 0.9; }
.story-composer-submit:disabled { opacity: 0.6; cursor: not-allowed; }

@keyframes storyFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==================== AÇÕES DE ANIVERSÁRIO (aba Equipe) ==================== */
.birthday-actions { display: flex; gap: 6px; margin-top: 8px; }
.birthday-card .birthday-actions { justify-content: center; }
.birthday-action-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: var(--color-bg-card);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}
.birthday-action-btn:hover {
    border-color: var(--color-primary);
    background: rgba(var(--color-primary-rgb), 0.12);
    transform: translateY(-2px);
}
[data-theme="dark"] .birthday-action-btn { background: #252525; border-color: #333; }

/* ==================== MODAL DE KUDOS (avulso) ==================== */
.kudos-send-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2010;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
}
.kudos-send-overlay.active { display: flex; animation: storyFadeIn 0.25s ease; }
.kudos-send-modal {
    width: 100%;
    max-width: 420px;
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 20px;
    max-height: 90vh;
    overflow-y: auto;
}
.kudos-send-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kudos-send-header h3 { margin: 0; font-size: 18px; color: var(--color-text); }
.kudos-send-close {
    background: none; border: none; font-size: 18px; cursor: pointer;
    color: var(--color-text-light); width: 32px; height: 32px; border-radius: 50%;
}
.kudos-send-close:hover { background: var(--color-hover); }
.kudos-send-receiver { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; color: var(--color-text); font-size: 14px; }
.kudos-send-receiver img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.kudos-send-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.kudos-send-cat {
    display: flex; align-items: center; gap: 4px; padding: 8px 12px;
    border: 1px solid var(--color-border); border-radius: var(--radius-full);
    background: var(--color-bg-card); color: var(--color-text); font-size: 13px; cursor: pointer;
    transition: all 0.2s ease;
}
.kudos-send-cat:hover { border-color: var(--color-primary); }
.kudos-send-cat.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; font-weight: 600; }
.kudos-send-msg {
    width: 100%; border: 1px solid var(--color-border); border-radius: var(--radius-md);
    padding: 10px 12px; font-family: inherit; font-size: 14px; resize: vertical;
    color: var(--color-text); background: var(--color-bg-card); margin-bottom: 12px; box-sizing: border-box;
}
.kudos-send-msg:focus { outline: none; border-color: var(--color-primary); }
.kudos-send-footer { display: flex; align-items: center; justify-content: space-between; }
.kudos-send-count { font-size: 12px; color: var(--color-text-light); }
.kudos-send-submit {
    background: linear-gradient(135deg, var(--color-primary), #a855f7); color: #fff; border: none;
    padding: 10px 22px; border-radius: var(--radius-md); font-size: 14px; font-weight: 600; cursor: pointer;
    transition: opacity 0.2s ease;
}
.kudos-send-submit:hover { opacity: 0.9; }
.kudos-send-submit:disabled { opacity: 0.6; cursor: not-allowed; }
[data-theme="dark"] .kudos-send-modal { background: #252525; }
[data-theme="dark"] .kudos-send-header h3 { color: #e0e0e0; }
[data-theme="dark"] .kudos-send-msg { background: #1e1e1e; border-color: #333; color: #e0e0e0; }
[data-theme="dark"] .kudos-send-cat { background: #1e1e1e; border-color: #333; color: #e0e0e0; }
[data-theme="dark"] .kudos-send-cat.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* Toasts sempre acima dos overlays de stories (viewer 2000 / composer 2010),
   senão o feedback de validação/erro do composer fica escondido. */
.toast-notification { z-index: 10000 !important; }

/* ==================== DARK MODE (rail/composer; o viewer é sempre escuro) ==================== */
[data-theme="dark"] .stories-rail { background: #252525; border-color: #333; }
[data-theme="dark"] .story-avatar-img { border-color: #252525; background: #252525; }
[data-theme="dark"] .story-type-badge { background: #252525; }
[data-theme="dark"] .story-add-plus { border-color: #252525; }
[data-theme="dark"] .story-bubble-name { color: #e0e0e0; }
[data-theme="dark"] .story-composer { background: #252525; }
[data-theme="dark"] .story-composer-header h3 { color: #e0e0e0; }
[data-theme="dark"] .story-composer-caption { background: #1e1e1e; border-color: #333; color: #e0e0e0; }
[data-theme="dark"] .story-type-pill { background: #1e1e1e; border-color: #333; color: #e0e0e0; }
[data-theme="dark"] .story-type-pill.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* ==================== RESPONSIVO ==================== */
@media (max-width: 768px) {
    .stories-rail { gap: 12px; padding: 12px; }
    .story-bubble { width: 64px; }
    .story-ring { width: 58px; height: 58px; }
    .story-bubble-name { max-width: 60px; font-size: 11px; }
    .story-viewer-frame { max-width: 100%; }
    .story-viewer-card-emoji { font-size: 76px; }
    .story-viewer-card-text { font-size: 19px; }
}
