/**
 * Lesson Page Styles
 * Styles for single-lesson.php and archive-lesson.php templates
 *
 * @package Teachers_Planit
 */

/* Single Lesson - Header */
.lesson-header {
    background: linear-gradient(135deg, rgba(132, 88, 179, 0.1), rgba(160, 210, 235, 0.1));
}

.lesson-header.has-background-image {
    position: relative;
    background: none;
    color: var(--tp-white);
}

.lesson-header-background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.lesson-header-background-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.lesson-header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(132, 88, 179, 0.85) 0%, rgba(160, 210, 235, 0.85) 100%);
    z-index: 1;
}

.lesson-header.has-background-image .container {
    position: relative;
    z-index: 2;
}

.lesson-header .lesson-title {
    font-size: 3rem;
    margin-bottom: 20px;
}

.lesson-header.has-background-image .lesson-title {
    color: var(--tp-white);
}

.lesson-header .lesson-excerpt {
    font-size: 20px;
    color: var(--tp-gray);
    margin-bottom: 30px;
}

.lesson-header.has-background-image .lesson-excerpt {
    color: rgba(255, 255, 255, 0.95);
}

/* Price Styling - WooCommerce Product Style */
.lesson-price-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.lesson-price {
    font-size: 32px;
    font-weight: 700;
    color: var(--tp-primary);
}

.lesson-price del {
    color: var(--tp-gray);
    font-size: 24px;
    margin-right: 8px;
    opacity: 0.7;
}

.lesson-price ins {
    text-decoration: none;
    color: var(--tp-primary);
}

.lesson-sale-badge {
    background-color: var(--tp-primary);
    color: var(--tp-white);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lesson-header.has-background-image .lesson-price-wrapper {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    display: inline-flex;
    padding: 16px 24px;
    border-radius: 12px;
}

.lesson-header.has-background-image .lesson-price {
    color: var(--tp-white);
}

.lesson-header.has-background-image .lesson-price del {
    color: rgba(255, 255, 255, 0.7);
}

.lesson-header.has-background-image .lesson-sale-badge {
    background-color: var(--tp-white);
    color: var(--tp-primary);
}

/* Lesson CTAs */
.lesson-ctas {
    background-color: var(--tp-white);
    border-top: 1px solid var(--tp-light);
    border-bottom: 1px solid var(--tp-light);
}

.lesson-ctas .btn-primary {
    width: 100%;
    text-align: center;
    font-size: 18px;
    padding: 18px 32px;
    display: block;
}

/* Add to Cart Button - WooCommerce Style */
.add-to-cart-button {
    position: relative;
    overflow: hidden;
}

.add-to-cart-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.add-to-cart-button:hover::before {
    left: 100%;
}

.add-to-cart-button i {
    margin-right: 8px;
    transition: transform 0.3s ease;
}

.add-to-cart-button:hover i {
    transform: scale(1.1);
}

/* Lesson Dropdown Menu */
.lesson-dropdown-wrapper {
    margin-top: 20px;
    position: relative;
}


.lesson-dropdown-menu {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    background: var(--tp-white);
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}

.lesson-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Backdrop for dropdown */
.lesson-dropdown-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

.lesson-dropdown-backdrop.show {
    display: block;
}

.lesson-dropdown-menu a {
    display: block;
    padding: 20px 24px;
    color: var(--tp-dark);
    text-decoration: none;
    border-bottom: 1px solid var(--tp-light);
    transition: background-color 0.3s ease;
}

.lesson-dropdown-menu a:last-child {
    border-bottom: none;
}

.lesson-dropdown-menu a:hover {
    background-color: var(--tp-light);
}

.lesson-dropdown-menu a strong {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--tp-primary);
    margin-bottom: 6px;
}

.lesson-dropdown-menu a span {
    font-size: 14px;
    color: var(--tp-gray);
}

.lesson-cta-note {
    margin-top: 30px;
    padding: 20px;
    background-color: var(--tp-light);
    border-radius: 8px;
}

.lesson-cta-note p {
    margin: 0;
    color: var(--tp-gray);
}

/* Lesson Content */
.lesson-content .entry-content {
    font-size: 18px;
    line-height: 1.8;
}

