/**
 * CPHT Plugin - Public CSS Styles
 *
 * Styles for the CPHT Posts shortcode display and filtering
 */

/* ----------------------------------------
   1. CSS VARIABLES (CUSTOM PROPERTIES)
   ---------------------------------------- */
:root {
    /* Spacing values */
    --cpht-spacing-xs: 5px;
    --cpht-spacing-sm: 10px;
    --cpht-spacing-md: 20px;
    --cpht-spacing-lg: 30px;
    --cpht-spacing-xl: 40px;

    /* Colors - Update with brand colors */
    --cpht-primary-color: #0073aa;       /* Primary accent color */
    --cpht-secondary-color: #f7941d;     /* Secondary accent color */
    --cpht-text-color: #333;             /* Main text color */
    --cpht-light-text: #666;             /* Secondary text color */
    --cpht-bg-color: #fff;               /* Card background */
    --cpht-border-color: #eaeaea;        /* Border color */
    --cpht-hover-color: #f8f8f8;         /* Hover state background */

    /* Typography */
    --cpht-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --cpht-font-size-sm: 0.875rem;
    --cpht-font-size-base: 1rem;
    --cpht-font-size-md: 1.125rem;
    --cpht-font-size-lg: 1.25rem;
    --cpht-line-height: 1.6;
}

/* ----------------------------------------
   2. GENERAL CONTAINER STYLES
   ---------------------------------------- */
.cpht-posts-wrapper {
    margin-bottom: var(--cpht-spacing-lg);
    font-family: var(--cpht-font-family);
    color: var(--cpht-text-color);
    line-height: var(--cpht-line-height);
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* ----------------------------------------
   3. FILTER SECTION
   ---------------------------------------- */
.cpht-filter-section {
    background-color: #F4F4F4;
    padding: var(--cpht-spacing-md) 0;
    padding-top: 30px; /* Added top padding */
    margin-bottom: var(--cpht-spacing-lg);
    text-align: center; /* Helps with general alignment */
}

.cpht-filter-container {
    display: flex;
    align-items: center; /* Center vertically */
    justify-content: space-between; /* Space elements evenly */
    max-width: 600px; /* Limit container width for better spacing */
    margin: 0 auto; /* Center the container itself */
    padding: 0 20px; /* Add some padding so elements aren't flush with edges */
}

.cpht-filter-label {
	font-family: "Roboto Condensed", sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    background-color: #f98e2b; /* Orange background */
    color: #fff; /* White text */
    padding: 10px 15px; /* Increased padding to match the dropdown height */
    flex-shrink: 0; /* Prevent label from shrinking */
    margin: 0; /* Remove any default margins */
    display: inline-block; /* Changed from flex to inline-block */
}

.cpht-filter-wrapper {
    position: relative;
    width: 300px; /* Wider dropdown - adjust as needed */
    max-width: 100%; /* Prevent overflow on mobile */
    margin: 0; /* Remove any default margins */
   height: 46px;
}

.cpht-filter-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    padding: 12px 15px; /* Increased padding to match button */
	font-family: Roboto, sans-serif;
    font-size: var(--cpht-font-size-base);
    border: 1px solid var(--cpht-border-color);
    border-radius: 4px;
    background-color: var(--cpht-bg-color);
    cursor: pointer;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    box-sizing: border-box; /* Ensure padding is included in height calculation */
}

/* Additional style to ensure both elements have the same effective height */
.cpht-filter-select,
.cpht-filter-label {
    height: 46px; /* Set same fixed height for both elements */
    box-sizing: border-box; /* Ensure padding is included in height calculation */
    vertical-align: middle; /* Align vertically */
}

.cpht-filter-select:focus {
    outline: none;
    border-color: var(--cpht-primary-color);
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

/* ----------------------------------------
   4. GRID LAYOUT
   ---------------------------------------- */
.cpht-grid {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px; /* Negative margin for grid gutter */
}

.cpht-grid-item {
    padding: 0 15px; /* Creates gutters between items */
    margin-bottom: var(--cpht-spacing-lg);
    width: 100%;
}

/* Column variations */
.cpht-columns-1 .cpht-grid-item {
    width: 100%;
}

.cpht-columns-2 .cpht-grid-item {
    width: 50%;
}

.cpht-columns-3 .cpht-grid-item {
    width: 33.333%;
}

.cpht-columns-4 .cpht-grid-item {
    width: 25%;
}

/* ----------------------------------------
   5. CARD STYLING
   ---------------------------------------- */
.cpht-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--cpht-bg-color);
    border: none !important;
    box-shadow: none !important;
    transition: none !important;
    overflow: hidden;
    outline: none !important;
}

.cpht-card:hover,
.cpht-card:focus,
.cpht-card:active {
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
    background-color: var(--cpht-bg-color) !important;
    outline: none !important;
}

/* Make sure the card itself doesn't look clickable */
.cpht-grid-item {
    cursor: default;
}

.cpht-card-image {
    position: relative;
    width: 100%;
    margin-bottom: 0;
}

.cpht-thumbnail {
    width: 100%;
    height: 100%;
    display: block;
    margin: 0;
}

.cpht-card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.cpht-card-date {
    font-size: var(--cpht-font-size-sm);
    color: var(--cpht-light-text);
    margin-bottom: var(--cpht-spacing-sm);
    margin-top: var(--cpht-spacing-xs);
}

