/**
 * Magelan Blog Styles
 * Dark theme styles for blog module
 */

/* Base Blog Styles - Match zinc-900 gradient like contact page */
.blog-index-index,
.blog-post-view,
.blog-category-view {
    background: linear-gradient(to bottom, #18181b, #09090b);
    color: #fafafa;
    min-height: 100vh;
}

/* Hide default Magento page title on blog pages */
.blog-index-index .page-title-wrapper,
.blog-post-view .page-title-wrapper,
.blog-category-view .page-title-wrapper {
    display: none !important;
}

/* Remove Magento default button borders on blog pages */
.blog-index-index button,
.blog-post-view button,
.blog-category-view button,
.blog-index-index .action,
.blog-post-view .action,
.blog-category-view .action {
    border: none !important;
}

/* Fix button SVG display - remove extra spacing */
.blog-index-index button svg,
.blog-post-view button svg,
.blog-category-view button svg {
    display: block !important;
    vertical-align: middle !important;
}

.blog-index-index button.p-2,
.blog-post-view button.p-2,
.blog-category-view button.p-2 {
    line-height: 0 !important;
    padding: 0.5rem !important;
}

/* Override Magento default container constraints for blog pages */
.blog-index-index .columns,
.blog-post-view .columns,
.blog-category-view .columns {
    max-width: 100%;
    padding: 0;
}

.blog-index-index .column.main,
.blog-post-view .column.main,
.blog-category-view .column.main {
    max-width: 100%;
    width: 100%;
    padding: 0;
    float: none;
}

.blog-index-index .page-main,
.blog-post-view .page-main,
.blog-category-view .page-main {
    max-width: 100%;
    padding: 0;
}

/* Blog List Grid Layout Fix */
.blog-index-index .grid.lg\:grid-cols-4,
.blog-category-view .grid.lg\:grid-cols-4 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .blog-index-index .grid.lg\:grid-cols-4,
    .blog-category-view .grid.lg\:grid-cols-4 {
        grid-template-columns: 1fr 3fr !important;
    }

    .blog-index-index .grid.lg\:grid-cols-4 > .lg\:col-span-1,
    .blog-category-view .grid.lg\:grid-cols-4 > .lg\:col-span-1 {
        grid-column: 1 / 2 !important;
        order: 1 !important;
    }

    .blog-index-index .grid.lg\:grid-cols-4 > .lg\:col-span-3,
    .blog-category-view .grid.lg\:grid-cols-4 > .lg\:col-span-3 {
        grid-column: 2 / 3 !important;
        order: 2 !important;
    }
}

/* Featured Posts Grid Fix */
.blog-index-index .grid.lg\:grid-cols-3 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .blog-index-index .grid.lg\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .blog-index-index .grid.lg\:grid-cols-3 > .lg\:col-span-2 {
        grid-column: span 2 / span 2 !important;
    }

    .blog-index-index .grid.lg\:grid-cols-3 > .lg\:col-span-2 > a {
        min-height: 400px !important;
        height: 100% !important;
    }

    .blog-index-index .grid.lg\:grid-cols-3 > .space-y-6 {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
    }

    .blog-index-index .grid.lg\:grid-cols-3 > .space-y-6 > a {
        height: 190px !important;
        min-height: 190px !important;
        margin-top: 0 !important;
    }
}

/* Featured post cards - remove Magento margin overrides */
.blog-index-index .grid.lg\:grid-cols-3 a,
.blog-index-index .space-y-6 > a {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.blog-index-index .space-y-6 > a:not(:first-child) {
    margin-top: 0 !important;
}

/* Posts Grid 2 columns fix */
.blog-index-index .grid.md\:grid-cols-2,
.blog-category-view .grid.md\:grid-cols-2 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .blog-index-index .grid.md\:grid-cols-2,
    .blog-category-view .grid.md\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Blog Post View - 3 column grid (2:1 ratio) */
.blog-post-view .grid.lg\:grid-cols-3 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 3rem;
}

@media (min-width: 1024px) {
    .blog-post-view .grid.lg\:grid-cols-3 {
        grid-template-columns: 2fr 1fr !important;
    }

    .blog-post-view .grid.lg\:grid-cols-3 > .lg\:col-span-2 {
        grid-column: 1 / 2 !important;
    }

    .blog-post-view .grid.lg\:grid-cols-3 > aside {
        grid-column: 2 / 3 !important;
    }
}

/* Post item hover shadow effect */
.blog-index-index article:hover,
.blog-category-view article:hover,
.blog-index-index .grid.lg\:grid-cols-3 a:hover,
.blog-index-index .space-y-6 > a:hover {
    box-shadow: 0 20px 25px -5px rgba(245, 158, 11, 0.1),
        0 10px 10px -5px rgba(245, 158, 11, 0.04) !important;
}

