/**
 * ============================================================
 * CastThread - Custom Stylesheet
 * Theme: Navy Blue primary, Wine Red secondary, White background
 * Font: Outfit (Google Fonts)
 * ============================================================
 */

/* ---- CSS Variables ---- */
:root {
    --ct-primary: #1B2A4A;
    --ct-primary-light: #2A3F6A;
    --ct-primary-dark: #111D35;
    --ct-secondary: #722F37;
    --ct-secondary-light: #8B3A44;
    --ct-secondary-dark: #5A252C;
    --ct-bg: #FFFFFF;
    --ct-bg-light: #F7F8FC;
    --ct-bg-card: #FFFFFF;
    --ct-text: #2D3748;
    --ct-text-light: #718096;
    --ct-border: #E2E8F0;
    --ct-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --ct-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --ct-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --ct-radius: 12px;
    --ct-radius-sm: 8px;
    --ct-radius-lg: 16px;
    --ct-transition: all 0.2s ease;
    --ct-navbar-height: 60px;
    --ct-bottom-nav-height: 70px;
}

/* ---- Global Reset & Base ---- */
* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--ct-bg-light);
    color: var(--ct-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--ct-primary);
}

.ct-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.ct-page-subtitle {
    font-size: 0.9rem;
    color: var(--ct-text-light);
    margin-bottom: 1.5rem;
}

/* ---- Top Navbar ---- */
.ct-navbar {
    background: var(--ct-primary);
    height: var(--ct-navbar-height);
    box-shadow: var(--ct-shadow-md);
    z-index: 1050;
    border: none;
}

.ct-logo {
    height: 34px;
    width: auto;
    border-radius: 6px;
}

.ct-brand-text {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.5px;
    color: #fff;
}

.ct-navbar .nav-link {
    font-weight: 500;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
    padding: 0.5rem 1rem;
    border-radius: var(--ct-radius-sm);
    transition: var(--ct-transition);
}

.ct-navbar .nav-link:hover,
.ct-navbar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

/* ---- Main Content ---- */
.ct-main {
    padding-top: calc(var(--ct-navbar-height) + 16px);
    padding-bottom: 24px;
    min-height: 100vh;
}

/* ---- Bottom Navigation (Mobile) ---- */
.ct-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--ct-bottom-nav-height);
    background: var(--ct-bg-card);
    border-top: 1px solid var(--ct-border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1040;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
}

.ct-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--ct-text-light);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--ct-radius-sm);
    transition: var(--ct-transition);
    gap: 2px;
}

.ct-bottom-nav-item i {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.ct-bottom-nav-item.active {
    color: var(--ct-primary);
}

.ct-bottom-nav-item.active i {
    color: var(--ct-primary);
}

/* Floating "add" button in bottom nav */
.ct-bottom-nav-add {
    background: var(--ct-secondary);
    color: #fff !important;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    margin-top: -20px;
    box-shadow: var(--ct-shadow-md);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ct-bottom-nav-add span {
    display: none;
}

.ct-bottom-nav-add i {
    font-size: 1.3rem;
    margin: 0;
}

/* Add bottom padding on mobile for bottom nav */
@media (max-width: 991.98px) {
    .ct-main {
        padding-bottom: calc(var(--ct-bottom-nav-height) + 16px);
    }
}

/* ---- Cards ---- */
.ct-card {
    background: var(--ct-bg-card);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius);
    box-shadow: var(--ct-shadow);
    transition: var(--ct-transition);
    overflow: hidden;
}

.ct-card:hover {
    box-shadow: var(--ct-shadow-md);
    transform: translateY(-1px);
}

.ct-card-body {
    padding: 1.25rem;
}

.ct-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--ct-border);
    background: var(--ct-bg-light);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ---- Stat Cards (Dashboard) ---- */
.ct-stat-card {
    background: var(--ct-bg-card);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--ct-shadow);
    transition: var(--ct-transition);
}

.ct-stat-card:hover {
    box-shadow: var(--ct-shadow-md);
}

.ct-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--ct-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.ct-stat-icon.primary {
    background: rgba(27, 42, 74, 0.1);
    color: var(--ct-primary);
}

.ct-stat-icon.secondary {
    background: rgba(114, 47, 55, 0.1);
    color: var(--ct-secondary);
}

.ct-stat-icon.success {
    background: rgba(72, 187, 120, 0.1);
    color: #38A169;
}

