/**
 * SocialEyes Masonry Skin
 * Pinterest-style masonry grid layout
 */

.socialeyes-masonry {
    position: relative;
    width: 100%;
    background: var(--socialeyes-bg);
    box-shadow: var(--socialeyes-shadow);
    padding: 20px;
}

.socialeyes-grid {
    column-count: 3;
    column-gap: 20px;
}

.socialeyes-post {
    background: var(--socialeyes-post-bg);
    border-radius: var(--socialeyes-radius);
    overflow: hidden;
    border: 1px solid var(--socialeyes-border);
    transition: var(--socialeyes-transition);
    position: relative;
    margin-bottom: 20px;
    break-inside: avoid;
    page-break-inside: avoid;
    display: inline-block;
    width: 100%;
    cursor: pointer;
    animation: fadeInUp 0.5s ease backwards;
}

.socialeyes-post::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--socialeyes-accent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.socialeyes-post:not(:has(.socialeyes-image)) .socialeyes-text {
    font-size: 16px;
    line-height: 1.6;
    -webkit-line-clamp: 6;
}

.socialeyes-post:hover {
    transform: translateY(-4px);
    box-shadow: var(--socialeyes-shadow-hover);
}

.socialeyes-post:hover::before {
    opacity: 1;
}

.socialeyes-image {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.socialeyes-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.socialeyes-post:hover .socialeyes-image img {
    transform: scale(1.05);
}

.socialeyes-content {
    padding: 20px;
}

.socialeyes-date {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--socialeyes-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.socialeyes-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--socialeyes-text);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.socialeyes-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--socialeyes-primary);
    text-decoration: none;
    transition: var(--socialeyes-transition);
    position: relative;
}

.socialeyes-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 100%;
    height: 2px;
    background: var(--socialeyes-accent);
    transition: right 0.3s ease;
}

.socialeyes-link:hover::after {
    right: 0;
}

.socialeyes-link:hover {
    transform: translateX(4px);
}

/* Loading & Error States */
.socialeyes-loading,
.socialeyes-error {
    padding: 60px 20px;
    text-align: center;
    color: var(--socialeyes-text-secondary);
}

.socialeyes-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.socialeyes-error svg {
    color: #ef4444;
}

.socialeyes-error p {
    font-size: 16px;
    color: var(--socialeyes-text);
}

/* Modal */
.socialeyes-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.socialeyes-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.socialeyes-modal-content {
    position: relative;
    background: var(--socialeyes-bg);
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--socialeyes-border);
}

.socialeyes-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--socialeyes-transition);
    z-index: 100;
}

.socialeyes-modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.socialeyes-modal-body {
    padding: 40px;
}

.socialeyes-modal-image {
    width: 100%;
    max-height: 40vh;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 24px;
}

.socialeyes-modal-date {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--socialeyes-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.socialeyes-modal-text {
    font-size: 16px;
    line-height: 1.6;
    color: var(--socialeyes-text);
    margin-bottom: 24px;
    white-space: pre-wrap;
}

.socialeyes-modal-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--socialeyes-primary);
    text-decoration: none;
    transition: var(--socialeyes-transition);
    padding: 12px 24px;
    background: rgba(232, 105, 42, 0.1);
    border-radius: 6px;
    border: 1px solid var(--socialeyes-primary);
}

.socialeyes-modal-link:hover {
    background: var(--socialeyes-primary);
    color: white;
    transform: translateX(4px);
}

/* Responsive */
@media (max-width: 1024px) {
    .socialeyes-grid {
        column-count: 2;
    }
}

@media (max-width: 767px) {
    .socialeyes-masonry {
        padding: 16px;
    }

    .socialeyes-grid {
        column-count: 1;
        column-gap: 0;
    }

    .socialeyes-content {
        padding: 16px;
    }

    .socialeyes-text {
        font-size: 14px;
    }

    .socialeyes-modal-content {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }

    .socialeyes-modal-body {
        padding: 60px 20px 20px;
    }

    .socialeyes-modal-close {
        top: 12px;
        right: 12px;
    }
}

/* Light mode */
@media (prefers-color-scheme: light) {
    :root {
        --socialeyes-text: #1c1e21;
        --socialeyes-text-secondary: #65676b;
        --socialeyes-bg: #e3e2e1;
        --socialeyes-post-bg: #FFFFFF;
    }
}

/* Forced themes */
.socialeyes-skin-light {
    --socialeyes-text: #1c1e21;
    --socialeyes-text-secondary: #65676b;
    --socialeyes-bg: #e3e2e1;
    --socialeyes-post-bg: #FFFFFF;
}

.socialeyes-skin-dark {
    --socialeyes-text: #e4e6eb;
    --socialeyes-text-secondary: #b0b3b8;
    --socialeyes-bg: #FFFFFF;
    --socialeyes-post-bg: #4C1F2F;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0);    }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0);    }
}

.socialeyes-post:nth-child(1) { animation-delay: 0.1s; }
.socialeyes-post:nth-child(2) { animation-delay: 0.2s; }
.socialeyes-post:nth-child(3) { animation-delay: 0.3s; }
.socialeyes-post:nth-child(4) { animation-delay: 0.4s; }
.socialeyes-post:nth-child(5) { animation-delay: 0.5s; }
.socialeyes-post:nth-child(6) { animation-delay: 0.6s; }
