/**
 * Tutis Self Enrolment - Public Styles
 * 
 * Minimal, theme-compatible styling
 */

/* ==========================================================================
   Container & Base
   ========================================================================== */

.tse-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: inherit;
}

.tse-container * {
    box-sizing: border-box;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.tse-btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    text-align: center;
}

.tse-btn:hover {
    opacity: 0.9;
    text-decoration: none;
}

.tse-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tse-btn-primary {
    background-color: #0073aa;
    color: #fff;
}

.tse-btn-primary:hover {
    background-color: #005a87;
    color: #fff;
}

.tse-btn-secondary {
    background-color: #f0f0f0;
    color: #333;
}

.tse-btn-secondary:hover {
    background-color: #e0e0e0;
}

.tse-btn-large {
    padding: 15px 30px;
    font-size: 16px;
}

.tse-btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.tse-btn-block {
    display: block;
    width: 100%;
}

.tse-btn-outline {
    background-color: transparent;
    color: #0073aa;
    border: 2px solid #0073aa;
}

.tse-btn-outline:hover {
    background-color: #0073aa;
    color: #fff;
}

/* Custom color support via CSS variables */
.tse-btn[style*="--tse-btn-bg"] {
    background-color: var(--tse-btn-bg);
}

.tse-btn[style*="--tse-btn-color"] {
    color: var(--tse-btn-color);
}

/* ==========================================================================
   Course Card / Tile
   ========================================================================== */

.tse-course-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    max-width: 400px;
}

.tse-course-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.tse-card-header {
    padding: 20px 20px 12px;
    border-bottom: 1px solid #f1f5f9;
}

.tse-card-title {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.35;
    color: #1e293b;
}

.tse-card-code {
    display: inline-block;
    font-size: 12px;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.tse-card-body {
    padding: 14px 20px;
}

.tse-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    color: #475569;
    line-height: 1.4;
}

.tse-card-meta:last-child {
    margin-bottom: 0;
}

.tse-card-meta .tse-icon {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    font-size: 15px;
}

.tse-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

.tse-card-price {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.tse-card-price .tse-price-free {
    color: #16a34a;
    font-size: 16px;
}

.tse-card-footer .tse-btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 8px 20px;
}

/* Compact style */
.tse-card-compact {
    max-width: 320px;
}

.tse-card-compact .tse-card-header {
    padding: 14px 16px 8px;
}

.tse-card-compact .tse-card-title {
    font-size: 15px;
}

.tse-card-compact .tse-card-body {
    padding: 8px 16px;
}

.tse-card-compact .tse-card-meta {
    font-size: 13px;
    margin-bottom: 6px;
}

.tse-card-compact .tse-card-footer {
    padding: 12px 16px;
}

.tse-card-compact .tse-card-price {
    font-size: 17px;
}

/* Detailed style */
.tse-card-detailed {
    max-width: 480px;
}

.tse-card-detailed .tse-card-header {
    padding: 24px 24px 14px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.tse-card-detailed .tse-card-title {
    font-size: 19px;
}

.tse-card-detailed .tse-card-body {
    padding: 18px 24px;
}

.tse-card-detailed .tse-card-footer {
    padding: 18px 24px;
}

.tse-card-detailed .tse-card-price {
    font-size: 22px;
}

/* ==========================================================================
   Notices & Alerts
   ========================================================================== */

.tse-notice {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.tse-notice-warning {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.tse-notice-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.tse-notice-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.tse-notice-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* ==========================================================================
   Spinner & Loading
   ========================================================================== */

.tse-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: tse-spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

.tse-spinner-large {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

@keyframes tse-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tse-courses-loading,
.tse-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* ==========================================================================
   Filters
   ========================================================================== */

.tse-filters {
    width: 100%;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.tse-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.tse-filter-row:last-child {
    margin-bottom: 0;
}

.tse-filter-group {
    flex: 1;
    min-width: 150px;
}

.tse-filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 13px;
}

.tse-filter-group select,
.tse-filter-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.tse-filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

/* ==========================================================================
   Selected Courses
   ========================================================================== */

.tse-selected-courses {
    background: #e7f5ff;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #b3d9f7;
}

.tse-selected-courses h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
}

#tse-selected-list {
    margin-bottom: 15px;
}

.tse-selected-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #fff;
    margin-bottom: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.tse-selected-item:last-child {
    margin-bottom: 0;
}

.tse-selected-item-info {
    flex: 1;
}

.tse-selected-item-title {
    font-weight: 500;
    margin-bottom: 3px;
}

.tse-selected-item-meta {
    font-size: 12px;
    color: #666;
}

.tse-selected-item-price {
    font-weight: 600;
    margin-right: 15px;
}

.tse-selected-item-remove {
    background: none;
    border: none;
    color: #dc3232;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    line-height: 1;
}

.tse-selected-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #b3d9f7;
    margin-top: 15px;
}

.tse-total {
    font-size: 16px;
}

.tse-total strong {
    font-size: 20px;
    color: #0073aa;
}

/* ==========================================================================
   Course Table
   ========================================================================== */

.tse-courses-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.tse-courses-table thead {
    background: #f5f5f5;
}

.tse-courses-table th,
.tse-courses-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.tse-courses-table th {
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    color: #666;
}

.tse-courses-table tbody tr:hover {
    background-color: #f9f9f9;
}

.tse-courses-table tbody tr:last-child td {
    border-bottom: none;
}

.tse-course-title {
    font-weight: 500;
}

.tse-course-code {
    font-size: 12px;
    color: #666;
}

.tse-course-fee {
    font-weight: 600;
    color: #0073aa;
}

.tse-course-fee.free {
    color: #46b450;
}

.tse-places-available {
    color: #46b450;
}

.tse-places-limited {
    color: #f0ad4e;
}

.tse-places-full {
    color: #dc3232;
}

.tse-no-courses {
    text-align: center;
    padding: 40px;
    color: #666;
    background: #f9f9f9;
    border-radius: 4px;
}

.tse-courses-error {
    text-align: center;
    padding: 20px;
    color: #721c24;
    background: #f8d7da;
    border-radius: 4px;
}

/* ==========================================================================
   Enrolment Form
   ========================================================================== */

.tse-enrolment-summary {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 30px;
}

.tse-enrolment-summary h3 {
    margin: 0 0 15px 0;
}

.tse-course-summary {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tse-course-summary li {
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 8px;
}

.tse-course-summary li:last-child {
    margin-bottom: 0;
}

.tse-course-meta {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 3px;
}

.tse-summary-total {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    text-align: right;
    font-size: 18px;
}

.tse-summary-total strong {
    color: #0073aa;
}

/* Form Sections */
.tse-form-section {
    background: #fff;
    padding: 25px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
}

.tse-form-section h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
}

.tse-form-section p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}