.cpht-label {
    font-weight: bold;
    color: var(--cpht-primary-color);
}

.cpht-card-title {
    font-size: var(--cpht-font-size-lg);
    margin-top: 0;
    margin-bottom: var(--cpht-spacing-sm);
    line-height: 1.3;
}

.cpht-card-title a {
    color: #007d89;
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
}

.cpht-card-title a:hover {
	text-decoration: none;
}

.cpht-card-excerpt {
    font-size: 1.1rem;
    color: #353434;
    flex-grow: 1;
}

/* Category links styling */
.cpht-card-categories {
    display: flex;
    flex-wrap: wrap;
    padding-top: var(--cpht-spacing-xs);
}

.cpht-category-link {
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 5px;
    padding: 3px 8px;
    background-color: #7c7c7c;
    color: #fff !important;
    border-radius: 3px;
    font-size: 0.8rem;
    text-decoration: none;
    opacity: 0.9;
    transition: all 0.2s ease;
    cursor: pointer;
}

.cpht-category-link:hover {
    opacity: 1;
    text-decoration: none;
    color: #fff !important;
    background-color: #666;
}

/* Read more styling */
.cpht-read-more {
    display: block;
    padding-top: var(--cpht-spacing-sm);
    text-align: left;
    font-size: 0.9rem;
}

.cpht-read-more-link {
    color: #f98e2b;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.cpht-read-more-link:hover {
    text-decoration: underline;
}

/* ----------------------------------------
   5.1 CARD STYLING ENHANCEMENTS
   ---------------------------------------- */
/* Card title styling */
.cpht-card-title {
    color: #007d89;
    font-size: 1.5rem;
}

/* Category link styling */
.cpht-category-link {
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 5px;
    padding: 3px 8px;
    background-color: #7c7c7c;
    color: #fff;
    border-radius: 3px;
    font-size: 0.8rem;
    text-decoration: none;
    opacity: 0.9;
}


/* ----------------------------------------
   6. PAGINATION
   ---------------------------------------- */
.cpht-pagination {
    text-align: center;
    margin-top: var(--cpht-spacing-lg);
    padding: var(--cpht-spacing-md) 0;
}

.cpht-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    border: 1px solid var(--cpht-border-color);
    border-radius: 3px;
    text-decoration: none;
    color: var(--cpht-text-color);
    transition: all 0.2s ease;
}

.cpht-pagination .page-numbers.current {
    background-color: #f98e2b;
    color: white;
    border-color: #f98e2b;
}

.cpht-pagination .page-numbers:not(.current):hover {
    background-color: #fff;
    border-color: #f98e2b;
}

/* ----------------------------------------
   7. LOADER ANIMATION
   ---------------------------------------- */
.cpht-loading {
    position: relative;
    min-height: 200px;
    opacity: 0.7;
}

.cpht-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
}

.cpht-loader span {
    display: block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--cpht-primary-color);
    animation: cpht-spin 1s ease-in-out infinite;
}

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

/* ----------------------------------------
   8. NO RESULTS
   ---------------------------------------- */
.cpht-no-results {
    text-align: center;
    padding: var(--cpht-spacing-lg);
    background-color: var(--cpht-hover-color);
    border-radius: 4px;
    color: var(--cpht-light-text);
    font-size: var(--cpht-font-size-md);
}

/* ----------------------------------------
   9. UTILITY CLASSES
   ---------------------------------------- */
.cpht-hidden {
    display: none;
}

.cpht-text-center {
    text-align: center;
}

.cpht-mb-sm {
    margin-bottom: var(--cpht-spacing-sm);
}

.cpht-mb-md {
    margin-bottom: var(--cpht-spacing-md);
}

.cpht-mb-lg {
    margin-bottom: var(--cpht-spacing-lg);
}

/* ----------------------------------------
   10. RESPONSIVE STYLES
   ---------------------------------------- */
@media screen and (max-width: 1024px) {
    .cpht-columns-4 .cpht-grid-item {
        width: 33.333%; /* 4 columns becomes 3 on medium screens */
    }
}

@media screen and (max-width: 768px) {
    .cpht-columns-3 .cpht-grid-item,
    .cpht-columns-4 .cpht-grid-item {
        width: 50%; /* 3-4 columns become 2 on tablets */
    }

    .cpht-card-title {
        font-size: var(--cpht-font-size-md);
    }

    .cpht-filter-container {
        flex-direction: column;
    }

    .cpht-filter-label {
        margin-right: 0;
        margin-bottom: var(--cpht-spacing-sm);
    }
}

@media screen and (max-width: 576px) {
    .cpht-columns-2 .cpht-grid-item,
    .cpht-columns-3 .cpht-grid-item,
    .cpht-columns-4 .cpht-grid-item {
        width: 100%; /* All become 1 column on mobile */
    }

    .cpht-filter-wrapper {
        max-width: 100%;
    }

    .cpht-card-content {
        padding: var(--cpht-spacing-sm);
    }

    .cpht-pagination .page-numbers {
        padding: 6px 10px;
        font-size: var(--cpht-font-size-sm);
    }
}

/* Make sure mobile view stacks the items properly */
@media screen and (max-width: 576px) {
    .cpht-filter-container {
        flex-direction: column;
        gap: 15px;
        justify-content: center;
    }

    .cpht-filter-wrapper {
        width: 250px; /* Slightly narrower on mobile but still wider than original */
    }
}

