/* ============================================
   BulkWay - Instagram-style Social Marketplace
   ============================================ */

:root {
    --primary-color: #0095f6;
    --primary-hover: #1877f2;
    --danger-color: #ed4956;
    --success-color: #00d26a;
    --warning-color: #ffc107;
    --bg-color: #fafafa;
    --border-color: #dbdbdb;
    --text-muted: #8e8e8e;
    --text-dark: #262626;
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-dark);
}

/* Text Gradient */
.text-gradient {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navigation */
.navbar {
    background-color: white;
    border-bottom: 1px solid var(--border-color);
    height: 60px;
}

.nav-icon {
    color: var(--text-dark);
    transition: all 0.2s ease;
    text-decoration: none;
}

.nav-icon:hover,
.nav-icon.active {
    color: var(--primary-color);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger-color);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
}

/* Avatars */
.avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
}

.avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-medium {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
}

.avatar-medium img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-large {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
}

.avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Stories */
.stories-container {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
}

.story-item {
    flex-shrink: 0;
}

.story-avatar {
    display: block;
    width: 70px;
    height: 70px;
}

.story-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.story-ring img,
.story-ring div {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid white;
}

.story-add .story-ring {
    background: var(--border-color);
}

/* Post Card */
.post-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.post-image {
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-color);
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-action {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-dark);
    transition: all 0.2s ease;
}

.btn-action:hover {
    opacity: 0.7;
}

.btn-action.active {
    color: var(--danger-color);
}

.btn-action.active .fa-bookmark {
    color: var(--danger-color) !important;
}

/* Profile Header */
.profile-header {
    background: white;
}

.profile-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-tabs {
    background: white;
}

.profile-tab {
    padding: 15px 0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-top: 1px solid transparent;
}

.profile-tab.active {
    color: var(--text-dark);
    border-top-color: var(--text-dark);
}

/* Profile Grid */
.profile-grid-item {
    display: block;
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
}

.profile-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.profile-grid-item:hover img {
    transform: scale(1.05);
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.profile-grid-item:hover .grid-overlay {
    opacity: 1;
}

/* Mobile Navigation */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--border-color);
    z-index: 1100;
}

.mobile-nav .dropup .dropdown-menu {
    bottom: 100% !important;
    top: auto !important;
    margin-bottom: 10px;
    right: 0;
    left: auto;
    position: absolute;
    width: 200px;
    /* Optional: limit width */
}

/* Chat */
.chat-container {
    height: calc(100vh - 120px);
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.chat-sidebar {
    border-right: 1px solid var(--border-color);
    height: 100%;
    overflow-y: auto;
}

.chat-messages {
    height: calc(100% - 70px);
    overflow-y: auto;
    padding: 20px;
}

.message-bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 20px;
    margin-bottom: 10px;
}

.message-sent {
    background: var(--primary-color);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message-received {
    background: var(--bg-color);
    border-bottom-left-radius: 4px;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* Forms */
.form-control:focus {
    box-shadow: none;
    border-color: var(--border-color);
}

/* Avatar Upload */
.avatar-upload-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.avatar-upload-btn:hover {
    background: var(--primary-hover);
}

/* Cards */
.card {
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Animations */
@keyframes like-animation {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

.like-animation {
    animation: like-animation 0.3s ease;
}

/* Responsive */
@media (max-width: 991px) {
    .profile-avatar {
        width: 100px;
        height: 100px;
    }

    .avatar-large {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 767px) {
    main {
        padding-bottom: 60px;
    }

    .profile-avatar {
        width: 80px;
        height: 80px;
    }

    .stories-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .post-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* Utility Classes */
.object-fit-cover {
    object-fit: cover;
}

.cursor-pointer {
    cursor: pointer;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Story Viewer */
.story-viewer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-progress {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.story-progress-bar {
    height: 100%;
    background: white;
    border-radius: 3px;
    animation: progress 5s linear forwards;
}

@keyframes progress {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

/* Панели действий (Bottom Sheets) */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 1999;
}

.drawer-overlay.show {
    display: block;
}

.comments-drawer,
.share-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    z-index: 2000;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    color: #000;
}

.comments-drawer {
    height: 75vh;
}

.share-drawer {
    padding: 20px;
}

.comments-drawer.open,
.share-drawer.open {
    transform: translateY(0);
}

@media (max-width: 991px) {

    .comments-drawer.open,
    .share-drawer.open {
        transform: translateY(-60px);
    }
}

.drawer-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

.reply-badge {
    display: none;
    background: #f0f0f0;
    padding: 8px 15px;
    font-size: 0.8rem;
    border-top: 1px solid #eee;
    justify-content: space-between;
    align-items: center;
    color: #666;
}

.reply-badge.show {
    display: flex;
}

.comment-input-area {
    padding: 15px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
    border-top: 1px solid #eee;
    background: #f8f9fa;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.comment-input-area input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 15px;
    outline: none;
}

.share-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.share-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #333;
    cursor: pointer;
}

.share-icon-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.social-wa {
    background-color: #25D366;
}

.social-tg {
    background-color: #0088cc;
}

.social-copy {
    background-color: #6c757d;
}

.social-more {
    background-color: #000;
}

.reply-item {
    margin-left: 45px;
    border-left: 2px solid #eee;
    padding-left: 10px;
}

.extra-small {
    font-size: 0.7rem;
}