/* Form Fields */
.tse-field {
    margin-bottom: 20px;
}

.tse-field:last-child {
    margin-bottom: 0;
}

.tse-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.tse-required {
    color: #dc3232;
    margin-left: 2px;
}

.tse-field input[type="text"],
.tse-field input[type="email"],
.tse-field input[type="tel"],
.tse-field input[type="number"],
.tse-field input[type="date"],
.tse-field select,
.tse-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.tse-field input:focus,
.tse-field select:focus,
.tse-field textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.tse-field input.error,
.tse-field select.error {
    border-color: #dc3232;
}

.tse-help-text {
    font-size: 12px;
    color: #666;
    margin: 5px 0 0 0;
}

.tse-field-error {
    display: none;
    font-size: 12px;
    color: #dc3232;
    margin-top: 5px;
}

.tse-field.has-error .tse-field-error {
    display: block;
}

/* Checkbox Group */
.tse-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.tse-checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
    cursor: pointer;
}

.tse-checkbox-label input {
    margin: 0;
}

/* File Upload */
.tse-field-file input[type="file"] {
    padding: 10px;
    background: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.tse-field-file input[type="file"]:hover {
    border-color: #0073aa;
}

/* Form Row (two columns) */
.tse-form-row {
    display: flex;
    gap: 20px;
}

.tse-form-row .tse-field {
    flex: 1;
}

/* Form Actions */
.tse-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #ddd;
    margin-top: 20px;
}

.tse-error-summary {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.tse-error-summary h4 {
    margin: 0 0 10px 0;
}

.tse-error-summary ul {
    margin: 0;
    padding-left: 20px;
}

/* ==========================================================================
   Payment Page
   ========================================================================== */

#tse-payment-page {
    max-width: 600px;
    margin: 0 auto;
}

.tse-payment-summary {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 4px;
    margin-bottom: 30px;
}

.tse-payment-summary h3 {
    margin: 0 0 15px 0;
}

.tse-payment-total {
    font-size: 24px;
    font-weight: 700;
    color: #0073aa;
    text-align: center;
    padding: 20px;
    background: #fff;
    border-radius: 4px;
    margin-top: 15px;
}

.tse-stripe-container {
    background: #fff;
    padding: 25px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
}

#tse-checkout-container {
    min-height: 300px;
}

.tse-secure-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
    margin-top: 15px;
}

.tse-secure-badge svg {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   Confirmation Page
   ========================================================================== */

#tse-confirmation-page {
    max-width: 700px;
    margin: 0 auto;
}

.tse-confirmation-success,
.tse-confirmation-error,
.tse-confirmation-pending {
    text-align: center;
    padding: 40px;
    margin-bottom: 30px;
}

.tse-success-icon,
.tse-error-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 20px;
}

.tse-success-icon {
    background: #d4edda;
    color: #155724;
}

.tse-error-icon {
    background: #f8d7da;
    color: #721c24;
}

.tse-confirmation-success h2,
.tse-confirmation-error h2,
.tse-confirmation-pending h2 {
    margin: 0 0 10px 0;
}

.tse-confirmation-success p,
.tse-confirmation-error p,
.tse-confirmation-pending p {
    color: #666;
    margin: 0;
}

.tse-confirmation-details {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 4px;
    margin-bottom: 30px;
}

.tse-confirmation-details h3,
.tse-confirmation-details h4 {
    margin: 0 0 15px 0;
}

.tse-details-table {
    width: 100%;
    margin-bottom: 20px;
}

.tse-details-table th {
    text-align: left;
    padding: 8px 0;
    width: 150px;
    color: #666;
    font-weight: normal;
}

.tse-details-table td {
    padding: 8px 0;
}

.tse-enrolled-courses {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tse-enrolled-courses li {
    padding: 12px 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.tse-enrolled-courses li:last-child {
    margin-bottom: 0;
}

.tse-enrolled-courses .tse-date {
    color: #666;
    font-size: 14px;
}

.tse-payment-confirmed {
    background: #d4edda;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
    margin-top: 20px;
}

.tse-confirmation-actions {
    text-align: center;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .tse-container {
        padding: 15px;
    }
    
    .tse-filter-row {
        flex-direction: column;
    }
    
    .tse-filter-group {
        min-width: 100%;
    }
    
    .tse-filter-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .tse-filter-actions .tse-btn {
        flex: 1;
    }
    
    .tse-courses-table {
        display: block;
        overflow-x: auto;
    }
    
    .tse-selected-actions {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .tse-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .tse-form-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .tse-form-actions .tse-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .tse-selected-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .tse-selected-item-price {
        margin-right: 0;
    }
    
    .tse-btn-large {
        padding: 12px 20px;
        font-size: 14px;
    }
}
