/**
 * Manual Category Stats Widget CSS
 * สไตล์สำหรับ Manual Category Stats Widget
 */

.manual-category-stats-wrapper {
    width: 100%;
    padding: 0;
}

.manual-category-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(var(--columns, 3), 1fr) !important;
    gap: var(--gap, 24px) !important;
    width: 100% !important;
}

/* Fallback for editor where CSS vars might not work */
@supports not (grid-template-columns: repeat(var(--columns), 1fr)) {
    .elementor-widget-manual-category-stats .manual-category-stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 24px !important;
    }
}

/* Ensure grid displays in editor */
.elementor-widget-manual-category-stats .manual-category-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 24px !important;
    width: 100% !important;
}

.manual-category-card {
    position: relative;
    display: block !important;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible !important;
    width: 100% !important;
    max-width: 100% !important;
}

.elementor-widget-manual-category-stats .manual-category-card {
    display: block !important;
    overflow: visible !important;
    width: 100% !important;
    max-width: 100% !important;
}

.manual-category-card-inner {
    position: relative;
    display: flex !important;
    flex-direction: column;
    gap: 16px;
    padding: var(--padding-top, 24px) var(--padding-right, 24px) var(--padding-bottom, 24px) var(--padding-left, 24px);
    background: linear-gradient(135deg, rgba(39, 39, 42, 0.8) 0%, rgba(24, 24, 27, 0.9) 100%);
    backdrop-filter: blur(12px);
    border-radius: var(--border-radius, 16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: visible !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: auto !important;
    height: auto !important;
    width: 100% !important;
}

/* Link Wrapper */
.manual-category-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    width: 100%;
    height: 100%;
}

.manual-category-card-link:hover,
.manual-category-card-link:focus,
.manual-category-card-link:active {
    text-decoration: none;
    color: inherit;
    outline: none;
}

/* Ensure card with link has pointer cursor */
.manual-category-card:has(.manual-category-card-link) {
    cursor: pointer;
}


.elementor-editor-active .manual-category-card-inner {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    backdrop-filter: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex !important;
    flex-direction: column;
    overflow: visible !important;
    min-height: auto !important;
}

.manual-category-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--border-radius, 16px);
    padding: 1px;
    background: linear-gradient(135deg, rgba(222, 0, 125, 0.2), rgba(240, 90, 40, 0.2));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.manual-category-card:hover::before {
    opacity: 1;
}

.manual-category-card:hover .manual-category-card-inner {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(240, 90, 40, 0.15);
    border-color: rgba(240, 90, 40, 0.2);
}

.manual-category-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    color: #ffffff;
    font-size: 28px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.manual-category-card:hover .manual-category-icon {
    transform: scale(1.1) rotate(5deg);
}

.manual-category-icon-svg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.manual-category-icon-svg svg {
    width: 28px;
    height: 28px;
    stroke: #ffffff;
    fill: none;
}

