/* =========================================
   GLOBAL STYLES & RESET
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5; /* Facebook style soft background */
    color: #1c1e21;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: #1877f2;
}

/* =========================================
   HEADER & NAVIGATION
   ========================================= */
header {
    background-color: #ffffff;
    padding: 12px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 a {
    color: #1877f2;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* Horizontal Nav Stripe (Fresh, Top, Trending) */
.horizontal-nav-stripe {
    background-color: #ffffff;
    border-bottom: 1px solid #ddd;
    margin-bottom: 30px;
}

.horizontal-nav-stripe nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

.horizontal-nav-stripe nav ul {
    display: flex;
    list-style: none;
    gap: 10px;
    padding: 10px 0;
}

.horizontal-nav-stripe nav ul li a {
    display: block;
    padding: 8px 24px;
    color: #65676b;
    font-weight: 600;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.horizontal-nav-stripe nav ul li a:hover,
.horizontal-nav-stripe nav ul li a.active {
    background-color: #e7f3ff;
    color: #1877f2;
}

/* =========================================
   CONTAINER & GRID LAYOUT
   ========================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Grid Layout for Memes */
.meme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
}

/* =========================================
   MEME CARD DESIGN
   ========================================= */
.meme-card {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid #e4e6eb;
}

.meme-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.meme-card h2, .meme-card h3 {
    padding: 15px;
    font-size: 1.2rem;
    text-align: center;
    color: #1c1e21;
    border-bottom: 1px solid #f0f2f5;
    background-color: #ffffff;
}

.meme-content-display {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000; /* Black background for videos/images */
    min-height: 200px;
    max-height: 500px;
    overflow: hidden;
}

.meme-content-display img,
.meme-content-display video,
.meme-content-display iframe {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain; /* Ensures full image is visible */
    display: block;
}

/* YouTube / Video aspect ratio fix */
.youtube-container, .video-container {
    width: 100%;
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
}

.youtube-container iframe, .video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* =========================================
   MEME INFO & DETAILS
   ========================================= */
.meme-description {
    padding: 10px 15px;
    font-size: 0.95rem;
    color: #4b4f56;
}

.meme-meta {
    padding: 10px 15px;
    font-size: 0.85rem;
    color: #8a8d91;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #f0f2f5;
}

/* =========================================
   ACTION BUTTONS (VOTE & SHARE)
   ========================================= */
.meme-actions {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    background-color: #ffffff;
    gap: 10px;
}

.vote-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border: 1px solid #e4e6eb;
    background-color: #f0f2f5;
    color: #4b4f56;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.vote-btn:hover {
    background-color: #e4e6eb;
}

.upvote-btn:hover {
    background-color: #e6ffe6;
    color: #1a8917;
    border-color: #1a8917;
}

.downvote-btn:hover {
    background-color: #ffe6e6;
    color: #d32f2f;
    border-color: #d32f2f;
}

.vote-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================================
   SHARE SECTION
   ========================================= */
.share-section {
    padding: 15px;
    background-color: #fafafa;
    border-top: 1px solid #f0f2f5;
    text-align: center;
}

.share-section p {
    font-size: 0.9rem;
    color: #65676b;
    margin-bottom: 10px;
    font-weight: 600;
}

.share-btns {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.share-btns a, .share-btns button {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.share-btns a:hover, .share-btns button:hover {
    opacity: 0.85;
}

.btn-fb { background-color: #1877f2; }
.btn-tw { background-color: #1da1f2; }
.btn-wa { background-color: #25d366; }
.btn-copy { background-color: #6c757d; }

/* =========================================
   COMMENTS SECTION & FORM
   ========================================= */
.meme-comments-preview, .comments-section {
    padding: 15px;
    background-color: #ffffff;
    border-top: 1px solid #f0f2f5;
}

.comment-preview-item {
    margin-bottom: 12px;
    padding: 10px;
    background-color: #f0f2f5;
    border-radius: 8px;
    font-size: 0.9rem;
}

.comment-preview-author {
    font-weight: 700;
    color: #1c1e21;
    margin-right: 8px;
}

.comment-preview-date, .comment-date {
    font-size: 0.8rem;
    color: #8a8d91;
}

.view-all-comments-link {
    display: block;
    text-align: center;
    margin-top: 10px;
    font-weight: 600;
    color: #1877f2;
    padding: 8px;
    border-radius: 6px;
    background-color: #f0f2f5;
    transition: background-color 0.2s;
}

.view-all-comments-link:hover {
    background-color: #e4e6eb;
}

/* Comment Form */
.comment-form input, .comment-form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid #ccd0d5;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.comment-form input:focus, .comment-form textarea:focus {
    outline: none;
    border-color: #1877f2;
    box-shadow: 0 0 0 2px #e7f3ff;
}

.comment-form button {
    width: 100%;
    padding: 12px;
    background-color: #1877f2;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

.comment-form button:hover {
    background-color: #166fe5;
}

/* =========================================
   SINGLE MEME PAGE (meme.php)
   ========================================= */
.single-meme-container {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 25px;
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid #e4e6eb;
}

.single-meme-container h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    text-align: center;
    color: #1c1e21;
}

/* =========================================
   FOOTER
   ========================================= */
footer {
    text-align: center;
    padding: 25px 20px;
    background-color: #ffffff;
    color: #8a8d91;
    border-top: 1px solid #e4e6eb;
    margin-top: 50px;
    font-size: 0.9rem;
}

/* =========================================
   RESPONSIVE DESIGN (Mobile Friendly)
   ========================================= */
@media (max-width: 768px) {
    .meme-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
    }
    
    header h1 a {
        font-size: 22px;
    }

    .horizontal-nav-stripe nav ul {
        gap: 5px;
    }

    .horizontal-nav-stripe nav ul li a {
        padding: 6px 15px;
        font-size: 0.9rem;
    }

    .share-btns {
        flex-direction: column;
    }

    .share-btns a, .share-btns button {
        width: 100%;
        justify-content: center;
    }
}