/* challenges/static/challenges/css/challenges.css */
/* TikTok/Instagram Style - Native App Feel - Mobile First */

/* ==================== CSS VARIABLES ==================== */
:root {
    --primary-color: #2c5f7e;
    --secondary-color: #3a7ca5;
    --accent-color: #ff6b35;
    --accent-gradient: linear-gradient(135deg, #ff6b35 0%, #ff8c5a 100%);
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    
    --bg-primary: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    --safe-area-bottom: env(safe-area-inset-bottom, 20px);
}

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* ==================== CREATE CHALLENGE PAGE ==================== */

.challenge-create-wrapper {
    min-height: 100vh;
    background: var(--bg-primary);
    padding-bottom: calc(80px + var(--safe-area-bottom));
}

.challenge-create-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 0;
}

/* App-style Header */
.challenge-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-card);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.challenge-header-back {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: var(--bg-input);
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.challenge-header-back:hover {
    background: var(--border-color);
    transform: scale(1.05);
}

.challenge-header-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Oswald', sans-serif;
}

.challenge-header-spacer {
    width: 40px;
}

/* Form Container */
.challenge-form-container {
    padding: 20px;
}

/* Form Groups - Native App Style */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 16px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Custom Select Arrow */
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 20px;
    padding-right: 50px;
}

/* Location Section */
.location-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.location-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.location-toggle-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.lake-search-wrapper {
    position: relative;
}

.lake-search-wrapper.hidden {
    display: none;
}

.lake-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}

.lake-search-results.active {
    display: block;
}

.lake-search-item {
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease;
}

.lake-search-item:last-child {
    border-bottom: none;
}

.lake-search-item:hover,
.lake-search-item.selected {
    background: var(--bg-input);
}

.lake-search-item-name {
    font-weight: 500;
    color: var(--text-primary);
}

.lake-search-item-state {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.selected-lake {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 107, 53, 0.1);
    border: 2px solid var(--accent-color);
    border-radius: var(--radius-md);
    margin-top: 12px;
}

.selected-lake-name {
    font-weight: 500;
    color: var(--text-primary);
}

.selected-lake-remove {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger-color);
    color: white;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

/* Toggle Switch - iOS Style */
.toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.toggle-label-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.toggle-label-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.toggle-switch {
    position: relative;
    width: 52px;
    height: 32px;
    background: var(--border-color);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 26px;
    height: 26px;
    background: white;
    border-radius: var(--radius-full);
    top: 3px;
    left: 3px;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-md);
}

.toggle-switch.active,
input[type="checkbox"]:checked + .toggle-switch {
    background: var(--accent-color);
}

.toggle-switch.active::after,
input[type="checkbox"]:checked + .toggle-switch::after {
    transform: translateX(20px);
}

/* Hidden checkbox for toggle */
.toggle-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch-wrapper {
    position: relative;
    display: inline-block;
}

/* Friends Selector - Private Challenge */
.friends-selector {
    margin-top: 16px;
    display: none;
}

.friends-selector.visible {
    display: block;
}

.friends-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.friends-selector-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.friends-count {
    font-size: 0.85rem;
    color: var(--accent-color);
    font-weight: 600;
}

.friends-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.friend-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
}

.friend-chip:hover {
    border-color: var(--text-muted);
}

.friend-chip.selected {
    background: rgba(255, 107, 53, 0.1);
    border-color: var(--accent-color);
}

.friend-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.friend-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Submit Button - Sticky Bottom */
.submit-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    padding: 16px 20px;
    padding-bottom: calc(16px + var(--safe-area-bottom));
    border-top: 1px solid var(--border-color);
    z-index: 100;
}

.submit-section-inner {
    max-width: 500px;
    margin: 0 auto;
}

.btn-create-challenge {
    width: 100%;
    padding: 18px 24px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: white;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

.btn-create-challenge:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-create-challenge:active {
    transform: translateY(0);
}

.btn-create-challenge:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    transform: none;
}

/* ==================== CHALLENGE LIST PAGE ==================== */

.challenges-wrapper {
    min-height: 100vh;
    background: var(--bg-primary);
}

.challenges-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0;
}

/* Tabs - Instagram Style */
.challenges-tabs {
    display: flex;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 60px;
    z-index: 90;
}

.tab-btn {
    flex: 1;
    padding: 16px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-color);
}

/* Section Headers */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px 12px;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.section-action {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-color);
    text-decoration: none;
}

/* Challenge Cards */
.challenge-card {
    background: var(--bg-card);
    margin: 0 16px 16px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

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

.challenge-card-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.challenge-card-content {
    padding: 16px;
}

.challenge-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.challenge-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Oswald', sans-serif;
    line-height: 1.3;
}