.manual-category-icon-feather {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.manual-category-icon-feather i,
.manual-category-icon-feather .feather-icon-placeholder {
    width: 28px;
    height: 28px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fallback for Feather Icons in editor */
.elementor-editor-active .manual-category-icon-feather i {
    width: 28px;
    height: 28px;
    background: #ffffff;
    border-radius: 50%;
    position: relative;
}

.elementor-editor-active .manual-category-icon-feather i:before {
    content: "F";
    color: #ec4899;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.manual-category-icon svg {
    width: 28px;
    height: 28px;
    color: #ffffff;
    fill: currentColor;
}

.manual-category-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.manual-category-title {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    line-height: 1.3;
    font-family: 'Kanit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.manual-category-description {
    font-size: 14px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    line-height: 1.5;
    font-family: 'Kanit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.manual-category-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(222, 0, 125, 0.15) 0%, rgba(240, 90, 40, 0.15) 100%);
    border: 1px solid rgba(240, 90, 40, 0.3);
    color: #f05a28;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

.manual-category-badge span {
    font-size: 13px;
    font-weight: 500;
    color: #f05a28;
    font-family: 'Kanit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Badge Text Style */
.manual-category-badge-text {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 20px;
    background: linear-gradient(135deg, #F05A28 0%, #E85A1C 100%);
    box-shadow: 0 4px 12px rgba(240, 90, 40, 0.3);
    z-index: 10;
}

.manual-badge-label {
    font-size: 11px;
    font-weight: 300;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Kanit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    white-space: nowrap;
}

/* Rating Style */
.manual-category-rating {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.manual-rating-stars {
    display: flex;
    gap: 3px;
    align-items: center;
}

.manual-rating-star {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    position: relative;
}

.manual-rating-star svg {
    width: 20px;
    height: 20px;
    display: block;
    stroke: currentColor;
    fill: none;
}

/* Full Star */
.manual-rating-star-full {
    color: #FCD34D;
}

.manual-rating-star-full svg {
    stroke: #FCD34D;
    fill: #FCD34D;
}

/* Partial Star - Using dual layer technique for accurate partial fill */
.manual-rating-star-partial {
    position: relative;
    display: inline-flex;
    width: 22px;
    height: 22px;
}

.manual-rating-star-partial .manual-rating-star-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.manual-rating-star-partial .manual-rating-star-bg svg {
    stroke: #FCD34D;
    fill: none;
    opacity: 0.3;
}

.manual-rating-star-partial .manual-rating-star-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    clip-path: inset(0 calc(100% - var(--rating-percent, 50%)) 0 0);
}

.manual-rating-star-partial .manual-rating-star-fill svg {
    stroke: #FCD34D;
    fill: #FCD34D;
}

/* Half Star - for editor display */
.manual-rating-star-half {
    color: #FCD34D;
    position: relative;
}

.manual-rating-star-half svg {
    stroke: #FCD34D;
    fill: #FCD34D;
}

/* Empty Star - Outline Only */
.manual-rating-star-empty {
    color: #FCD34D;
}

.manual-rating-star-empty svg {
    stroke: #FCD34D;
    fill: none;
    opacity: 0.3;
}

.manual-rating-value {
    font-size: 16px;
    font-weight: 700;
    color: #FCD34D;
    font-family: 'Kanit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.5px;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .manual-category-stats-grid {
        grid-template-columns: repeat(var(--tablet-columns, 2), 1fr) !important;
    }

    .manual-category-title {
        font-size: 18px;
    }
}

/* Responsive - Mobile */
@media (max-width: 640px) {
    .manual-category-stats-grid {
        grid-template-columns: repeat(var(--mobile-columns, 1), 1fr) !important;
        gap: 12px !important;
    }

    .manual-category-card-inner {
        padding: 16px;
        gap: 12px;
    }

    .manual-category-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }

    .manual-category-icon-svg svg,
    .manual-category-icon-feather i,
    .manual-category-icon svg {
        width: 24px;
        height: 24px;
    }

    .manual-category-title {
        font-size: 16px;
    }

    .manual-category-description {
        font-size: 12px;
    }

    .manual-category-badge-text {
        top: 8px;
        right: 8px;
        padding: 6px 12px;
    }

    .manual-badge-label {
        font-size: 10px;
    }

    .manual-rating-star {
        width: 20px;
        height: 20px;
    }

    .manual-rating-star svg {
        width: 18px;
        height: 18px;
    }

    .manual-rating-value {
        font-size: 14px;
    }
}

/* Elementor Editor - Light Mode */
.elementor-editor-active .manual-category-stats-wrapper {
    background: #f3f4f6;
    padding: 16px;
    border-radius: 8px;
}

.elementor-editor-active .manual-category-card {
    text-decoration: none;
}

.elementor-editor-active .manual-category-card-inner {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    backdrop-filter: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.elementor-editor-active .manual-category-card:hover .manual-category-card-inner {
    transform: none !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-color: #d1d5db !important;
}

.elementor-editor-active .manual-category-card::before {
    display: none !important;
}

.elementor-editor-active .manual-category-icon {
    background: linear-gradient(135deg, #ec4899 0%, #f97316 100%) !important;
}

.elementor-editor-active .manual-category-title {
    color: #111827 !important;
    font-size: 16px !important;
}

.elementor-editor-active .manual-category-description {
    color: #6b7280 !important;
    font-size: 13px !important;
}

.elementor-editor-active .manual-category-badge span {
    color: #dc2626 !important;
}

.elementor-editor-active .manual-rating-value {
    color: #ea580c !important;
}

.elementor-editor-active .manual-rating-star-full,
.elementor-editor-active .manual-rating-star-half {
    color: #f59e0b !important;
}

.elementor-editor-active .manual-rating-star-full svg,
.elementor-editor-active .manual-rating-star-half svg {
    stroke: #f59e0b !important;
    fill: #f59e0b !important;
}

.elementor-editor-active .manual-rating-star-partial .manual-rating-star-bg svg {
    stroke: #f59e0b !important;
    fill: none !important;
    opacity: 0.3 !important;
}

.elementor-editor-active .manual-rating-star-partial .manual-rating-star-fill svg {
    stroke: #f59e0b !important;
    fill: #f59e0b !important;
}

.elementor-editor-active .manual-rating-star-empty {
    color: #d1d5db !important;
}

.elementor-editor-active .manual-rating-star-empty svg {
    stroke: #d1d5db !important;
    fill: none !important;
}

.elementor-editor-active .manual-category-rating {
    border-top-color: #e5e7eb !important;
}

/* Disable hover effects in editor */
.elementor-element:hover .manual-category-card:hover .manual-category-card-inner {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    transform: none !important;
}

.elementor-element:hover .manual-category-card::before {
    display: none !important;
}