/*
Theme Name: Hello Elementor Child
Theme URI: https://github.com/elementor/hello-elementor-child
Description: Hello Elementor Child is a child theme of Hello Elementor, created for the Jewish Education Portal
Author: Your Name
Author URI: https://yoursite.com
Template: hello-elementor
Version: 1.0.0
Text Domain: hello-elementor-child
License: GNU General Public License v3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
*/

/**
 * Educational Resource Filter Styles - Clean Version
 * Simple, clean styling like earlier today
 */

/* =============================================================================
   FILTER FORM STYLES - Clean and Simple
   ============================================================================= */

.jepe-browse-form,
#grade-filter-form {
    width: 100%;
    /* background: #fff; */
    padding: 20px;
    /* border: 1px solid #ddd; */
    border-radius: 5px;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.jepe-browse-form label,
#grade-filter-form label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.jepe-browse-form select,
#grade-filter-form select,
.jepe-browse-grade,
.jepe-browse-topic {
    width: 100%;
    padding: 18px 27px 18px 18px;  /* Added extra 9px to right padding */
    border: 2px solid #ffffff;
    border-radius: 3px;
    background: #fff;
    font-size: 18px;
    margin-bottom: 9px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    -webkit-appearance: none;  /* For consistent arrow styling */
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 9px center;  /* Position arrow 9px from right */
    background-size: 16px;
}

.jepe-browse-search {
    width: 100%;
    padding: 18px;
    border: 2px solid #ffffff;
    border-radius: 3px;
    background: #fff;
    font-size: 18px;
    margin-bottom: 9px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

/* Search box when actively typing */
.jepe-browse-search:focus {
    outline: none;
    border-color: #149FDA;
    box-shadow: 0 0 5px rgba(20, 159, 218, 0.3);
}

/* Placeholder styling */
.jepe-browse-search::placeholder {
    color: #999;
    font-style: italic;
}

.jepe-browse-form select:focus,
#grade-filter-form select:focus,
.jepe-browse-form select:hover,
#grade-filter-form select:hover,
.jepe-browse-grade:hover,
.jepe-browse-grade:focus,
.jepe-browse-topic:hover,
.jepe-browse-topic:focus,
.jepe-browse-search:hover,
.jepe-browse-search:focus {
    outline: none;
    border-color: #149FDA;
    box-shadow: 0 0 3px rgba(20, 159, 218, 0.3);
}

.jepe-browse-form select:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.jepe-browse-form small {
    display: block;
    color: #666;
    font-size: 12px;
    margin-bottom: 10px;
}

/* Filter hint styling */
.jepe-filter-hint {
    display: block;
    text-align: center;
    color: #149FDA;
    font-size: 13px;
    font-style: italic;
    margin-top: 10px;
    padding: 8px;
    background: #f0f9ff;
    border-radius: 3px;
    border: 1px solid #d0e9f7;
}

/* =============================================================================
   RESULTS CONTAINER - Simple
   ============================================================================= */

.jepe-results-container,
.educational-content,
#ajax-post-results,
.jepe-selection-wrap,
#jepe-selection-results {
    width: 100%;
    margin-top: 20px;
    min-height: 50px;
    box-sizing: border-box;
}

/* Loading state - Bigger and more prominent */
.loading {
    opacity: 0.7;
}

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Main loading indicator with spinner */
.jepe-loading,
p.jepe-loading {
    text-align: center !important;
    padding: 60px 20px !important;
    font-size: 24px !important;
    color: #149FDA !important;
    font-weight: 600 !important;
    position: relative;
    margin: 40px 0 !important;
}

/* Add spinner before loading text */
.jepe-loading::before,
p.jepe-loading::before {
    content: "" !important;
    display: inline-block !important;
    width: 50px !important;
    height: 50px !important;
    margin-right: 15px !important;
    border: 6px solid #f3f3f3 !important;
    border-top: 6px solid #149FDA !important;
    border-radius: 50% !important;
    animation: spin 0.8s linear infinite !important;
    vertical-align: middle !important;
}