.challenge-card-badge {
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
    margin-left: 12px;
}

.challenge-card-badge.public {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.challenge-card-badge.private {
    background: rgba(255, 107, 53, 0.1);
    color: var(--accent-color);
}

.challenge-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.challenge-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.challenge-meta-icon {
    font-size: 1rem;
}

.challenge-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.challenge-creator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.creator-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.creator-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.challenge-time-left {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-color);
}

.challenge-time-left.ending-soon {
    color: var(--danger-color);
}

/* Invite Cards */
.invite-card {
    background: rgba(255, 107, 53, 0.05);
    border: 2px solid var(--accent-color);
}

.invite-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.btn-invite-action {
    flex: 1;
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
}

.btn-accept {
    background: var(--accent-color);
    color: white;
    border: none;
}

.btn-decline {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Top Performers - Horizontal Scroll */
.top-performers-section {
    padding: 16px 0;
    background: var(--bg-card);
    margin-bottom: 16px;
}

.top-performers-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 0 16px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.top-performers-scroll::-webkit-scrollbar {
    display: none;
}

.performer-card {
    flex-shrink: 0;
    width: 100px;
    text-align: center;
}

.performer-avatar {
    width: 60px;
    height: 60px;
    margin: 0 auto 8px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-color), #ff8c5a);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    position: relative;
}

.performer-rank {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
}

.performer-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.performer-wins {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* FAB - Create Challenge */
.fab-create {
    position: fixed;
    bottom: calc(24px + var(--safe-area-bottom));
    right: 24px;
    width: 60px;
    height: 60px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s ease;
    z-index: 100;
    text-decoration: none;
}

.fab-create:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 24px rgba(255, 107, 53, 0.3);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.empty-state-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.btn-empty-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--accent-gradient);
    color: white;
    font-weight: 600;
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all 0.2s ease;
}

/* ==================== CHALLENGE DETAIL PAGE ==================== */

.challenge-detail-header {
    position: relative;
    height: 200px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.challenge-detail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.challenge-detail-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}

.challenge-detail-back {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
}

.challenge-detail-info {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    color: white;
}

.challenge-detail-title {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Oswald', sans-serif;
    margin-bottom: 8px;
}