.ct-stat-icon.warning {
    background: rgba(237, 137, 54, 0.1);
    color: #DD6B20;
}

.ct-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--ct-primary);
}

.ct-stat-label {
    font-size: 0.8rem;
    color: var(--ct-text-light);
    font-weight: 500;
    margin-top: 2px;
}

/* ---- Project Cards ---- */
.ct-project-card {
    text-decoration: none;
    color: inherit;
    display: block;
}

.ct-project-card:hover {
    color: inherit;
}

.ct-project-card .ct-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ct-project-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ct-primary);
    margin: 0;
}

.ct-project-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--ct-text-light);
}

.ct-project-meta span i {
    margin-right: 4px;
}

/* ---- Video Cards ---- */
.ct-video-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: var(--ct-bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ct-text-light);
    font-size: 2rem;
}

.ct-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---- Character Avatars ---- */
.ct-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--ct-bg-light);
    border: 2px solid var(--ct-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--ct-primary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.ct-avatar.lg {
    width: 64px;
    height: 64px;
    font-size: 1.4rem;
}

.ct-avatar.sm {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
}

/* ---- Timeline ---- */
.ct-timeline {
    position: relative;
    padding-left: 24px;
}

.ct-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--ct-border);
}

.ct-timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.ct-timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ct-primary);
    border: 2px solid var(--ct-bg-card);
    box-shadow: 0 0 0 2px var(--ct-primary);
}

.ct-timeline-item.alert-item::before {
    background: var(--ct-secondary);
    box-shadow: 0 0 0 2px var(--ct-secondary);
}

.ct-timeline-time {
    font-size: 0.75rem;
    color: var(--ct-text-light);
    font-weight: 500;
}

.ct-timeline-content {
    background: var(--ct-bg-card);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-sm);
    padding: 0.75rem 1rem;
    margin-top: 4px;
}

/* ---- Badges ---- */
.ct-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ---- Buttons ---- */
.btn-ct-primary {
    background: var(--ct-primary);
    color: #fff;
    border: none;
    border-radius: var(--ct-radius-sm);
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    padding: 0.5rem 1.25rem;
    transition: var(--ct-transition);
}

.btn-ct-primary:hover {
    background: var(--ct-primary-light);
    color: #fff;
    box-shadow: var(--ct-shadow-md);
}

.btn-ct-secondary {
    background: var(--ct-secondary);
    color: #fff;
    border: none;
    border-radius: var(--ct-radius-sm);
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    padding: 0.5rem 1.25rem;
    transition: var(--ct-transition);
}

.btn-ct-secondary:hover {
    background: var(--ct-secondary-light);
    color: #fff;
    box-shadow: var(--ct-shadow-md);
}

.btn-ct-outline {
    background: transparent;
    color: var(--ct-primary);
    border: 1.5px solid var(--ct-primary);
    border-radius: var(--ct-radius-sm);
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    padding: 0.45rem 1.2rem;
    transition: var(--ct-transition);
}

.btn-ct-outline:hover {
    background: var(--ct-primary);
    color: #fff;
}

/* ---- Forms ---- */
.ct-form-control {
    border: 1.5px solid var(--ct-border);
    border-radius: var(--ct-radius-sm);
    padding: 0.6rem 1rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    transition: var(--ct-transition);
    background: var(--ct-bg-card);
}

.ct-form-control:focus {
    border-color: var(--ct-primary);
    box-shadow: 0 0 0 3px rgba(27, 42, 74, 0.12);
    outline: none;
}

.ct-form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--ct-text);
    margin-bottom: 0.35rem;
}

/* ---- Upload Zone ---- */
.ct-upload-zone {
    border: 2px dashed var(--ct-border);
    border-radius: var(--ct-radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--ct-transition);
    background: var(--ct-bg-light);
}

.ct-upload-zone:hover,
.ct-upload-zone.dragover {
    border-color: var(--ct-primary);
    background: rgba(27, 42, 74, 0.04);
}

.ct-upload-zone i {
    font-size: 2.5rem;
    color: var(--ct-text-light);
    margin-bottom: 0.75rem;
}

.ct-upload-zone p {
    color: var(--ct-text-light);
    font-size: 0.9rem;
    margin: 0;
}

/* ---- Progress Bar ---- */
.ct-progress {
    height: 6px;
    border-radius: 3px;
    background: var(--ct-bg-light);
    overflow: hidden;
}

