/* ===================================
   BLOG RESPONSIVE STYLES
   Place this in: public/css/blog-responsive.css
   =================================== */

/* ========== Global Responsive Fixes ========== */
* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
}

/* ========== Typography Responsive ========== */
@media (max-width: 1200px) {
    h1, .h1 { font-size: 2rem; }
    h2, .h2 { font-size: 1.75rem; }
    h3, .h3 { font-size: 1.5rem; }
    h4, .h4 { font-size: 1.25rem; }
    h5, .h5 { font-size: 1.1rem; }
}

@media (max-width: 768px) {
    h1, .h1 { font-size: 1.75rem; }
    h2, .h2 { font-size: 1.5rem; }
    h3, .h3 { font-size: 1.25rem; }
    h4, .h4 { font-size: 1.1rem; }
    h5, .h5 { font-size: 1rem; }
    
    body {
        font-size: 14px;
    }
}

@media (max-width: 576px) {
    h1, .h1 { font-size: 1.5rem; }
    h2, .h2 { font-size: 1.25rem; }
    h3, .h3 { font-size: 1.1rem; }
    h4, .h4 { font-size: 1rem; }
    h5, .h5 { font-size: 0.95rem; }
}

/* ========== Blog Cards Responsive ========== */
.blog-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.blog-card .card-header {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
}

.blog-card img {
    transition: transform 0.3s ease;
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.blog-card:hover img {
    transform: scale(1.05);
}

/* Responsive image ratios */
.ratio-6x4 {
    --bs-aspect-ratio: 66.67%;
}

@media (max-width: 992px) {
    .ratio-6x4 {
        --bs-aspect-ratio: 70%;
    }
}

@media (max-width: 768px) {
    .ratio-6x4 {
        --bs-aspect-ratio: 75%;
    }
}

@media (max-width: 576px) {
    .ratio-6x4 {
        --bs-aspect-ratio: 80%;
    }
}

/* ========== Blog Content Responsive ========== */
.blog-post {
    font-size: 18px;
    line-height: 1.8;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 768px) {
    .blog-post {
        font-size: 16px;
        line-height: 1.7;
    }
}

@media (max-width: 576px) {
    .blog-post {
        font-size: 15px;
        line-height: 1.6;
    }
}

/* Blog content images */
.blog-post img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 1.5rem auto;
    border-radius: 0.5rem;
}

@media (max-width: 768px) {
    .blog-post img {
        margin: 1rem auto;
    }
}

/* Blog content videos and iframes */
.blog-post iframe,
.blog-post video,
.blog-post embed {
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
}

/* Blog content tables */
.blog-post table {
    width: 100%;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.5rem 0;
}

.blog-post table td,
.blog-post table th {
    padding: 0.75rem;
    white-space: nowrap;
}

@media (max-width: 576px) {
    .blog-post table td,
    .blog-post table th {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
}

/* Blog content code blocks */
.blog-post pre {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem;
    border-radius: 0.375rem;
    background: #f8f9fa;
}

@media (max-width: 576px) {
    .blog-post pre {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
}

/* Blog content lists */
.blog-post ul,
.blog-post ol {
    padding-left: 2rem;
    margin: 1rem 0;
}

@media (max-width: 576px) {
    .blog-post ul,
    .blog-post ol {
        padding-left: 1.5rem;
    }
}

/* Blog content blockquotes */
.blog-post blockquote {
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-left: 4px solid #dee2e6;
    background: #f8f9fa;
}

@media (max-width: 576px) {
    .blog-post blockquote {
        padding: 0.75rem 1rem;
        margin: 1rem 0;
    }
}

/* ========== Meta Information Responsive ========== */
.meta-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: #6c757d;
    margin: 0;
    padding: 0;
    list-style: none;
}

.meta-list li {
    display: inline-flex;
    align-items: center;
}

.meta-list li:not(:last-child)::after {
    content: "•";
    margin-left: 0.75rem;
    color: #dee2e6;
}

@media (max-width: 768px) {
    .meta-list {
        font-size: 0.8rem;
        gap: 0.5rem;
    }
    
    .meta-list li:not(:last-child)::after {
        margin-left: 0.5rem;
    }
}

@media (max-width: 576px) {
    .meta-list {
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-start;
    }
    
    .meta-list li:not(:last-child)::after {
        display: none;
    }
}

/* ========== Pagination Responsive ========== */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    padding: 0;
    margin: 0;
    list-style: none;
}

