/**
 * TitanCourse front-end styles.
 *
 * All colors, fonts and radii come from CSS custom properties that are
 * generated from the plugin settings (TitanCourse → Settings → Design).
 * The fallbacks below match the defaults so the file also works standalone.
 */

:root {
    --tc-primary: #D11B48;
    --tc-primary-hover: #b0153b;
    --tc-secondary: #1e293b;
    --tc-secondary-hover: #0f172a;
    --tc-button-text: #ffffff;
    --tc-text: #0f172a;
    --tc-label: #080A21;
    --tc-muted: #64748b;
    --tc-subtle: #94a3b8;
    --tc-surface: #ffffff;
    --tc-surface-alt: #f8fafc;
    --tc-border: #e2e8f0;
    --tc-input-border: #E8E6E6;
    --tc-control-border: #cbd5e1;
    --tc-success: #22c55e;
    --tc-success-light: #dcfce7;
    --tc-success-text: #166534;
    --tc-badge-progress-bg: #fef08a;
    --tc-badge-progress-text: #000000;
    --tc-video-bg: #0f172a;
    --tc-font-body: 'Reddit Sans', sans-serif;
    --tc-font-heading: 'Barlow', sans-serif;
    --tc-font-lesson: 'Roboto', sans-serif;
    --tc-radius-card: 12px;
    --tc-radius-input: 0.6em;
    --tc-radius-button: 50em;
    --tc-video-ratio: 56.25%;
    --tc-video-fit: cover;
}

[x-cloak] {
    display: none !important;
}

.tc-notice {
    font-family: var(--tc-font-body);
    background: var(--tc-surface-alt);
    border: 1px solid var(--tc-border);
    border-left: 4px solid var(--tc-primary);
    border-radius: var(--tc-radius-input);
    color: var(--tc-text);
    padding: 1em 1.2em;
    margin: 1em 0;
}

/* ==========================================================================
   Course builder
   ========================================================================== */

.course-builder-wrap {
    font-family: var(--tc-font-body);
    max-width: 100%;
    margin: 1em 0;
    color: var(--tc-text);
}

.cb-card {
    background: var(--tc-surface);
    border: 0.05em solid var(--tc-border);
    border-radius: var(--tc-radius-card);
    padding: 1.6em;
    margin-bottom: 1.2em;
    box-shadow: 0 0.2em 0.3em -0.05em rgba(0, 0, 0, 0.05);
}

.cb-field-group {
    margin-bottom: 24px;
}

.cb-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2em;
    margin-bottom: 1em;
}

