/*
Theme Name: NewsFlow Shorts
Description: Custom styles for the NewsFlow Shorts theme.
*/

/* General Body & Typography */
body {
    font-family: 'Arial', sans-serif; /* Or a Google Font */
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    color: #111;
    overflow: hidden; /* Hide scrollbars, Swiper will manage scrolling */
}

/* Add a class to body when menu or comments are open to prevent scrolling */
body.menu-open,
body.comments-open {
    overflow: hidden;
}


/* Header */
.site-header {
    background-color: var(--newsflow-shorts-header-bg-color, #ffffff);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px; /* Max width for content */
    margin: 0 auto;
}

.site-branding {
    flex-grow: 1; /* Pushes menu/search to sides */
    text-align: center;
}

.site-branding .custom-logo-link img {
    max-height: 40px;
    width: auto;
}

.site-title {
    margin: 0;
    font-size: 1.5em;
}

.site-title a {
    text-decoration: none;
    color: #333;
}

.menu-toggle, .search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 10px;
}

.menu-toggle .icon-bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #333;
    margin: 5px 0;
    transition: all 0.3s ease;
}

/* Off-canvas Menu */
.main-navigation {
    position: fixed;
    top: 0;
    left: -280px; /* Hidden off-screen */
    width: 250px;
    height: 100%;
    background-color: #333;
    color: #fff;
    padding-top: 60px; /* Clear space for header */
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    transition: left 0.3s ease;
    z-index: 99;
    overflow-y: auto;
}

.main-navigation.active {
    left: 0;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-navigation ul li a {
    display: block;
    padding: 15px 20px;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid #444;
}

.main-navigation ul li a:hover {
    background-color: #555;
}

/* Search Container */
.search-form-container {
    position: fixed;
    top: 60px; /* Below header */
    right: -100%; /* Hidden off-screen */
    width: 100%;
    background-color: #f9f9f9;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 98;
}

.search-form-container.active {
    right: 0;
}

.search-form {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
}

.search-field {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px 0 0 5px;
    font-size: 1em;
}

.search-submit {
    background-color: var(--newsflow-shorts-primary-color, #FF0000);
    color: #fff;
    border: none;
    padding: 10px 15px;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
}

.ajax-search-results {
    max-width: 600px;
    margin: 10px auto 0;
    background-color: #fff;
    border: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    list-style: none;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}

.ajax-search-results li a {
    display: block;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: #333;
}

.ajax-search-results li a:hover {
    background-color: #f0f0f0;
}

/* Categories Carousel */
.categories-carousel {
    position: fixed;
    top: 60px; /* Below header */
    width: 100%;
    background-color: #f9f9f9;
    padding: 10px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 90;
    white-space: nowrap; /* Keep items in a single line */
    overflow-x: auto; /* Allow horizontal scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -ms-overflow-style: none;  /* Hide scrollbar for IE and Edge */
}

.categories-carousel::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome, Safari, Opera */
}

.categories-swiper {
    width: 100%;
    height: auto;
    padding: 0 10px; /* Padding for the ends of the carousel */
}

.categories-swiper .swiper-wrapper {
    display: flex;
    justify-content: flex-start; /* Align items to the start */
    align-items: center;
}

.category-item {
    display: inline-block; /* For the scrollable list */
    text-align: center;
    margin-right: 15px; /* Spacing between categories */
    flex-shrink: 0; /* Prevent items from shrinking */
    width: 100px; /* Fixed width for each category item */
}

.category-link {
    text-decoration: none;
    color: #333;
}

.category-image {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: #ccc; /* Fallback/dummy color */
    background-size: cover;
    background-position: center;
    margin: 0 auto 5px;
    border: 2px solid var(--newsflow-shorts-primary-color, #FF0000);
}

.category-title {
    font-size: 0.9em;
    margin: 0;
    white-space: normal; /* Allow text to wrap */
    word-wrap: break-word;
}

/* Main Content Area (News Shorts Container) */
.site-content {
    margin-top: 120px; /* Space for header and category carousel */
    height: calc(100vh - 120px); /* Fill remaining viewport height */
    position: relative;
    overflow: hidden; /* Hide main body scroll */
}

.news-shorts-container {
    height: 100%;
    width: 100%;
    position: relative;
    background-color: #000; /* Black background for video-like feel */
}

.news-shorts-swiper {
    width: 100%;
    height: 100%;
}

.news-shorts-swiper .swiper-wrapper {
    flex-direction: column; /* Vertical swipe */
}

.news-short-item {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Content aligns to bottom like shorts */
    align-items: center;
    position: relative;
    background-color: #000; /* Default background */
    color: #fff;
    padding-bottom: 20px; /* Space for interaction buttons */
    box-sizing: border-box;
}

.news-short-item .news-short-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.news-short-item .news-short-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-short-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.5) 100%); /* Gradient for text readability */
    z-index: 2;
}

.news-short-content-wrapper {
    position: relative;
    z-index: 3;
    width: 90%;
    max-width: 600px;
    padding: 0 20px;
    box-sizing: border-box;
    text-align: left;
}

.news-short-title {
    font-size: 1.8em;
    margin-bottom: 10px;
    line-height: 1.2;
}

.news-short-excerpt {
    font-size: 1em;
    opacity: 0.9;
    margin-bottom: 15px;
    max-height: 4.5em; /* Limit height to 3 lines of 1.5em line-height */
    overflow: hidden;
    text-overflow: ellipsis;
}

.read-more-button {
    display: inline-block;
    background-color: var(--newsflow-shorts-primary-color, #FF0000);
    color: #fff;
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9em;
    margin-top: 10px;
}

/* Horizontal Action Buttons */
.news-short-actions {
    position: absolute;
    bottom: 20px;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 15px; /* Space between buttons */
    z-index: 4;
}

.action-button {
    background: rgba(0,0,0,0.6);
    border: none;
    color: #fff;
    padding: 10px 15px;
    border-radius: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.action-button:hover {
    background: rgba(0,0,0,0.8);
}

.action-button .dashicons {
    font-size: 1.2em;
    width: 20px;
    height: 20px;
}

/* Comments Overlay/Modal */
.comments-overlay {
    position: fixed;
    bottom: -100%; /* Hidden off-screen */
    left: 0;
    width: 100%;
    height: 70%; /* Takes up 70% of screen height */
    background-color: #fff;
    z-index: 1000; /* Above everything */
    transition: bottom 0.3s ease-in-out;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.2);
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    display: flex;
    flex-direction: column;
}

.comments-overlay.active {
    bottom: 0;
}

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.comments-header h3 {
    margin: 0;
    font-size: 1.2em;
    color: #333;
}

.close-comments {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #666;
}

.comments-list-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px 20px;
}

/* Basic Comment Styling (will inherit from WP default, but good to override) */
.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.comment-list li {
    background-color: #f9f9f9;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 5px;
}

.comment-form-container {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    background-color: #fff;
}

.comment-form-comment label, .comment-form-author label, .comment-form-email label, .comment-form-url label {
    display: block;
    font-size: 0.9em;
    margin-bottom: 5px;
    color: #555;
}

.comment-form textarea, .comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-sizing: border-box;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.form-submit input[type="submit"] {
    background-color: var(--newsflow-shorts-primary-color, #FF0000);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

/* Loading slide */
.loading-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header-inner {
        padding: 0 10px;
    }
    .site-branding .custom-logo-link img {
        max-height: 35px;
    }
    .news-short-title {
        font-size: 1.5em;
    }
    .news-short-excerpt {
        font-size: 0.9em;
    }
    .action-button {
        padding: 8px 12px;
        font-size: 0.8em;
    }
}