/* CourseFlow v7.0 CSS - Blocksy Theme Compatible */

/* 狀態標籤 */
.cf-status-paid {
    background: #d4edda;
    color: #155724;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    border: 1px solid #c3e6cb;
}

.cf-status-pending {
    background: #fff3cd;
    color: #856404;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    border: 1px solid #ffeeba;
}

.btn-sm {
    padding: 4px 8px !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
}

/* 列表與其他樣式 (承襲 v5.0/v4.1) */
.cf-price-text {
    font-size: 1.6rem;
    font-weight: 800;
    color: #2b6cb0;
}

.cf-text-old {
    font-size: 1rem;
    color: #718096;
    font-weight: normal;
    margin-left: 8px;
}

.cf-survey-box {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    color: #2d3748;
}

.cf-survey-box h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2b6cb0;
    border-bottom: 1px solid #cbd5e0;
    padding-bottom: 10px;
}

.cf-survey-box label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.95rem;
    color: #4a5568;
}

.required-field {
    color: #e53e3e;
    font-weight: bold;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-option:hover {
    background: #f7fafc;
    border-color: #a0aec0;
}

.radio-option input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
}

.cf-survey-box select,
.cf-survey-box input[type="text"] {
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    background: #fff;
    color: #2d3748;
}

/* Blocksy Theme compatibility for list styles */
.blocksy-content .cf-description ul,
.blocksy-content .cf-description ol,
.blocksy-site .cf-description ul,
.blocksy-site .cf-description ol,
.blocksy-main .cf-description ul,
.blocksy-main .cf-description ol,
.cf-description ul,
.cf-description ol {
    margin: 1.5em 0 1.5em 2em;
    padding-left: 0;
    list-style-position: outside;
    list-style-type: disc;
    line-height: 1.6;
}

.blocksy-content .cf-description li,
.blocksy-site .cf-description li,
.blocksy-main .cf-description li,
.cf-description li {
    list-style-type: disc;
    list-style-position: outside;
    list-style-image: none;
    margin-bottom: 8px;
    padding-left: 5px;
    position: relative;
    line-height: 1.6;
    display: list-item;
}

