/**
 * LinkedIn by Careful - Frontend Styles
 * Four beautiful layouts for displaying LinkedIn Company Page feeds
 */

/* Base Styles */
.lbc-linkedin-feed {
    width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 100%;
    overflow: hidden;
}

.lbc-feed-container {
    width: 100%;
    max-width: 100%;
}

/* Flexible container - fits into any column width */
.lbc-linkedin-feed.lbc-flexible {
    margin: 0;
    max-width: none;
}

.lbc-linkedin-feed.lbc-flexible .lbc-feed-container {
    max-width: none;
}

.lbc-error {
    padding: 15px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    text-align: center;
}

/* ============================================
   Post Items - Real LinkedIn Content
   ============================================ */
.lbc-posts-wrapper {
    width: 100%;
}

.lbc-post-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

.lbc-post-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.lbc-post-image {
    width: 100%;
    height: 240px;
    overflow: hidden;
    background: #f5f5f5;
    border-radius: 8px 8px 0 0;
}

.lbc-layout-grid .lbc-post-image {
    height: 280px;
}

.lbc-layout-cards .lbc-post-image {
    height: 260px;
}

.lbc-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.lbc-post-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.lbc-layout-grid .lbc-post-content,
.lbc-layout-cards .lbc-post-content {
    padding: 28px;
}

.lbc-post-meta {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    color: #666;
    font-size: 13px;
}

.lbc-post-date {
    color: #666;
}

.lbc-post-title {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
    color: #1a1a1a;
}

.lbc-layout-grid .lbc-post-title,
.lbc-layout-cards .lbc-post-title {
    font-size: 22px;
    margin-bottom: 16px;
}

.lbc-post-title a {
    color: #000;
    text-decoration: none;
    transition: color 0.2s ease;
}

.lbc-post-title a:hover {
    color: #0077b5;
}

.lbc-post-description {
    margin: 0 0 16px 0;
    color: #555;
    line-height: 1.7;
    flex: 1;
    font-size: 15px;
}

.lbc-layout-grid .lbc-post-description,
.lbc-layout-cards .lbc-post-description {
    font-size: 16px;
    line-height: 1.8;
}

.lbc-post-link {
    display: inline-flex;
    align-items: center;
    color: #0077b5;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: gap 0.2s ease;
    gap: 4px;
    margin-top: auto;
}

.lbc-post-link:hover {
    gap: 8px;
}

.lbc-post-link::after {
    content: '→';
}

.lbc-no-posts {
    width: 100%;
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    color: #666;
}

.lbc-no-posts p {
    margin: 0 0 20px 0;
    font-size: 16px;
}

/* Follow Section */
.lbc-follow-section {
    text-align: center;
    padding: 30px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-top: 40px;
}

.lbc-follow-section h4 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

/* Placeholder posts styling */
.lbc-post-item.lbc-placeholder {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #dee2e6;
}

.lbc-post-item.lbc-placeholder .lbc-post-title a {
    color: #0077b5;
}

/* ============================================
   Layout 1: Grid Layout
   Modern grid with hover effects
   ============================================ */
.lbc-layout-grid .lbc-posts-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