.pagination .page-item {
    margin: 0;
}

.pagination .page-link {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
}

@media (max-width: 768px) {
    .pagination .page-link {
        min-width: 36px;
        height: 36px;
        padding: 0.375rem 0.625rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 576px) {
    .pagination {
        gap: 0.25rem;
    }
    
    .pagination .page-link {
        min-width: 32px;
        height: 32px;
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .pagination .page-link svg {
        width: 16px;
        height: 16px;
    }
}

/* ========== Featured Image Responsive ========== */
.featured-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 1rem;
    margin-bottom: 2rem;
}

.featured-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

@media (max-width: 768px) {
    .featured-image-wrapper {
        border-radius: 0.75rem;
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 576px) {
    .featured-image-wrapper {
        border-radius: 0.5rem;
        margin-bottom: 1rem;
    }
}

/* ========== Container and Spacing Responsive ========== */
@media (max-width: 1200px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Reduce section padding */
    .py-10 { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
    .py-15 { padding-top: 3rem !important; padding-bottom: 3rem !important; }
    .pt-20 { padding-top: 3rem !important; }
    .pt-30 { padding-top: 3rem !important; }
    .pb-10 { padding-bottom: 2.5rem !important; }
    .pb-15 { padding-bottom: 3rem !important; }
    .mt-18 { margin-top: 3rem !important; }
}

@media (max-width: 576px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .py-10 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    .py-15 { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
    .pt-20 { padding-top: 2.5rem !important; }
    .pt-30 { padding-top: 2.5rem !important; }
    .pb-10 { padding-bottom: 2rem !important; }
    .pb-15 { padding-bottom: 2.5rem !important; }
    .mt-18 { margin-top: 2rem !important; }
}

/* ========== Grid System Responsive ========== */
.gx-6 { --bs-gutter-x: 1.5rem; }
.gy-10 { --bs-gutter-y: 2.5rem; }
.gy-16 { --bs-gutter-y: 4rem; }

@media (max-width: 768px) {
    .gx-6 { --bs-gutter-x: 1rem; }
    .gy-10 { --bs-gutter-y: 2rem; }
    .gy-16 { --bs-gutter-y: 2.5rem; }
}

@media (max-width: 576px) {
    .gx-6 { --bs-gutter-x: 0.75rem; }
    .gy-10 { --bs-gutter-y: 1.5rem; }
    .gy-16 { --bs-gutter-y: 2rem; }
}

/* ========== Admin Panel Responsive ========== */
@media (max-width: 768px) {
    .page-header-title h2 {
        font-size: 1.5rem;
    }
    
    .breadcrumb {
        font-size: 0.85rem;
        margin-bottom: 1rem !important;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.375rem;
    }
    
    .form-control,
    .form-select {
        font-size: 0.9rem;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 576px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .dataTable-input {
        font-size: 0.85rem;
    }
}

/* Admin action buttons */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

@media (max-width: 576px) {
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
}

/* ========== Utility Classes ========== */
@media (max-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
}

@media (max-width: 576px) {
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
    .text-sm-center { text-align: center !important; }
}

/* ========== Touch Device Improvements ========== */
@media (hover: none) and (pointer: coarse) {
    /* Larger tap targets for touch devices */
    a, button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .blog-card:hover {
        transform: none;
    }
    
    .blog-card:hover img {
        transform: none;
    }
}

/* ========== Print Styles ========== */
@media print {
    .pagination,
    .breadcrumb,
    .btn,
    nav,
    header,
    footer {
        display: none !important;
    }
    
    .blog-post {
        font-size: 12pt;
    }
    
    .blog-post img {
        max-width: 100%;
        page-break-inside: avoid;
    }
}

/* ========== Dark Mode Support (Optional) ========== */
@media (prefers-color-scheme: dark) {
    .blog-post pre {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .blog-post blockquote {
        background: #1a1a1a;
        border-left-color: #404040;
    }
}