.cf-course-banner {
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.cf-course-banner img {
    width: 100%;
    height: auto;
    max-height: 350px;
    object-fit: cover;
    display: block;
}

.cf-banner-placeholder,
.cf-default-banner {
    width: 100%;
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #a0aec0;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.cf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.cf-card {
    background: var(--theme-palette-color-6, #1E293B);
    /* Use subtle background color from Blocksy theme */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    margin: 0 auto 20px;
    border: 1px solid var(--theme-palette-color-5, #334155);
    /* Use border color from Blocksy theme */
    transition: all 0.3s ease;
    display: flex;
    flex-direction: row;
    /* Horizontal layout */
    align-items: stretch;
    /* Stretch items to fill height */
}

.cf-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
    border-color: var(--theme-palette-color-2, #60A5FA);
    /* Use alternative color on hover */
}

.cf-card-img {
    position: relative;
    overflow: hidden;
    width: 30%;
    /* Take 30% of the card width for image */
    background-color: var(--theme-palette-color-7, #0F172A);
    /* Background color for images that don't fill space */
    flex-shrink: 0;
    /* Prevent image area from shrinking */
}

.cf-card-img img,
.cf-course-image {
    width: 100%;
    height: 100%;
    min-height: 200px;
    /* Minimum height for consistency */
    object-fit: cover;
    /* Maintain aspect ratio and fill space */
    object-position: center;
    /* Center the image within the frame */
    display: block;
    transition: transform 0.3s ease;
    /* Smooth transition for hover effect */
}

.cf-card-img img:hover,
.cf-course-image:hover {
    transform: scale(1.03);
    /* Slight zoom effect on hover for better engagement */
}

/* Fallback for missing images */
.cf-card-img img[alt=""]::before,
.cf-course-image[alt=""]::before {
    content: "Course Image";
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background-color: var(--theme-palette-color-6, #1E293B);
    color: var(--theme-palette-color-3, #d9e4f4);
    font-size: 1.2rem;
    text-align: center;
}

.cf-card-img .cf-full-class {
    position: absolute;
    top: 10px;
    right: 10px;
    background: red;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
    z-index: 2;
}

.cf-card-body {
    padding: 20px;
    flex-grow: 1;
    /* Take remaining space */
    display: flex;
    flex-direction: column;
    width: 70%;
    /* Take 70% of the card width for text */
}

.cf-card h3 {
    margin: 15px 0 10px;
    color: var(--theme-palette-color-4, #F8FAFC);
    /* Use heading color from Blocksy theme */
    text-decoration: none;
    font-size: 1.3rem;
}

.cf-card h3 a {
    color: var(--theme-palette-color-4, #F8FAFC);
    /* Use heading color from Blocksy theme */
    text-decoration: none;
}

.cf-meta {
    margin: 10px 0;
    color: var(--theme-palette-color-3, #d9e4f4);
    /* Use main text color from Blocksy theme */
    font-size: 0.85rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Two columns for meta info */
    gap: 6px 10px;
    margin-bottom: 15px;
}

/* For single column layout when we have many items */
@media (max-width: 768px) {
    .cf-meta {
        grid-template-columns: 1fr;
        /* Single column on mobile */
        gap: 6px 0;
    }
}

.cf-meta-item {
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Allow items to shrink below their content size */
}

.cf-meta-item strong {
    color: var(--theme-palette-color-4, #F8FAFC);
    font-size: 0.85rem;
    margin-bottom: 2px;
    white-space: nowrap;
    /* Prevent label wrapping */
}

/* Hide empty meta items */
.cf-meta-item:empty {
    display: none;
}

.cf-course-summary {
    margin: 10px 0;
    color: var(--theme-palette-color-3, #d9e4f4);
    font-size: 0.95rem;
    line-height: 1.5;
    flex-grow: 1;
    /* Allow summary to take available space */
}

.cf-read-more {
    display: inline-block;
    margin-top: 10px;
    color: var(--theme-palette-color-1, #2872fa);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.cf-read-more:hover {
    color: var(--theme-palette-color-2, #60A5FA);
    text-decoration: underline;
}

.cf-price-box {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--theme-palette-color-5, #334155);
    /* Use border color from Blocksy theme */
}

.cf-price {
    color: var(--theme-palette-color-1, #2872fa);
    /* Use primary brand color from Blocksy theme */
    font-weight: 800;
    font-size: 1.3rem;
}

/* Adjust grid for better horizontal layout */
.cf-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* Single column for better readability */
    gap: 30px;
    margin-bottom: 50px;
}

/* Responsive image handling for different screen sizes */
@media (max-width: 768px) {
    .cf-card {
        flex-direction: column;
        /* Stack image and text on mobile */
    }

    .cf-card-img {
        width: 100%;
        /* Full width for image on mobile */
        height: 250px;
        /* Fixed height for mobile */
    }

    .cf-card-body {
        width: 100%;
        /* Full width for text on mobile */
    }

    .cf-grid {
        grid-template-columns: 1fr;
        /* Single column on mobile */
    }
}

@media (min-width: 769px) {
    .cf-card-img {
        width: 40%;
        /* Adjust image width on tablet */
    }

    .cf-card-body {
        width: 60%;
        /* Adjust text width on tablet */
    }

    .cf-grid {
        grid-template-columns: 1fr;
        /* Single column on tablet for better readability */
    }
}

@media (min-width: 1025px) {
    .cf-card-img {
        width: 30%;
        /* Image takes 30% on desktop */
    }

    .cf-card-body {
        width: 70%;
        /* Text takes 70% on desktop */
    }

    .cf-grid {
        grid-template-columns: 1fr;
        /* Single column on desktop for better readability */
    }
}

.cf-badge {
    background: #fee;
    color: #c33;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.cf-teacher-section-wrapper {
    margin-top: 40px;
}

.cf-teacher-box {
    display: flex;
    gap: 20px;
    background: var(--theme-palette-color-6, #1E293B);
    padding: 25px;
    border-radius: 12px;
    align-items: start;
    border: 1px solid var(--theme-palette-color-5, #334155);
}

.cf-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--theme-palette-color-1, #2872fa);
}

.cf-description {
    color: var(--theme-palette-color-3, #d9e4f4);
    line-height: 1.8;
    font-size: 1.05rem;
}

.cf-description h2,
.cf-description h3 {
    color: var(--theme-palette-color-4, #F8FAFC);
    margin-top: 1.5em;
    font-weight: 700;
    border-left: 4px solid var(--theme-palette-color-1, #2872fa);
    padding-left: 15px;
}

.cf-single-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    margin-top: 30px;
}

.cf-main-content {
    flex: 1 1 600px;
}

.cf-sidebar {
    flex: 0 0 350px;
}

.cf-sticky-card {
    background: var(--theme-palette-color-6, #1E293B);
    padding: 25px;
    border-radius: 12px;
    color: var(--theme-palette-color-3, #d9e4f4);
    position: sticky;
    top: 100px;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--theme-palette-color-5, #334155);
}

.cf-btn-primary {
    display: block;
    width: 100%;
    padding: 15px;
    background: var(--theme-palette-color-1, #2872fa);
    color: #fff;
    text-align: center;
    border-radius: 8px;
    font-weight: bold;
    margin-top: 20px;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
}

.cf-btn-primary:hover {
    background: var(--theme-palette-color-2, #60A5FA);
}

.cf-btn-primary:disabled {
    background: var(--theme-palette-color-5, #334155);
    cursor: not-allowed;
}

/* Spinner for form submission */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

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

/* Additional spinner styles for various sizes */
.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
}

.spinner-large {
    width: 30px;
    height: 30px;
    border: 3px solid #2b6cb0;
    border-top-color: transparent;
}

.cf-policies details,
.cf-policies-sidebar details {
    margin-bottom: 10px;
    background: var(--theme-palette-color-6, #1E293B);
    border-radius: 6px;
    border: 1px solid var(--theme-palette-color-5, #334155);
}

.cf-policies-sidebar details {
    background: var(--theme-palette-color-6, #1E293B);
    border: 1px solid var(--theme-palette-color-5, #334155);
    margin-top: 10px;
}

.cf-policies summary,
.cf-policies-sidebar summary {
    padding: 12px;
    color: var(--theme-palette-color-1, #2872fa);
    cursor: pointer;
    font-weight: bold;
    outline: none;
    background: var(--theme-palette-color-6, #1E293B);
    border-radius: 6px;
}

.cf-policy-content {
    padding: 15px;
    color: var(--theme-palette-color-3, #d9e4f4);
    line-height: 1.6;
    background: var(--theme-palette-color-6, #1E293B);
    border-radius: 0 0 6px 6px;
}

.cf-coupon-input-group {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

.cf-coupon-input-group input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    width: 100%;
}

.cf-coupon-input-group button {
    padding: 0 15px;
    background: #4a5568;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

@media (max-width: 900px) {
    .cf-single-layout {
        flex-direction: column;
    }

    .cf-sidebar {
        width: 100%;
    }

    .cf-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* Archive page layout */
#primary.content-area {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.cf-archive-section {
    margin-top: 60px;
}

.cf-teacher-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.cf-teacher-card {
    background: var(--theme-palette-color-6, #1E293B);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--theme-palette-color-5, #334155);
}

.cf-teacher-card .cf-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 15px;
    display: block;
}

.cf-teacher-card h3 {
    margin: 0;
    color: var(--theme-palette-color-4, #F8FAFC);
}