.cb-row.cb-row-last {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .cb-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.cb-label {
    display: block;
    font-size: 0.8em !important;
    font-weight: 600;
    margin-bottom: 0.4em;
    color: var(--tc-label) !important;
}

.cb-input-text {
    width: 100%;
    padding: 0.778em 0.889em !important;
    border: 1px solid var(--tc-input-border) !important;
    border-radius: var(--tc-radius-input) !important;
    background: var(--tc-surface);
    font-size: 0.9em;
    font-family: var(--tc-font-body);
    color: var(--tc-label) !important;
    outline: none !important;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.cb-input-text:focus {
    border-color: var(--tc-primary) !important;
}

textarea.cb-input-text {
    resize: vertical;
    min-height: 100px;
}

.cb-module-title-input {
    margin-bottom: 32px;
}

.cb-module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.cb-module-heading {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--tc-text);
}

.cb-chevron {
    color: var(--tc-text);
    transition: transform 0.3s ease;
}

.cb-module-body {
    padding-top: 1.2em;
}

.cb-btn-remove-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4em !important;
    background: var(--tc-surface) !important;
    color: var(--tc-label) !important;
    border: 1px solid var(--tc-control-border) !important;
    border-radius: var(--tc-radius-button) !important;
    padding: 0.222em 0.8em !important;
    font-size: 0.7em !important;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.cb-btn-remove-pill:hover {
    background: var(--tc-surface-alt) !important;
    border-color: var(--tc-subtle) !important;
}

.cb-remove-module-wrap {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.6em;
}

.cb-actions-right {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.cb-btn-add {
    background: var(--tc-primary) !important;
    color: var(--tc-button-text) !important;
    border: none !important;
    border-radius: var(--tc-radius-button) !important;
    padding: 0.222em 0.889em !important;
    font-weight: 600;
    font-size: 0.7em !important;
    font-family: var(--tc-font-body);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}

.cb-btn-add:hover {
    background: var(--tc-primary-hover) !important;
}

.cb-upload-group {
    display: flex;
    border: 0.05em solid var(--tc-control-border);
    border-radius: var(--tc-radius-input);
    height: 2.8em;
    box-sizing: border-box;
}

.cb-file-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    padding: 0 0.8em;
    background: var(--tc-surface);
    cursor: pointer;
    gap: 0.5em;
    font-size: 0.7em;
    color: var(--tc-text);
    border-radius: var(--tc-radius-input) 0 0 var(--tc-radius-input);
}

.cb-file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    inset: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.cb-icon-muted {
    color: var(--tc-muted);
    flex-shrink: 0;
}

.cb-file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.cb-btn-go {
    background: var(--tc-secondary) !important;
    color: var(--tc-button-text) !important;
    border: none !important;
    width: 5.85em;
    height: 100%;
    padding: 0.8em 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    border-radius: 0 var(--tc-radius-input) var(--tc-radius-input) 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.cb-btn-go:hover {
    background: var(--tc-secondary-hover) !important;
}

.cb-btn-go.cb-red-go {
    background: var(--tc-primary) !important;
}

.cb-btn-go.cb-red-go:hover {
    background: var(--tc-primary-hover) !important;
}

.cb-helper-text {
    font-size: 0.55em;
    color: var(--tc-subtle);
    margin-top: 0.3em;
    display: block;
}

.cb-status-box {
    background: var(--tc-surface-alt) !important;
    border: 1px solid var(--tc-input-border) !important;
    border-radius: var(--tc-radius-input);
    padding: 0 0.8em;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 4.1em !important;
    font-size: 0.7em;
    color: var(--tc-muted);
    box-sizing: border-box;
}

.cb-status-empty {
    text-align: center;
}

.cb-status-active {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.cb-status-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cb-upload-name {
    color: var(--tc-text);
    font-weight: 500;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 80%;
}

.cb-progress-bar {
    height: 0.3em;
    background: var(--tc-border);
    border-radius: 50em;
    margin-top: 0.3em;
    overflow: hidden;
}

.cb-progress-fill {
    height: 100%;
    background: var(--tc-primary);
    transition: width 0.3s ease;
}

.cb-btn-cancel {
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tc-muted);
    cursor: pointer;
    transition: opacity 0.2s;
}

.cb-btn-cancel:hover {
    opacity: 0.7;
}

.cb-rotate-180 {
    transform: rotate(180deg);
}

.cb-lesson-block {
    background: var(--tc-surface-alt);
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius-input);
    padding: 1.2em;
    margin-bottom: 1.2em;
    position: relative;
}

.cb-lesson-block:last-child {
    margin-bottom: 0;
}

.cb-lesson-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2em;
    padding-bottom: 0.8em;
    border-bottom: 1px solid var(--tc-control-border);
}

.cb-lesson-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cb-label.cb-lesson-label {
    margin: 0 !important;
    font-size: 1em !important;
}

.cb-drag-handle {
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
    color: var(--tc-muted);
    transition: 0.2s;
}

.cb-drag-handle:hover {
    background: var(--tc-border);
}

.cb-drag-handle:active {
    cursor: grabbing;
}

.cb-ghost-card {
    opacity: 0.4;
    border: 2px dashed var(--tc-primary) !important;
    background: var(--tc-surface) !important;
}

.cb-footer-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--tc-border);
}

.cb-btn-draft {
    background: var(--tc-surface);
    color: var(--tc-text);
    border: 1px solid var(--tc-control-border);
    border-radius: var(--tc-radius-input);
    padding: 10px 24px;
    font-family: var(--tc-font-body);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: 0.2s;
}

