/**
 * Course Terms Frontend Styles
 * Styled to match LearnPress design
 */

/* Terms Selector - Main Container */
.ct-terms-selector {
    margin: 15px 0;
}

.ct-terms-selector h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

/* Term Option Card - LP Style */
.ct-term-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: var(--lp-border-radius, 3px);
    margin-bottom: 8px;
    background: #fff;
    transition: border-color 0.2s ease;
}

.ct-term-option:hover {
    border-color: var(--lp-primary-color, #ffb606);
}

.ct-term-option:last-child {
    margin-bottom: 0;
}

.ct-term-option.ct-full {
    opacity: 0.6;
    background: #fafafa;
}

/* Term Info */
.ct-term-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.ct-term-info strong {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.ct-term-date,
.ct-term-location,
.ct-term-spots {
    font-size: 12px;
    color: #666;
}

.ct-term-spots.full {
    color: #d32f2f;
    font-weight: 600;
}

/* Term Action */
.ct-term-action {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.ct-term-price {
    font-weight: 700;
    font-size: 16px;
    color: #2e7d32;
    white-space: nowrap;
}

/* Button - LP Style */
.ct-add-to-cart,
.ct-add-to-cart.lp-button {
    padding: 8px 18px !important;
    background-color: var(--lp-primary-color, #ffb606) !important;
    border: none !important;
    border-radius: var(--lp-border-radius, 3px) !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-decoration: none;
    display: inline-block;
    line-height: 1.4;
}

.ct-add-to-cart:hover,
.ct-add-to-cart.lp-button:hover {
    background-color: var(--lp-secondary-color, #e5a400) !important;
    color: #fff !important;
}

.ct-add-to-cart:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Full badge */
.ct-full-badge {
    display: inline-block;
    padding: 6px 12px;
    background: #f5f5f5;
    color: #999;
    border-radius: var(--lp-border-radius, 3px);
    font-size: 12px;
}

/* Inside LP course buttons area */
.course-buttons.course-terms-buttons {
    margin-top: 0 !important;
}

.course-buttons .ct-terms-selector {
    width: 100%;
    margin: 0;
}

/* ================================
   Other shortcodes - keep for compatibility
   ================================ */

/* Terms List (for [course_terms] shortcode) */
.ct-terms-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ct-terms-title {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.ct-no-terms,
.ct-no-registrations,
.ct-login-required {
    padding: 12px 15px;
    background: #f5f5f5;
    border-radius: var(--lp-border-radius, 3px);
    text-align: center;
    color: #666;
    font-size: 13px;
}

/* Term Card (alternative layout) */
.ct-term-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: var(--lp-border-radius, 3px);
    transition: border-color 0.2s ease;
}

.ct-term-card:hover {
    border-color: var(--lp-primary-color, #ffb606);
}

.ct-term-card.ct-term-full {
    opacity: 0.6;
    background: #fafafa;
}

.ct-term-card.ct-term-registered {
    border-color: #4caf50;
    background: #f9fff9;
}

/* Date Box */
.ct-term-card .ct-term-date {
    flex-shrink: 0;
    width: 55px;
    text-align: center;
    padding: 6px;
    background: var(--lp-primary-color, #ffb606);
    border-radius: var(--lp-border-radius, 3px);
    color: #fff;
    font-size: inherit;
}

.ct-date-day {
    display: block;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.ct-date-month {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
}

.ct-date-range {
    display: block;
    font-size: 9px;
    margin-top: 2px;
    opacity: 0.9;
}

/* Term Title */
.ct-term-title {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.ct-term-title a {
    color: inherit;
    text-decoration: none;
}

.ct-term-title a:hover {
    color: var(--lp-primary-color, #ffb606);
}

.ct-term-course {
    margin: 0 0 4px 0;
    font-size: 12px;
    color: #666;
}

.ct-term-course a {
    color: var(--lp-primary-color, #ffb606);
    text-decoration: none;
}

.ct-term-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11px;
    color: #888;
}

.ct-meta-item {
    display: flex;
    align-items: center;
    gap: 3px;
}

.ct-meta-item .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
    color: #999;
}

.ct-meta-item.ct-full {
    color: #d32f2f;
    font-weight: 600;
}

/* Registered badge */
.ct-registered-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: var(--lp-border-radius, 3px);
    font-weight: 600;
    font-size: 12px;
}

.ct-registered-badge .dashicons {
    color: #4caf50;
}

/* Registration Form */
.ct-registration-form {
    margin: 15px 0;
}

.ct-already-registered,
.ct-registration-form .ct-term-full {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--lp-border-radius, 3px);
    font-weight: 500;
    font-size: 13px;
}

.ct-already-registered {
    background: #e8f5e9;
    color: #2e7d32;
}

.ct-already-registered .dashicons {
    color: #4caf50;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.ct-registration-form .ct-term-full {
    background: #ffebee;
    color: #c62828;
}

.ct-registration-form .ct-term-full .dashicons {
    color: #ef5350;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* My Registrations Table */
.ct-my-registrations {
    overflow-x: auto;
}

.ct-registrations-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 13px;
}

.ct-registrations-table th,
.ct-registrations-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.ct-registrations-table th {
    background: #f9f9f9;
    font-weight: 600;
    color: #333;
    font-size: 12px;
}

.ct-registrations-table tr:last-child td {
    border-bottom: none;
}

.ct-registrations-table a {
    color: var(--lp-primary-color, #ffb606);
    text-decoration: none;
}

.ct-registrations-table a:hover {
    text-decoration: underline;
}

/* Status badges */
.ct-status {
    display: inline-block;
    padding: 2px 6px;
    border-radius: var(--lp-border-radius, 3px);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ct-status-registered {
    background: #e3f2fd;
    color: #1565c0;
}

.ct-status-confirmed {
    background: #e8f5e9;
    color: #2e7d32;
}

.ct-status-attended,
.ct-status-completed {
    background: #c8e6c9;
    color: #1b5e20;
}

.ct-status-cancelled,
.ct-status-no_show {
    background: #ffebee;
    color: #c62828;
}

/* Course Terms Section */
.ct-course-terms-section {
    margin: 15px 0;
}

.ct-course-terms-section h3 {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

/* Responsive */
@media (max-width: 480px) {
    .ct-term-option {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .ct-term-action {
        width: 100%;
        justify-content: space-between;
    }
    
    .ct-add-to-cart {
        flex: 1;
        text-align: center;
    }
    
    .ct-term-card {
        flex-direction: column;
        text-align: center;
    }
    
    .ct-term-card .ct-term-date {
        width: 100%;
    }
    
    .ct-term-meta {
        justify-content: center;
    }
}