.challenge-detail-meta {
    display: flex;
    gap: 16px;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Leaderboard */
.leaderboard-section {
    padding: 20px 16px;
}

.leaderboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.leaderboard-title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.leaderboard-item.current-user {
    border-color: var(--accent-color);
    background: rgba(255, 107, 53, 0.05);
}

.leaderboard-rank {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: var(--radius-full);
    background: var(--bg-input);
    color: var(--text-secondary);
}

.leaderboard-item:nth-child(1) .leaderboard-rank {
    background: linear-gradient(135deg, #ffd700, #ffed4a);
    color: #92400e;
}

.leaderboard-item:nth-child(2) .leaderboard-rank {
    background: linear-gradient(135deg, #c0c0c0, #e5e7eb);
    color: #374151;
}

.leaderboard-item:nth-child(3) .leaderboard-rank {
    background: linear-gradient(135deg, #cd7f32, #d97706);
    color: white;
}

.leaderboard-user {
    flex: 1;
}

.leaderboard-username {
    font-weight: 600;
    color: var(--text-primary);
}

.leaderboard-entries {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.leaderboard-score {
    text-align: right;
}

.leaderboard-weight {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-color);
}

.leaderboard-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Rules Section */
.rules-section {
    padding: 20px 16px;
    background: var(--bg-card);
    margin: 16px;
    border-radius: var(--radius-lg);
}

.rules-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.rules-list {
    list-style: none;
}

.rules-list li {
    padding: 10px 0;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.rules-list li:last-child {
    border-bottom: none;
}

/* Join Button - Sticky */
.join-section {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    background: var(--bg-card);
    padding: 16px;
    padding-bottom: calc(16px + var(--safe-area-bottom));
    border-top: 1px solid var(--border-color);
    box-sizing: border-box;
}

.btn-join {
    width: 100%;
    padding: 16px;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
}

.btn-joined {
    background: var(--success-color);
}

/* Error text */
.error-text {
    display: block;
    color: var(--danger-color);
    font-size: 0.85rem;
    margin-top: 6px;
}

/* ==================== RESPONSIVE ==================== */

@media (min-width: 640px) {
    .challenge-create-container,
    .challenges-container {
        padding: 0 20px;
    }
    
    .challenge-card {
        margin: 0 0 20px;
    }
    
    .submit-section {
        padding: 20px;
    }
}

/* ==================== ANIMATIONS ==================== */

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

.challenge-card {
    animation: fadeIn 0.3s ease forwards;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.challenge-time-left.ending-soon {
    animation: pulse 1s ease infinite;
}

/* ==================== LOADING STATES ==================== */

.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--border-color) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ==================== LOCATION SECTION ==================== */
.location-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.location-header {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.location-header i {
    margin-right: 6px;
}

/* Open Location Toggle */
.open-location-toggle {
    display: flex;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.toggle-label {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 30px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    border-radius: 30px;
    transition: background-color 0.3s ease;
}

.toggle-thumb {
    position: absolute;
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked + .toggle-track {
    background-color: #3b82f6;
}

.toggle-input:checked + .toggle-track .toggle-thumb {
    transform: translateX(22px);
}

.toggle-text {
    margin-left: 14px;
}

.toggle-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.toggle-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}


/* ==================== PRIVATE SECTION ==================== */
.private-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}



/* ==================== DATETIME INPUT WITH PLACEHOLDER ==================== */
.datetime-input-wrapper {
    position: relative;
}

.datetime-input-wrapper .datetime-input {
    width: 100%;
    position: relative;
    z-index: 1;
}

/* On mobile, datetime-local with no value shows blank — overlay a placeholder */
.datetime-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    pointer-events: none;
    z-index: 2;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    transition: opacity 0.15s ease;
}

.datetime-placeholder-text {
    font-size: 1rem;
    color: var(--text-muted);
}

.datetime-placeholder-icon {
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

/* When wrapper has value, hide placeholder */
.datetime-input-wrapper.has-value .datetime-placeholder {
    opacity: 0;
    pointer-events: none;
}

/* Make the actual input clickable through the placeholder */
.datetime-input-wrapper:not(.has-value) .datetime-input {
    color: transparent;
}

.datetime-input-wrapper:not(.has-value) .datetime-input::-webkit-calendar-picker-indicator {
    opacity: 0;
}

/* When focused or has value, show normal input */
.datetime-input-wrapper.has-value .datetime-input {
    color: var(--text-primary);
}

/* Tapping anywhere on placeholder should trigger picker */
.datetime-placeholder {
    cursor: pointer;
    pointer-events: auto;
}

.datetime-input-wrapper.has-value .datetime-placeholder {
    pointer-events: none;
}

/* ==================== THUMBNAIL UPLOAD ==================== */
.thumbnail-upload-area {
    width: 100%;
    height: 180px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
    background: var(--bg-input);
}

.thumbnail-upload-area:hover {
    border-color: var(--accent-color);
    background: rgba(255, 107, 53, 0.04);
}

.thumbnail-upload-area:active {
    transform: scale(0.99);
}

/* When image is uploaded, switch border style */
.thumbnail-upload-area.has-image {
    border: none;
    background: #000;
}

/* ---- Placeholder (empty state) ---- */
.thumbnail-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    text-align: center;
    gap: 4px;
}

/* Hide placeholder when image is present */
.thumbnail-upload-area.has-image .thumbnail-placeholder {
    display: none;
}

.thumbnail-placeholder-icon {
    color: var(--text-muted);
    margin-bottom: 4px;
}

.thumbnail-placeholder-icon svg {
    width: 40px;
    height: 40px;
}

.thumbnail-placeholder-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.thumbnail-placeholder-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.thumbnail-placeholder-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    background: var(--accent-gradient);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 4px;
    transition: all 0.2s ease;
}

.thumbnail-upload-area:hover .thumbnail-placeholder-btn {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ---- Preview (image uploaded state) ---- */
.thumbnail-preview {
    position: absolute;
    inset: 0;
    display: none;
}

/* Show preview when image is present */
.thumbnail-upload-area.has-image .thumbnail-preview {
    display: block;
}

.thumbnail-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Hover overlay on preview */
.thumbnail-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.thumbnail-upload-area.has-image:hover .thumbnail-preview-overlay {
    opacity: 1;
}

.thumbnail-preview-change {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-primary);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
}

/* Remove button */
.thumbnail-remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
    opacity: 0;
}

.thumbnail-upload-area.has-image:hover .thumbnail-remove-btn {
    opacity: 1;
}

.thumbnail-remove-btn:hover {
    background: var(--danger-color);
    transform: scale(1.1);
}

.thumbnail-input {
    display: none;
}

/* Mobile: no hover, so show buttons always */
@media (hover: none) and (pointer: coarse) {
    .thumbnail-upload-area.has-image .thumbnail-remove-btn {
        opacity: 1;
    }
    
    .thumbnail-upload-area.has-image .thumbnail-preview-overlay {
        opacity: 1;
        background: rgba(0, 0, 0, 0.25);
    }
}