.blog-index-index article.hover\:shadow-xl:hover,
.blog-category-view article.hover\:shadow-xl:hover {
    box-shadow: 0 20px 25px -5px rgba(245, 158, 11, 0.1),
        0 10px 10px -5px rgba(245, 158, 11, 0.04) !important;
}

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(to right, #f59e0b, #ea580c);
    z-index: 9999;
    transition: width 0.1s ease-out;
}

/* Hero Section */
.blog-hero {
    background: linear-gradient(to bottom, #18181b, #0a0a0a);
}

/* Search Input */
.blog-search-input {
    background-color: #18181b;
    border: 1px solid #3f3f46;
    color: #fafafa;
    transition: all 0.3s ease;
}

.blog-search-input:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.blog-search-input::placeholder {
    color: #71717a;
}

/* Cards */
.blog-card {
    background: linear-gradient(to bottom right, #27272a, #18181b);
    border-radius: 1.5rem;
    overflow: hidden;
    transition: all 0.5s ease;
}

.blog-card:hover {
    box-shadow: 0 25px 50px -12px rgba(245, 158, 11, 0.1);
    transform: translateY(-4px);
}

.blog-card-featured {
    position: relative;
    min-height: 400px;
}

.blog-card-small {
    height: 190px;
}

/* Card Overlay */
.blog-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        #0a0a0a,
        rgba(10, 10, 10, 0.5),
        transparent
    );
}

/* Category Pills */
.category-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background-color: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    transition: all 0.3s ease;
}

.category-pill:hover {
    background-color: #f59e0b;
    color: #0a0a0a;
}

/* Featured Badge */
.featured-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background-color: #f59e0b;
    color: #0a0a0a;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 9999px;
}

/* Tags */
.blog-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: #27272a;
    color: #a1a1aa;
    font-size: 0.875rem;
    border-radius: 9999px;
    transition: all 0.3s ease;
}

.blog-tag:hover {
    background-color: #f59e0b;
    color: #0a0a0a;
}

/* Sidebar */
.blog-sidebar {
    position: sticky;
    top: 2rem;
}

.sidebar-box {
    background-color: rgba(24, 24, 27, 0.5);
    border-radius: 1rem;
    padding: 1.5rem;
}

/* Newsletter Box */
.newsletter-box {
    background: linear-gradient(
        to bottom right,
        rgba(245, 158, 11, 0.2),
        rgba(234, 88, 12, 0.2)
    );
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 1rem;
    padding: 1.5rem;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background-color: #f59e0b;
    color: #0a0a0a;
    font-weight: 700;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #d97706;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background-color: #27272a;
    color: #fafafa;
    font-weight: 500;
    border-radius: 0.5rem;
    border: 1px solid #3f3f46;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: #3f3f46;
}

/* Pagination */
.blog-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.blog-pagination .page-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    background-color: #27272a;
    color: #fafafa;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.blog-pagination .page-item:hover {
    background-color: #3f3f46;
}

.blog-pagination .page-item.active {
    background-color: #f59e0b;
    color: #0a0a0a;
}

.blog-pagination .page-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Article Prose */
.prose {
    color: #d4d4d8;
    line-height: 1.75;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
    color: #fafafa;
    font-weight: 700;
    margin-top: 2em;
    margin-bottom: 1em;
}

.prose h1 {
    font-size: 2.25rem;
}
.prose h2 {
    font-size: 1.875rem;
}
.prose h3 {
    font-size: 1.5rem;
}
.prose h4 {
    font-size: 1.25rem;
}

.prose p {
    margin-bottom: 1.5em;
}

.prose a {
    color: #f59e0b;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.prose a:hover {
    color: #fbbf24;
}

.prose strong {
    color: #fafafa;
    font-weight: 600;
}

.prose ul,
.prose ol {
    margin: 1.5em 0;
    padding-left: 1.5em;
}

.prose li {
    margin-bottom: 0.5em;
}

.prose ul li::marker {
    color: #f59e0b;
}

.prose ol li::marker {
    color: #f59e0b;
}

.prose blockquote {
    border-left: 4px solid #f59e0b;
    padding-left: 1.5rem;
    margin: 1.5em 0;
    font-style: italic;
    color: #a1a1aa;
}

.prose pre {
    background-color: #18181b;
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
    margin: 1.5em 0;
}

.prose code {
    background-color: #27272a;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
    color: #fbbf24;
}

.prose pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

.prose img {
    border-radius: 1rem;
    margin: 2em 0;
}

.prose hr {
    border-color: #3f3f46;
    margin: 2em 0;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
}

.prose th,
.prose td {
    border: 1px solid #3f3f46;
    padding: 0.75rem;
    text-align: left;
}

.prose th {
    background-color: #27272a;
    font-weight: 600;
}