/* Lesson Taxonomies Section */
.lesson-taxonomies {
    background-color: var(--tp-white);
}

.lesson-taxonomies h2 {
    font-size: 2.25rem;
    text-align: center;
}

.taxonomy-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

/* Responsive: Tablet */
@media (max-width: 1024px) {
    .taxonomy-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive: Mobile */
@media (max-width: 767px) {
    .taxonomy-grid {
        grid-template-columns: 1fr;
    }
}

.taxonomy-item {
    background: var(--tp-light);
    padding: 30px;
    border-radius: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.taxonomy-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.taxonomy-item h3 {
    color: var(--tp-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.taxonomy-item h3 i {
    font-size: 22px;
}

.taxonomy-terms {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.taxonomy-tag {
    display: inline-block;
    padding: 8px 16px;
    background: var(--tp-white);
    color: var(--tp-dark);
    border: 1px solid var(--tp-primary);
    border-radius: 20px;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.taxonomy-tag:hover {
    background: var(--tp-primary);
    color: var(--tp-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* What's Included Section */
.lesson-includes {
    background-color: var(--tp-light);
}

.lesson-includes h2 {
    font-size: 2.25rem;
}

.lesson-includes > .container > div {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

/* Responsive: Tablet */
@media (max-width: 1024px) {
    .lesson-includes > .container > div {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive: Mobile */
@media (max-width: 767px) {
    .lesson-includes > .container > div {
        grid-template-columns: 1fr;
    }
}

.lesson-includes .include-item {
    background: var(--tp-white);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
}

.lesson-includes .include-item > div {
    font-size: 3rem;
}

.lesson-includes .include-item p {
    color: var(--tp-gray);
    margin: 0;
}

/* Consultation CTA */
.lesson-consultation-cta {
    text-align: center;
}

.lesson-consultation-cta p {
    font-size: 1.2rem;
    color: var(--tp-gray);
}

.lesson-consultation-cta .btn-secondary {
    font-size: 1.2rem;
    padding: 18px 40px;
}

/* Related Lessons */
.related-lessons {
    background-color: var(--tp-light);
}

/* (Common .lesson-thumbnail and .service-card styles moved to style.css) */

/* Archive Lesson - Header */
.archive-header {
    background: linear-gradient(135deg, var(--tp-primary), var(--tp-secondary));
    color: var(--tp-white);
    text-align: center;
}

.archive-header h1 {
    font-size: 3rem;
    margin-bottom: 20px;
}

.archive-header p {
    font-size: 20px;
    opacity: 0.95;
}

/* Lessons Grid */
/* (Common .lesson-thumbnail and .service-card styles moved to style.css) */

.lessons-grid .lesson-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--tp-primary);
    margin: 16px 0;
}

/* ============================================
   Shop List View - 3 Column Layout
   ============================================ */

/* Hide list-only content in grid view */
.product-loop-teacher,
.product-loop-tags,
.product-action-price {
    display: none;
}

/* Override Kadence: true 3-column grid, all mid-aligned */
.woocommerce ul.products.products-list-view li.product {
    display: grid !important;
    grid-template-columns: 250px 1fr auto !important;
    gap: 24px;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--tp-light);
}

/* Col 1: Image */
.woocommerce ul.products.products-list-view li.product > a:first-child {
    width: 250px;
}

.woocommerce ul.products.products-list-view li.product .attachment-woocommerce_thumbnail {
    width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
}

/* Col 2: Product details - flex column, vertically centered */
.woocommerce ul.products.products-list-view li.product .product-details.entry-content-wrap {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 0 !important;
    text-align: left;
}

/* Col 3: Action wrap - vertically centered */
.woocommerce ul.products.products-list-view li.product .product-action-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-width: 150px;
    width: auto;
    position: static;
    opacity: 1;
    margin-top: 0;
    padding: 0;
}

/* Col 2: Title */
.woocommerce ul.products.products-list-view li.product .woocommerce-loop-product__title {
    font-size: 20px;
    margin-bottom: 0;
}

/* Col 2: Teacher */
.woocommerce ul.products.products-list-view li.product .product-loop-teacher {
    display: block;
    font-size: 14px;
    color: var(--tp-gray);
    margin-top: 4px;
}

.woocommerce ul.products.products-list-view li.product .product-loop-teacher a {
    color: var(--tp-primary);
    text-decoration: none;
}

.woocommerce ul.products.products-list-view li.product .product-loop-teacher a:hover {
    text-decoration: underline;
}

/* Col 2: Hide original price */
.woocommerce ul.products.products-list-view li.product .product-details > .price {
    display: none !important;
}

/* Col 2: Excerpt - visible and truncated to 3 lines */
.woocommerce ul.products.products-list-view li.product .product-excerpt {
    display: -webkit-box !important;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px;
    color: var(--tp-gray);
    line-height: 1.6;
    margin-top: 8px;
}

.woocommerce ul.products.products-list-view li.product .product-excerpt p {
    margin: 0;
    display: inline;
}

/* Col 2: Tags */
.woocommerce ul.products.products-list-view li.product .product-loop-tags {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.product-loop-tag {
    display: inline-block;
    padding: 5px 14px;
    background: var(--tp-light);
    color: var(--tp-gray);
    border: 1px solid transparent;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

.product-loop-tag:hover {
    background: var(--tp-primary);
    color: #ffffff;
    border-color: var(--tp-primary);
}

.woocommerce ul.products.products-list-view li.product .product-action-price {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--tp-primary);
    text-align: center;
}

/* Responsive: Tablet */
@media (max-width: 1024px) {
    .woocommerce ul.products.products-list-view li.product {
        grid-template-columns: 200px 1fr !important;
    }
}

/* Responsive: Mobile */
@media (max-width: 767px) {
    .woocommerce ul.products.products-list-view li.product {
        grid-template-columns: 1fr !important;
    }

    .woocommerce ul.products.products-list-view li.product > a:first-child {
        width: 100%;
    }

    .woocommerce ul.products.products-list-view li.product .product-action-wrap {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* No Lessons Found */
.no-lessons {
    padding: 60px 20px;
    text-align: center;
}

.no-lessons h2 {
    font-size: 32px;
    margin-bottom: 20px;
    color: var(--tp-gray);
}

.no-lessons p {
    font-size: 18px;
    color: var(--tp-gray);
    margin-bottom: 30px;
}

/* Services CTA */
.services-cta {
    background-color: var(--tp-light);
    text-align: center;
}

.services-cta h2 {
    font-size: 2.25rem;
}

.services-cta p {
    font-size: 18px;
    color: var(--tp-gray);
}

.services-cta .btn-secondary {
    font-size: 18px;
    padding: 18px 40px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================
   Custom Lesson Planning Form Section (on Product Pages)
   ============================================ */

.custom-lesson-planning-section {
    background: linear-gradient(to bottom, #f5f5f5 0%, #ffffff 100%);
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.custom-lesson-planning-section > .container {
    max-width: 1024px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

.custom-lesson-planning-section .section-header {
    margin-bottom: 40px;
}

.custom-lesson-planning-section .section-header h2 {
    color: var(--tp-primary);
}

.custom-lesson-planning-section .section-header p {
    font-size: 1.2rem;
    line-height: 1.5;
    color: var(--tp-text-gray);
    max-width: 700px;
    margin: 0 auto;
}

.custom-lesson-form-wrapper {
    max-width: 700px;
    margin: 0 auto;
}

/* Form Placeholder Styles */
.form-placeholder {
    background: var(--tp-white);
    padding: 60px 40px;
    border-radius: var(--tp-radius-lg);
    text-align: center;
    box-shadow: var(--tp-shadow-sm);
}

.form-placeholder p {
    margin-bottom: 20px;
}

.form-placeholder p:last-of-type {
    margin-bottom: 30px;
}

/* Contact Form 7 Custom Styling */
.custom-lesson-form-wrapper .wpcf7 {
    background: var(--tp-white);
    padding: 40px;
    border-radius: var(--tp-radius-lg);
    box-shadow: var(--tp-shadow-sm);
}

.custom-lesson-form-wrapper label {
    display: block;
    margin-bottom: 20px;
    font-weight: 500;
    color: var(--tp-dark);
}

/* 2-Column Form Layout */
.custom-lesson-form-2col .form-intro {
    text-align: center;
    margin-bottom: 30px;
    font-size: 16px;
    color: var(--tp-text-gray);
    line-height: 1.6;
}

.custom-lesson-form-2col .form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 0;
}

.custom-lesson-form-2col .form-row-full {
    margin-bottom: 0;
}

.custom-lesson-form-2col .form-col {
    margin-bottom: 0;
}

.custom-lesson-form-2col .form-col label {
    margin-bottom: 20px;
}

.custom-lesson-form-wrapper input[type="text"],
.custom-lesson-form-wrapper input[type="email"],
.custom-lesson-form-wrapper input[type="tel"],
.custom-lesson-form-wrapper select,
.custom-lesson-form-wrapper textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--tp-light);
    border-radius: var(--tp-radius-md);
    font-family: var(--tp-font-body);
    font-size: 16px;
    transition: border-color 0.3s ease;
    margin-top: 8px;
}

/* Darker, more visible placeholders */
.custom-lesson-form-wrapper input::placeholder,
.custom-lesson-form-wrapper textarea::placeholder,
.custom-lesson-form-wrapper select::placeholder {
    color: #666;
    opacity: 1;
}

.custom-lesson-form-wrapper input::-webkit-input-placeholder {
    color: #666;
    opacity: 1;
}

.custom-lesson-form-wrapper input::-moz-placeholder {
    color: #666;
    opacity: 1;
}

.custom-lesson-form-wrapper input:-ms-input-placeholder {
    color: #666;
    opacity: 1;
}

.custom-lesson-form-wrapper input:focus,
.custom-lesson-form-wrapper select:focus,
.custom-lesson-form-wrapper textarea:focus {
    outline: none;
    border-color: var(--tp-primary);
}

.custom-lesson-form-wrapper textarea {
    min-height: 120px;
    resize: vertical;
}

.custom-lesson-form-wrapper input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
    padding: 14px 32px;
    border-radius: var(--tp-radius-md);
    font-size: 16px;
    font-weight: 400;
    text-transform: uppercase;
    cursor: pointer;
    background-color: var(--tp-primary);
    border: 2px solid var(--tp-primary);
    color: var(--tp-white);
    transition: var(--tp-transition);
}

.custom-lesson-form-wrapper input[type="submit"]:hover {
    background-color: var(--tp-purple-hover);
    border-color: var(--tp-purple-hover);
    color: var(--tp-white);
    transform: translateY(-2px);
    box-shadow: var(--tp-shadow-md);
}

/* Success/Error Messages */
.custom-lesson-form-wrapper .wpcf7-response-output {
    margin: 20px 0 0 0;
    padding: 15px;
    border-radius: var(--tp-radius-md);
    border: none;
}

.custom-lesson-form-wrapper .wpcf7-mail-sent-ok {
    background-color: #d4edda;
    color: #155724;
}

.custom-lesson-form-wrapper .wpcf7-validation-errors,
.custom-lesson-form-wrapper .wpcf7-mail-sent-ng {
    background-color: #f8d7da;
    color: #721c24;
}

.custom-lesson-form-wrapper .wpcf7-not-valid-tip {
    color: var(--tp-error);
    font-size: 14px;
    display: block;
    margin-top: 5px;
}

/* Responsive */
@media (max-width: 767px) {
    .custom-lesson-form-wrapper .wpcf7 {
        padding: 30px 20px;
    }

    .form-placeholder {
        padding: 40px 20px;
    }

    /* Stack 2-column form on mobile */
    .custom-lesson-form-2col .form-row-2col {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* Required field asterisk styling */
.custom-lesson-form .required {
    color: var(--tp-primary);
    font-weight: 600;
    margin-left: 2px;
}

/* Form field header for radio/checkbox groups */
.custom-lesson-form .form-field-header {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #374151;
}

/* Checkbox/radio list items - full width */
.custom-lesson-form .wpcf7-list-item,
.custom-lesson-form-2col .wpcf7-list-item {
    display: block !important;
    width: 100% !important;
    margin-bottom: 8px;
    margin-right: 0 !important;
}

/* Reduce textarea height */
.custom-lesson-form textarea {
    min-height: 120px !important;
    max-height: 200px;
}