.cb-btn-draft:hover {
    background: var(--tc-surface-alt);
    border-color: var(--tc-subtle);
}

.cb-btn-publish {
    background: var(--tc-secondary);
    color: var(--tc-button-text);
    border: none;
    border-radius: var(--tc-radius-input);
    padding: 10px 32px;
    font-family: var(--tc-font-body);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: 0.2s;
}

.cb-btn-publish:hover {
    background: var(--tc-secondary-hover);
}

.cb-btn-publish:disabled,
.cb-btn-draft:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================================================
   Video player
   ========================================================================== */

.cp-video-wrap {
    font-family: var(--tc-font-body);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.cp-iframe-container {
    position: relative;
    width: 100%;
    padding-bottom: var(--tc-video-ratio);
    background: var(--tc-video-bg);
    overflow: hidden;
}

.cp-iframe-container iframe,
.cp-iframe-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    object-fit: var(--tc-video-fit);
}

.cp-video-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cp-video-title {
    font-family: var(--tc-font-lesson);
    font-size: 1em;
    font-weight: 400;
    color: var(--tc-text);
    margin: 0;
}

/* Prev / next tabs on the left and right edge of the video. */
.cp-video-arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 26px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: none;
    line-height: 0;
    background: var(--tc-primary);
    color: var(--tc-button-text);
    box-shadow: none;
    cursor: pointer;
    transform: translateY(-50%);
    transition: background 0.2s;
}

.cp-video-arrow:hover,
.cp-video-arrow:focus-visible {
    background: var(--tc-primary-hover);
    color: var(--tc-button-text);
}

.cp-video-arrow:focus-visible {
    outline: 2px solid var(--tc-button-text);
    outline-offset: -2px;
}

.cp-video-arrow-prev {
    left: 0;
    border-radius: 0 2px 2px 0;
}

.cp-video-arrow-next {
    right: 0;
    border-radius: 2px 0 0 2px;
}

.cp-action-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

.cp-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 92px;
    margin: 0;
    padding: 14px 24px;
    font-family: var(--tc-font-body);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.2;
    text-align: center;
    border: 1px solid transparent;
    border-radius: var(--tc-player-button-radius, 2px);
    box-shadow: none;
    cursor: pointer;
    transition: 0.2s;
    box-sizing: border-box;
}

.cp-btn:focus-visible {
    outline: 2px solid var(--tc-primary);
    outline-offset: 2px;
}

.cp-btn .cp-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.cp-icon-flip {
    transform: scaleX(-1);
}

.cp-btn-nav {
    background: var(--tc-surface);
    color: var(--tc-text);
    border-color: var(--tc-border);
}

.cp-btn-nav:hover:not(:disabled) {
    background: var(--tc-surface-alt);
    color: var(--tc-text);
    border-color: var(--tc-control-border);
}

.cp-btn-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.cp-btn-done {
    padding-left: 28px;
    padding-right: 28px;
    background: var(--tc-primary);
    color: var(--tc-button-text);
}

.cp-btn-done:hover {
    background: var(--tc-primary-hover);
    color: var(--tc-button-text);
}

@media (max-width: 480px) {
    .cp-action-row {
        gap: 8px;
    }

    .cp-btn,
    .cp-btn-done {
        min-width: 0;
        padding: 12px 14px;
    }
}

/* ==========================================================================
   Player sidebar
   ========================================================================== */

.cp-empty {
    padding: 20px;
    color: var(--tc-muted);
    font-family: var(--tc-font-body);
}

.cp-sidebar-wrap {
    font-family: var(--tc-font-body);
    display: flex;
    flex-direction: column;
    gap: 0.6em;
}