/* Social Share */
.social-share {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.social-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background-color: #27272a;
    color: #a1a1aa;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.social-share-btn:hover {
    background-color: #3f3f46;
    color: #fafafa;
}

/* Author Box */
.author-box {
    display: flex;
    align-items: start;
    gap: 1rem;
    padding: 1.5rem;
    background-color: #18181b;
    border-radius: 1rem;
}

.author-avatar {
    width: 4rem;
    height: 4rem;
    border-radius: 9999px;
    object-fit: cover;
}

.author-avatar-placeholder {
    width: 4rem;
    height: 4rem;
    border-radius: 9999px;
    background: linear-gradient(to bottom right, #f59e0b, #ea580c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0a0a0a;
}

/* Related Posts */
.related-posts {
    background: linear-gradient(to bottom, #18181b, #0a0a0a);
    padding: 4rem 0;
}

/* Line Clamp */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Breadcrumbs */
.blog-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #71717a;
}

.blog-breadcrumbs a {
    color: #a1a1aa;
    transition: color 0.3s ease;
}

.blog-breadcrumbs a:hover {
    color: #f59e0b;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Responsive */
@media (max-width: 1024px) {
    .blog-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .blog-card-featured {
        min-height: 300px;
    }

    .prose h1 {
        font-size: 1.875rem;
    }
    .prose h2 {
        font-size: 1.5rem;
    }
    .prose h3 {
        font-size: 1.25rem;
    }
}

/* Container */
.blog-container {
    max-width: 1560px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Grid */
.blog-grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .blog-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Empty State */
.blog-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #71717a;
}

.blog-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Loading State */
.blog-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
}

.blog-loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid #27272a;
    border-top-color: #f59e0b;
    border-radius: 9999px;
    animation: spin 1s linear infinite;
}

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

/* Blog Input Height Fixes - Override Magento defaults */
.blog-index-index input[type="text"],
.blog-index-index input[type="email"],
.blog-category-view input[type="text"],
.blog-category-view input[type="email"],
.blog-post-view input[type="text"],
.blog-post-view input[type="email"] {
    height: auto !important;
    min-height: 3rem !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
    box-sizing: border-box !important;
}

.blog-hero input[type="text"] {
    min-height: 3.5rem !important;
    padding: 1rem 1.5rem 1rem 3.5rem !important;
}

.blog-index-index input.h-12,
.blog-category-view input.h-12 {
    height: 3rem !important;
}

/* ============================================
   Blog Recent Widget Styles
   ============================================ */
.blog-recent-widget {
    background: rgba(24, 24, 27, 0.5);
    border-radius: 1rem;
    padding: 1.5rem;
}

.blog-recent-widget h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    color: #fafafa;
}

.blog-recent-widget h3 svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
    color: #f59e0b;
}

.blog-recent-widget .space-y-4 > * + * {
    margin-top: 1rem;
}

.blog-recent-widget a.group {
    display: block;
    text-decoration: none;
}

.blog-recent-widget .flex {
    display: flex;
}

.blog-recent-widget .items-start {
    align-items: flex-start;
}

.blog-recent-widget .space-x-3 > * + * {
    margin-left: 0.75rem;
}

/* Recent Widget Image - Fixed size, prevent stretching */
.blog-recent-widget img {
    width: 4rem !important;
    height: 4rem !important;
    min-width: 4rem !important;
    min-height: 4rem !important;
    max-width: 4rem !important;
    max-height: 4rem !important;
    border-radius: 0.5rem;
    object-fit: cover !important;
    flex-shrink: 0;
}

/* Recent Widget placeholder when no image */
.blog-recent-widget .w-16.h-16 {
    width: 4rem !important;
    height: 4rem !important;
    min-width: 4rem !important;
    min-height: 4rem !important;
    border-radius: 0.5rem;
    background: #27272a;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.5rem;
}

.blog-recent-widget .flex-1 {
    flex: 1;
}

.blog-recent-widget .min-w-0 {
    min-width: 0;
}

.blog-recent-widget h4 {
    font-size: 0.875rem;
    font-weight: 500;
    color: #fafafa;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.blog-recent-widget a.group:hover h4 {
    color: #fbbf24;
}

.blog-recent-widget .text-xs {
    font-size: 0.75rem;
    color: #71717a;
    margin-top: 0.25rem;
}

.blog-recent-widget .text-xs span {
    display: inline;
}

/* View All Posts link */
.blog-recent-widget > a.inline-flex {
    display: inline-flex;
    align-items: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #f59e0b;
    text-decoration: none;
    transition: color 0.3s ease;
}

.blog-recent-widget > a.inline-flex:hover {
    color: #fbbf24;
}

.blog-recent-widget > a.inline-flex svg {
    width: 1rem;
    height: 1rem;
    margin-left: 0.25rem;
}