/* Search hint message */
.jepe-search-hint,
p.jepe-search-hint {
    text-align: center !important;
    padding: 30px 20px !important;
    font-size: 16px !important;
    color: #666 !important;
    font-style: italic;
    margin: 20px 0 !important;
    background: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: 3px;
}

/* Visual feedback when search box has focus */
.jepe-browse-search:focus + * {
    opacity: 0.5;
    pointer-events: none;
}

/* Add subtle animation when dropdowns or search are cleared */
.jepe-browse-grade,
.jepe-browse-topic,
.jepe-browse-search {
    transition: all 0.3s ease, border-color 0.2s ease;
}

/* Highlight the active filter method */
.jepe-browse-search:not(:placeholder-shown) {
    border-color: #149FDA;
    background: #f0f9ff;
}

.jepe-browse-grade:not([value=""]),
.jepe-browse-topic:not([value=""]) {
    border-color: #149FDA;
    background: #f0f9ff;
}

/* Selection Container - Full Width */
#jepe-selection {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.jepe-selection-wrap {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

#jepe-selection-results {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 20px 0;
    box-sizing: border-box;
}

/* Ensure cards in the grid take up full width of their space */
.jepe-card-grid .jepe-card {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}

/* =============================================================================
   RESULTS GRID - Clean Cards
   ============================================================================= */

.grade-post-grid,
.jepe-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Single column layout for selection results */
#jepe-selection-results.jepe-card-grid {
    grid-template-columns: 1fr;
    max-width: 100%;
}

.grade-post-grid .post-card,
.jepe-card-grid .post-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.post-card h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 18px;
}

.post-card .resource-link {
    display: inline-block;
    background: #0073aa;
    color: white;
    padding: 8px 15px;
    border-radius: 3px;
    text-decoration: none;
    margin-top: 10px;
}

.post-card .resource-link:hover {
    background: #005a87;
    color: white;
}

.post-card .grade-badges {
    margin: 10px 0;
}

/* Grade badges - unselected/inactive state (grey with opacity) */
.post-card .grade-badge,
.grade-badge,
.elementor-widget-container .grade-badge {
    display: inline-block;
    background: #999 !important;
    color: #fff !important;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-right: 5px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

/* Grade badges - active/selected state (keep original colors) */
.post-card .grade-badge.active,
.grade-badge.active,
.elementor-widget-container .grade-badge.active {
    opacity: 1 !important;
}

.post-card .topic-tags {
    margin: 10px 0;
}

.post-card .topic-tag {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-right: 5px;
}

/* =============================================================================
   WORDPRESS ADMIN OVERRIDE
   ============================================================================= */

.card {
    position: relative;
    margin-top: 20px;
    padding: .7em 2em 1em;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    border: 1px solid #c3c4c7;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    background: #fff;
    box-sizing: border-box;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 767px) {
    .jepe-browse-form,
    #grade-filter-form {
        padding: 15px;
    }
    
    .grade-post-grid,
    .jepe-card-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* =============================================================================
   CLEAN ERROR/SUCCESS MESSAGES
   ============================================================================= */

.no-results-message,
.error-message {
    text-align: center;
    padding: 20px;
    color: #666;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 3px;
    margin: 20px 0;
}

.error-message {
    color: #d63384;
    background: #f8d7da;
    border-color: #f5c6cb;
}

/* =============================================================================
   RESOURCE CARD - Additional Fields (Resource Title, Source Organization)
   ============================================================================= */

.jepe-card-resource-title,
.jepe-card-source {
    margin: 10px 0;
    padding: 8px 0;
    font-size: 14px;
    line-height: 1.5;
}

.jepe-card-resource-title strong,
.jepe-card-source strong {
    color: #149FDA;
    font-weight: 600;
}

.jepe-card-resource-title {
    border-bottom: 1px solid #f0f0f0;
}

.jepe-card-source {
    color: #666;
    font-style: italic;
}

/* Adjust spacing for card sections */
.jepe-card-grades,
.jepe-card-topics {
    margin: 8px 0;
}

.jepe-card-excerpt {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.jepe-card-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #f0f0f0;
}