.ct-progress-bar {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--ct-primary), var(--ct-primary-light));
    transition: width 0.3s ease;
}

/* ---- Alert Cards ---- */
.ct-alert-card {
    border-left: 4px solid;
    border-radius: var(--ct-radius-sm);
}

.ct-alert-card.severity-high {
    border-left-color: #E53E3E;
}

.ct-alert-card.severity-medium {
    border-left-color: #ED8936;
}

.ct-alert-card.severity-low {
    border-left-color: #4299E1;
}

/* ---- Scene Bar (visual timeline) ---- */
.ct-scene-bar {
    display: flex;
    gap: 2px;
    height: 32px;
    border-radius: var(--ct-radius-sm);
    overflow: hidden;
    background: var(--ct-bg-light);
}

.ct-scene-segment {
    height: 100%;
    border-radius: 2px;
    cursor: pointer;
    transition: var(--ct-transition);
    position: relative;
}

.ct-scene-segment:hover {
    opacity: 0.8;
    transform: scaleY(1.1);
}

/* ---- Graph Container ---- */
.ct-graph-container {
    width: 100%;
    height: 400px;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius);
    background: var(--ct-bg-card);
}

@media (max-width: 767.98px) {
    .ct-graph-container {
        height: 300px;
    }
}

/* ---- Empty State ---- */
.ct-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.ct-empty-state i {
    font-size: 3rem;
    color: var(--ct-border);
    margin-bottom: 1rem;
}

.ct-empty-state h5 {
    font-weight: 600;
    color: var(--ct-text);
}

.ct-empty-state p {
    color: var(--ct-text-light);
    font-size: 0.9rem;
    max-width: 320px;
    margin: 0 auto 1.5rem;
}

/* ---- List Items ---- */
.ct-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--ct-border);
    transition: var(--ct-transition);
    text-decoration: none;
    color: inherit;
}

.ct-list-item:last-child {
    border-bottom: none;
}

.ct-list-item:hover {
    background: var(--ct-bg-light);
    color: inherit;
}

.ct-list-item-body {
    flex: 1;
    min-width: 0;
}

.ct-list-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ct-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ct-list-item-sub {
    font-size: 0.78rem;
    color: var(--ct-text-light);
}

/* ---- Processing Spinner ---- */
.ct-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--ct-border);
    border-top-color: var(--ct-primary);
    border-radius: 50%;
    animation: ct-spin 0.6s linear infinite;
}

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

/* ---- Responsive Tweaks ---- */
@media (max-width: 575.98px) {
    .ct-page-title {
        font-size: 1.25rem;
    }

    .ct-stat-card {
        padding: 1rem;
    }

    .ct-stat-value {
        font-size: 1.4rem;
    }

    .ct-card-body {
        padding: 1rem;
    }

    .ct-upload-zone {
        padding: 1.5rem 1rem;
    }

    .ct-upload-zone i {
        font-size: 2rem;
    }
}

/* ---- Utility Classes ---- */
.ct-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ct-divider {
    height: 1px;
    background: var(--ct-border);
    margin: 1rem 0;
}

.ct-fade-in {
    animation: ctFadeIn 0.3s ease;
}

@keyframes ctFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Scrollbar Styling ---- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--ct-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ct-text-light);
}

/* ---- Processing Status Animation ---- */
.ct-pulse {
    animation: ctPulse 2s ease-in-out infinite;
}

@keyframes ctPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

/* ---- Tabs (custom styled) ---- */
.ct-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--ct-border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ct-tab {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ct-text-light);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: var(--ct-transition);
}

.ct-tab:hover {
    color: var(--ct-primary);
}

.ct-tab.active {
    color: var(--ct-primary);
    border-bottom-color: var(--ct-primary);
    font-weight: 600;
}

/* ---- Color palette for character labels ---- */
.ct-color-1 { background: #4299E1; color: #fff; }
.ct-color-2 { background: #48BB78; color: #fff; }
.ct-color-3 { background: #ED8936; color: #fff; }
.ct-color-4 { background: #9F7AEA; color: #fff; }
.ct-color-5 { background: #F56565; color: #fff; }
.ct-color-6 { background: #38B2AC; color: #fff; }
.ct-color-7 { background: #ED64A6; color: #fff; }
.ct-color-8 { background: #667EEA; color: #fff; }
