/**
 * Project Filter Elementor Widget Styles
 * Compatible with Astra Theme and RTL support
 */

/* Container */
.pfe-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* RTL Support */
.pfe-rtl {
    direction: rtl;
    text-align: right;
}

.pfe-rtl .pfe-filter-select,
.pfe-rtl .pfe-search-input {
    text-align: right;
}

/* Title */
.pfe-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.2;
}

@media (max-width: 768px) {
    .pfe-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }
}

/* Filters Section */
.pfe-filters {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #dcb36c;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.pfe-filter-group {
    margin-bottom: 1rem;
    padding: 0 15px;
}

.pfe-filter-group:last-child {
    margin-bottom: 0;
}

.pfe-filter-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #495057;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pfe-filter-select,
.pfe-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
    background-color: #fff;
    color: #495057;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.pfe-filter-select:focus,
.pfe-search-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.pfe-filter-select:hover,
.pfe-search-input:hover {
    border-color: #adb5bd;
}

/* Custom select arrow */
.pfe-filter-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

.pfe-rtl .pfe-filter-select {
    background-position: left 12px center;
    padding-right: 16px;
    padding-left: 40px;
}

/* Loading */
.pfe-loading {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    margin-bottom: 2rem;
}

.pfe-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: pfe-spin 1s linear infinite;
}

@keyframes pfe-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pfe-loading p {
    color: #666;
    font-size: 1rem;
    margin: 0;
}

/* Projects Grid */
.pfe-projects-grid {
    margin: 0 -15px;
}

.pfe-project-card {
    padding: 0 15px;
    margin-bottom: 30px;
}

.pfe-card-inner {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pfe-card-inner:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Card Image */
.pfe-card-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #f8f9fa;
}

.pfe-card-image a {
    display: block;
    text-decoration: none;
    height: 100%;
}

.pfe-project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.pfe-card-image:hover .pfe-project-image {
    transform: scale(1.05);
}

/* Card Content */
.pfe-card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.pfe-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    line-height: 1.3;
}

.pfe-card-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.pfe-card-title a:hover {
    color: #007cba;
}

.pfe-card-excerpt {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex-grow: 1;
}

/* Card Meta */
.pfe-card-meta {
    margin-bottom: 1.5rem;
    border-top: 1px solid #e9ecef;
    padding-top: 1rem;
}

.pfe-meta-item {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.pfe-meta-item:last-child {
    margin-bottom: 0;
}

.pfe-meta-label {
    font-weight: 600;
    color: #495057;
    margin-right: 0.5rem;
}

.pfe-rtl .pfe-meta-label {
    margin-right: 0;
    margin-left: 0.5rem;
}

.pfe-meta-value {
    color: #007cba;
    background: #e3f2fd;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-right: 0.25rem;
    display: inline-block;
}

.pfe-rtl .pfe-meta-value {
    margin-right: 0;
    margin-left: 0.25rem;
}

/* Card Action */
.pfe-card-action {
    margin-top: auto;
}

.pfe-view-button {
    display: inline-block;
    background: #dcb36c;
    color: #fff !important;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    border: 2px solid #dcb36c;
}

.pfe-view-button:hover {
    background: #c9a456;
    border-color: #c9a456;
    transform: translateY(-2px);
}

/* No Results */
.pfe-no-results {
    text-align: center;
    padding: 3rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.pfe-no-results p {
    font-size: 1.1rem;
    color: #6c757d;
    margin: 0;
}

/* Error Message */
.pfe-error-message {
    text-align: center;
    padding: 2rem;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
}

.pfe-error-content p {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.pfe-retry-button {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.pfe-retry-button:hover {
    background: #c82333;
}

/* Astra Theme Integration */
.ast-container .pfe-container {
    max-width: none;
}

.ast-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.ast-col-12,
.ast-col-lg-2,
.ast-col-lg-3,
.ast-col-lg-4,
.ast-col-lg-6,
.ast-col-lg-12,
.ast-col-md-6,
.ast-col-md-12,
.ast-col-sm-12 {
    position: relative;
    width: 100%;
    padding: 0 15px;
}

/* Large screens */
@media (min-width: 992px) {
    .ast-col-lg-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .ast-col-lg-3 { flex: 0 0 25%; max-width: 25%; }
    .ast-col-lg-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .ast-col-lg-6 { flex: 0 0 50%; max-width: 50%; }
    .ast-col-lg-12 { flex: 0 0 100%; max-width: 100%; }
}

/* Medium screens */
@media (min-width: 768px) and (max-width: 991.98px) {
    .ast-col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .ast-col-md-12 { flex: 0 0 100%; max-width: 100%; }
}

/* Small screens */
@media (max-width: 767.98px) {
    .ast-col-sm-12 { flex: 0 0 100%; max-width: 100%; }
    
    .pfe-filter-group {
        margin-bottom: 1.5rem;
    }
    
    .pfe-card-content {
        padding: 1rem;
    }
    
    .pfe-card-image {
        aspect-ratio: 1 / 1;
    }
}

/* Text alignment utilities */
.ast-text-center {
    text-align: center;
}

.ast-text-left {
    text-align: left;
}

.ast-text-right {
    text-align: right;
}

/* Animation classes */
.pfe-fade-in {
    animation: pfe-fadeIn 0.5s ease-in;
}

@keyframes pfe-fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.pfe-slide-up {
    animation: pfe-slideUp 0.3s ease-out;
}

@keyframes pfe-slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Accessibility */
.pfe-filter-select:focus,
.pfe-search-input:focus,
.pfe-view-button:focus,
.pfe-retry-button:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .pfe-card-inner {
        border: 2px solid #000;
    }
    
    .pfe-filter-select,
    .pfe-search-input {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .pfe-card-inner,
    .pfe-project-image,
    .pfe-view-button,
    .pfe-filter-select,
    .pfe-search-input {
        transition: none;
    }
    
    .pfe-spinner {
        animation: none;
        border: 4px solid #007cba;
    }
}

/* Print styles */
@media print {
    .pfe-filters,
    .pfe-loading {
        display: none;
    }
    
    .pfe-card-inner {
        box-shadow: none;
        border: 1px solid #000;
        break-inside: avoid;
    }
    
    .pfe-view-button {
        display: none;
    }
}