/* For wider screens, limit to 3 columns max */
@media (min-width: 1200px) {
    .lbc-layout-grid .lbc-posts-wrapper {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* For tablets, 2 columns */
@media (min-width: 768px) and (max-width: 1199px) {
    .lbc-layout-grid .lbc-posts-wrapper {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Single column for narrow containers */
@media (max-width: 600px) {
    .lbc-layout-grid .lbc-posts-wrapper {
        grid-template-columns: 1fr;
    }
}

.lbc-layout-grid .IN-widget {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.lbc-layout-grid .IN-widget:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Grid responsive */
@media (max-width: 768px) {
    .lbc-layout-grid .lbc-feed-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ============================================
   Layout 2: List Layout
   Clean vertical list with separators
   ============================================ */
.lbc-layout-list .lbc-posts-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 100%;
    margin: 0 auto;
}

/* For wide containers, limit width for better readability */
@media (min-width: 900px) {
    .lbc-layout-list .lbc-posts-wrapper {
        max-width: 800px;
    }
}

.lbc-layout-list .lbc-post-item {
    border-radius: 0;
    box-shadow: none;
    border-bottom: 1px solid #e5e5e5;
    padding: 24px 0;
    flex-direction: row;
    gap: 20px;
}

.lbc-layout-list .lbc-post-item:first-child {
    padding-top: 0;
}

.lbc-layout-list .lbc-post-item:last-child {
    border-bottom: none;
}

.lbc-layout-list .lbc-post-item:hover {
    transform: none;
    background: #f8f9fa;
    padding-left: 16px;
    padding-right: 16px;
    margin-left: -16px;
    margin-right: -16px;
}

.lbc-layout-list .lbc-post-image {
    width: 180px;
    min-width: 180px;
    height: 120px;
}

@media (max-width: 600px) {
    .lbc-layout-list .lbc-post-item {
        flex-direction: column;
        gap: 12px;
    }

    .lbc-layout-list .lbc-post-image {
        width: 100%;
        height: 200px;
    }
}

.lbc-layout-list .IN-widget {
    padding: 24px 0;
    border-bottom: 1px solid #e5e5e5;
    background: transparent;
    transition: background-color 0.2s ease;
}

.lbc-layout-list .IN-widget:first-child {
    padding-top: 0;
}

.lbc-layout-list .IN-widget:last-child {
    border-bottom: none;
}

.lbc-layout-list .IN-widget:hover {
    background-color: #f8f9fa;
    padding-left: 16px;
    padding-right: 16px;
    margin-left: -16px;
    margin-right: -16px;
    border-radius: 8px;
}

/* ============================================
   Layout 3: Cards Layout
   Elegant cards with LinkedIn brand colors
   ============================================ */
.lbc-layout-cards {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    padding: 20px;
    border-radius: 16px;
}

.lbc-layout-cards .lbc-posts-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Single column for narrow containers */
@media (max-width: 600px) {
    .lbc-layout-cards .lbc-posts-wrapper {
        grid-template-columns: 1fr;
    }
}

.lbc-layout-cards .lbc-post-item {
    border: 2px solid transparent;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, #0077b5, #00a0dc) border-box;
}

.lbc-layout-cards .lbc-post-item:hover {
    border-color: #0077b5;
    box-shadow: 0 8px 32px rgba(0, 119, 181, 0.2);
}

.lbc-layout-cards .IN-widget {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 119, 181, 0.1);
    padding: 24px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.lbc-layout-cards .IN-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0077b5, #00a0dc);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lbc-layout-cards .IN-widget:hover {
    border-color: #0077b5;
    box-shadow: 0 8px 32px rgba(0, 119, 181, 0.2);
    transform: scale(1.02);
}

.lbc-layout-cards .IN-widget:hover::before {
    opacity: 1;
}

/* Cards responsive */
@media (max-width: 768px) {
    .lbc-layout-cards {
        padding: 16px;
    }

    .lbc-layout-cards .lbc-feed-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ============================================
   Layout 4: Minimal Layout
   Ultra-clean, content-focused design
   ============================================ */
.lbc-layout-minimal .lbc-posts-wrapper {
    max-width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* For wide containers, limit width for better readability */
@media (min-width: 800px) {
    .lbc-layout-minimal .lbc-posts-wrapper {
        max-width: 680px;
    }
}

.lbc-layout-minimal .lbc-post-item {
    box-shadow: none;
    border-radius: 0;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 32px;
}

.lbc-layout-minimal .lbc-post-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.lbc-layout-minimal .lbc-post-item:hover {
    transform: none;
    box-shadow: none;
}

.lbc-layout-minimal .lbc-post-content {
    padding: 0;
}

.lbc-layout-minimal .lbc-post-image {
    margin-bottom: 16px;
    border-radius: 8px;
}

.lbc-layout-minimal .IN-widget {
    background: transparent;
    border: none;
    padding: 32px 0;
    position: relative;
}

.lbc-layout-minimal .IN-widget::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #0077b5, transparent);
}

.lbc-layout-minimal .IN-widget:last-child::after {
    display: none;
}

/* ============================================
   LinkedIn Widget Customization
   Style the embedded LinkedIn widgets
   ============================================ */
.lbc-linkedin-feed .IN-widget {
    width: 100% !important;
    max-width: 100% !important;
}

.lbc-linkedin-feed .IN-widget iframe {
    width: 100% !important;
    max-width: 100% !important;
    border: none !important;
}

.lbc-linkedin-feed .IN-widget > div {
    width: 100% !important;
    max-width: 100% !important;
}

/* Compact mode for narrow columns */
.lbc-linkedin-feed.lbc-compact .IN-widget {
    transform: scale(0.95);
    transform-origin: top left;
}

@media (max-width: 400px) {
    .lbc-linkedin-feed.lbc-compact .IN-widget {
        transform: scale(0.9);
    }
}

/* Loading State */
.lbc-linkedin-feed .IN-widget {
    min-height: 200px;
    position: relative;
}

.lbc-linkedin-feed .IN-widget::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0077b5;
    border-radius: 50%;
    animation: lbc-spin 1s linear infinite;
}

@keyframes lbc-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Hide loading spinner once content loads */
.lbc-linkedin-feed .IN-widget.loaded::before {
    display: none;
}

/* ============================================
   Responsive Typography
   ============================================ */
@media (max-width: 480px) {
    .lbc-linkedin-feed {
        margin: 16px 0;
    }

    .lbc-layout-minimal .lbc-feed-container {
        padding: 24px 12px;
    }
}

/* ============================================
   Dark Mode Support (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    .lbc-layout-grid .IN-widget,
    .lbc-layout-cards .IN-widget {
        background: #1a1a1a;
        color: #e5e5e5;
    }

    .lbc-layout-list .IN-widget {
        border-bottom-color: #333;
    }

    .lbc-layout-list .IN-widget:hover {
        background-color: #2a2a2a;
    }

    .lbc-layout-cards {
        background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    }
}

/* ============================================
   Accessibility Improvements
   ============================================ */
.lbc-linkedin-feed *:focus {
    outline: 2px solid #0077b5;
    outline-offset: 2px;
}

.lbc-linkedin-feed a {
    color: #0077b5;
    text-decoration: none;
    transition: color 0.2s ease;
}

.lbc-linkedin-feed a:hover {
    color: #005582;
    text-decoration: underline;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .lbc-layout-grid .lbc-feed-container,
    .lbc-layout-cards .lbc-feed-container {
        display: block;
    }

    .lbc-linkedin-feed .IN-widget {
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
}
