/* ================================== */
/* СЕКЦИЯ ИСТОРИЙ В ПРОФИЛЕ (КОМПАКТНО) */
/* ================================== */

.profile-stories-section {
    margin: 0;
    padding: 0;
    border: none;
}

.profile-stories-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 0;
}

.profile-stories-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--text);
}

.profile-add-story-btn {
    background: var(--primary);
    border: none;
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.profile-add-story-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

.profile-add-story-btn:active {
    transform: scale(0.98);
}

/* GRID: 4 колонки, минимальный gap */
.profile-stories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 0;
}

.profile-story-item {
    cursor: pointer;
    border-radius: 0;
    overflow: hidden;
    background: var(--bg-elevated);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.profile-story-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-sm);
}

.profile-story-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--profile-story-preview-bg, #1e1e1e);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-story-preview img,
.profile-story-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-story-audio-icon,
.profile-story-placeholder {
    font-size: 32px;
    color: var(--text-secondary);
}

.profile-story-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--profile-story-delete-bg, rgba(0, 0, 0, 0.6));
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: opacity var(--transition-fast), background var(--transition-fast);
}

.profile-story-item:hover .profile-story-delete {
    opacity: 1;
}

.profile-story-delete:hover {
    background: var(--danger);
}

.profile-story-caption {
    font-size: 10px;
    padding: 2px 0;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    line-height: 1.2;
}

.profile-stories-empty {
    text-align: center;
    padding: 16px 8px;
    color: var(--text-secondary);
    font-size: 13px;
}

.profile-create-story-btn {
    display: block;
    margin: 8px auto 0;
    background: var(--primary);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 12px;
    transition: background var(--transition-fast);
}

.profile-create-story-btn:hover {
    background: var(--primary-dark);
}

/* ================================== */
/* КОМПАКТНЫЕ ПОЛЯ В ПРОФИЛЕ (уменьшаем вертикальные отступы) */
/* ================================== */
.user-profile-body {
    gap: 8px !important;
}

.profile-info-field,
.profile-editable-field {
    padding: 6px 0 !important;
    margin-bottom: 0 !important;
}

.profile-about-section {
    margin-bottom: 8px !important;
}

.profile-stories-section {
    margin-top: 4px !important;
}

/* ================================== */
/* СВЕТЛАЯ ТЕМА ДЛЯ СЕКЦИИ ИСТОРИЙ    */
/* ================================== */
body.light-theme {
    --profile-story-preview-bg: #f0f0f0;
    --profile-story-delete-bg: rgba(0, 0, 0, 0.3);
}

body.light-theme .profile-story-delete {
    color: #1e2a3a;
}

body.light-theme .profile-story-delete:hover {
    color: white;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .profile-stories-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 3px;
    }
    .profile-story-delete {
        width: 20px;
        height: 20px;
        font-size: 10px;
        top: 2px;
        right: 2px;
    }
    .profile-story-caption {
        font-size: 9px;
    }
    .profile-add-story-btn {
        padding: 3px 8px;
        font-size: 11px;
    }
}

/* Уважение prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .profile-add-story-btn,
    .profile-story-item,
    .profile-story-delete {
        transition: none;
    }
    .profile-add-story-btn:hover,
    .profile-story-item:hover {
        transform: none;
    }
    .profile-story-delete {
        opacity: 0; /* не показываем при наведении */
    }
    .profile-story-item:hover .profile-story-delete {
        opacity: 1; /* но если пользователь навёл, всё равно покажем, без анимации */
    }
}