.cp-module {
    background: var(--tc-surface);
    border-radius: var(--tc-radius-card);
    border: 1px solid var(--tc-border);
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.cp-module-header {
    padding: 24px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: background 0.2s;
    background: var(--tc-surface);
    gap: 12px;
}

.cp-module-header:hover {
    background: var(--tc-surface-alt);
}

.cp-module-title-wrap {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.cp-module-title {
    font-family: var(--tc-font-heading);
    font-size: 17px;
    font-weight: 700;
    color: var(--tc-text);
    margin: 0;
    line-height: 1.3;
}

.cp-badge-progress,
.cp-badge-completed {
    font-family: var(--tc-font-body);
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.cp-badge-progress {
    background: var(--tc-badge-progress-bg);
    color: var(--tc-badge-progress-text);
}

.cp-badge-completed {
    background: var(--tc-success-light);
    color: var(--tc-success-text);
}

.cp-module-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--tc-font-body);
    font-size: 13px;
    color: var(--tc-muted);
    font-weight: 600;
    white-space: nowrap;
    margin-top: 2px;
}

.cp-chevron {
    color: var(--tc-text);
    transition: transform 0.3s;
}

.cp-rotate-180 {
    transform: rotate(180deg);
}

.cp-lessons-list {
    background: var(--tc-surface);
    padding: 0 20px 16px 20px;
    display: flex;
    flex-direction: column;
}

.cp-module-prog-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 12px;
    margin-bottom: 16px;
}

.cp-module-prog-track {
    background: var(--tc-success-light);
    border-radius: 999px;
    height: 4px;
    flex-grow: 1;
    min-width: 100px;
    overflow: hidden;
    display: block;
}

.cp-module-prog-fill {
    background: var(--tc-success);
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
    display: block;
}

.cp-module-prog-text {
    font-family: var(--tc-font-body);
    font-size: 11px;
    color: var(--tc-muted);
    font-weight: 400;
    flex-shrink: 0;
}

.cp-module-prog-text span {
    font-weight: 700;
    color: var(--tc-text);
    font-size: 12px;
}

.cp-lessons-inner {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cp-lesson-item {
    font-family: var(--tc-font-lesson);
    font-size: 15px;
    font-weight: 400;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--tc-muted);
    cursor: pointer;
    line-height: 1.4;
}

.cp-lesson-item:hover {
    color: var(--tc-text);
}

.cp-lesson-item.is-active {
    color: var(--tc-text);
    font-weight: 700;
}

.cp-icon-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.cp-icon-wrap svg {
    width: 100%;
    height: 100%;
}

.cp-icon-done circle {
    fill: var(--tc-success);
}

.cp-icon-done path {
    stroke: var(--tc-button-text);
}

.cp-icon-current .cp-icon-ring {
    stroke: var(--tc-primary);
}

.cp-icon-current .cp-icon-dot {
    fill: var(--tc-primary);
}

.cp-icon-pending {
    stroke: var(--tc-control-border);
}

/* ==========================================================================
   Course grid widgets
   ========================================================================== */

.cp-grid-prog-wrap {
    margin-bottom: 24px;
}

.cp-grid-prog-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.cp-grid-prog-label {
    font-family: var(--tc-font-body);
    font-size: 0.8em;
    color: var(--tc-muted);
    font-weight: 400;
}

.cp-grid-prog-pct {
    font-family: var(--tc-font-body);
    font-size: 0.8em;
    font-weight: 700;
    color: var(--tc-label);
}

.cp-grid-prog-track {
    background: var(--tc-success-light);
    border-radius: 999px;
    height: 6px;
    width: 100%;
    overflow: hidden;
}

.cp-grid-prog-fill {
    background: var(--tc-success);
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
}

.cp-grid-btns-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.cp-btn-mehr {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    background: var(--tc-primary);
    color: var(--tc-button-text);
    padding: 12px 24px;
    border-radius: var(--tc-radius-button);
    font-family: var(--tc-font-body);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: 0.2s;
}

.cp-btn-mehr:hover,
.cp-btn-mehr:focus {
    background: var(--tc-primary-hover);
    color: var(--tc-button-text);
}

.cp-btn-edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--tc-surface);
    color: var(--tc-text);
    text-decoration: none;
    border-radius: var(--tc-radius-input);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--tc-font-body);
    border: 1px solid var(--tc-control-border);
    width: max-content;
    transition: 0.2s;
}

.cp-btn-edit:hover {
    background: var(--tc-surface-alt);
    color: var(--tc-text);
}
