/* General Body and Main Content (for blog.php) */
body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f2f5; /* Light gray background like social media */
    margin: 0;
    padding: 20px;
    padding-top: 80px; /* Adjust for fixed header if used */
    box-sizing: border-box;
    color: #333;
}
.blog-container {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Responsive grid */
    gap: 25px;
    padding: 10px;
}
h1 {
    text-align: center;
    color: #003261;
    margin-bottom: 30px;
    font-size: 2.5em;
}

/* Blog Post Card - Instagram-like */
.blog-post-card {
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden; /* Ensures rounded corners on media */
    display: flex;
    flex-direction: column;
}
.media-container {
    width: 100%;
    padding-top: 177.77%; /* 9:16 Aspect Ratio (16 / 9 = 1.7777) for YouTube Shorts look */
    position: relative;
    background-color: #eee;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer; /* Add a cursor pointer to indicate it's clickable */
}
.media-container img, .media-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures images/videos cover the area without distortion */
}
.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 3em;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    padding: 15px;
    pointer-events: none; /* Prevents button from interfering with click event on video */
}
.post-content {
    padding: 15px;
    flex-grow: 1; /* Allows content to take available space */
}
.post-content h2 {
    font-size: 1.5em;
    color: #003261;
    margin-bottom: 10px;
}
.post-meta {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
}
.post-meta span {
    margin-right: 15px;
}
.post-meta i {
    margin-right: 5px;
    color: #ff3c00;
}
.post-content p {
    font-size: 1em;
    line-height: 1.6;
    color: #555;
    margin-bottom: 15px;
}

/* Post Actions (Likes/Comments) */
.post-actions {
    display: flex;
    justify-content: center; /* Center the like button */
    align-items: center;
    padding: 0 15px 15px;
    border-top: 1px solid #eee;
}
.like-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #888;
    transition: color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}
.like-btn.liked {
    color: #ff3c00; /* Red for liked state */
    transform: scale(1.1);
}
.like-btn:hover {
    color: #ff3c00;
    transform: scale(1.1);
}

/* Admin Specific Styles (for blogadd.php) */
.admin-container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
    text-align: center;
}
.admin-container h1 {
    color: #003261;
    margin-bottom: 25px;
    font-size: 2.2em;
}
.message {
    margin-bottom: 20px;
    font-weight: bold;
}
.form-group {
    margin-bottom: 15px;
    text-align: left;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}
.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
}
.form-group textarea {
    min-height: 150px;
    resize: vertical;
}
.add-btn {
    background-color: #28a745;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.3s ease;
    width: 100%;
    margin-top: 10px;
}
.add-btn:hover {
    background-color: #218838;
}
hr {
    border: 0;
    height: 1px;
    background: #ccc;
    margin: 30px 0;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
table, th, td {
    border: 1px solid #ddd;
}
th, td {
    padding: 10px;
    text-align: left;
    word-wrap: break-word;
}
th {
    background-color: #003261;
    color: white;
    font-weight: bold;
}
tr:nth-child(even) {
    background-color: #f2f2f2;
}
.delete-btn {
    background-color: #dc3545;
    color: white;
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 0.85em;
}
.delete-btn:hover {
    background-color: #c82333;
}

/* Modal and Reels-like video styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: hidden; /* Hide scrollbars */
}
.modal-content {
    background-color: #000;
    margin: auto;
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
#video-player-container {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
#video-player-container video {
    max-height: 100vh; /* Fill the full viewport height */
    max-width: 100%; /* Ensure it fits the width */
    object-fit: contain; /* Contain the video within the viewport, maintaining aspect ratio */
}
.close-btn {
    color: #fff;
    font-size: 2em;
    font-weight: bold;
    position: absolute;
    top: 20px;
    right: 30px;
    cursor: pointer;
    z-index: 1001;
}
.modal-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    max-width: 80%;
}
.modal-info h3 {
    margin: 0 0 5px 0;
}
.modal-info p {
    margin: 0;
    font-size: 0.9em;
}

/* Responsive adjustments for admin table */
@media (max-width: 768px) {
    .admin-container {
        padding: 15px;
    }
    table, thead, tbody, th, td, tr {
        display: block;
    }
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        border-radius: 5px;
    }
    td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        text-align: right;
    }
    td:before {
        position: absolute;
        top: 6px;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
    }
    td:nth-of-type(1):before { content: "ID:"; }
    td:nth-of-type(2):before { content: "Title:"; }
    td:nth-of-type(3):before { content: "Author:"; }
    td:nth-of-type(4):before { content: "Date:"; }
    td:nth-of-type(5):before { content: "Action:"; }
    .delete-form {
        text-align: right;
        margin-top: 5px;
    }
}

/* Responsive adjustments for blog posts */
@media (max-width: 600px) {
    .blog-container {
        grid-template-columns: 1fr; /* Single column on small screens */
        padding: 10px;
    }
    .blog-post-card {
        margin-bottom: 15px;
    }
    h1 {
        font-size: 2em;
    }
    .post-content h2 {
        font-size: 1.3em;
    }
    .post-content p {
        font-size: 0.95em;
    }
}