/* ============================================
   JokeApp — TikTok-style Swipe Feed
   ============================================ */

:root {
    --ja-primary: #2aabb3;
    --ja-primary-dark: #1f8a91;
    --ja-accent: #e8913a;
    --ja-like: #2aabb3;
    --ja-dislike: #e05a4f;
    --ja-bg: #0b1215;
    --ja-card-bg: #142024;
    --ja-text: #ffffff;
    --ja-text-muted: #8ba3a8;
    --ja-radius: 16px;
    --ja-transition: 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ---- Reset for feed pages ---- */
body.page-feed {
    background: var(--ja-bg);
    color: var(--ja-text);
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* ---- Feed Container ---- */
.joke-feed-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Joke Card ---- */
.joke-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    min-height: 50vh;
    max-height: 85vh;
    background: var(--ja-card-bg);
    border-radius: var(--ja-radius);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    touch-action: pan-y;
    user-select: none;
    transition: transform var(--ja-transition), opacity var(--ja-transition);
    will-change: transform, opacity;
    overflow-y: auto;
}

.joke-card.swiping {
    transition: none;
}

.joke-card.swipe-right {
    transform: translate(150%, -50%) rotate(20deg);
    opacity: 0;
}

.joke-card.swipe-left {
    transform: translate(-250%, -50%) rotate(-20deg);
    opacity: 0;
}

.joke-card.swipe-up {
    transform: translate(-50%, -150%) scale(0.9);
    opacity: 0;
}

.joke-card--empty {
    text-align: center;
    font-size: 1.3rem;
    color: var(--ja-text-muted);
}

/* Card header */
.joke-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.joke-card__author {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--ja-primary);
}

.joke-card__score {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Card body */
.joke-card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.joke-card__title {
    font-size: 1.5rem;
    margin: 0 0 1rem;
    line-height: 1.3;
}

.joke-card__content {
    font-size: 1.2rem;
    line-height: 1.6;
    margin: 0;
}

.joke-card__embed {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    margin: 1rem 0;
}

.joke-card__audio,
.joke-card__video {
    width: 100%;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Card actions */
.joke-card__actions {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.5rem;
}

.btn-vote {
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--ja-text);
    border-radius: 50px;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-vote:active {
    transform: scale(0.92);
}

.btn-vote--like:hover {
    background: var(--ja-accent);
    color: #fff;
}

.btn-vote--dislike:hover {
    background: var(--ja-dislike);
    color: #fff;
}

.btn-vote__icon {
    font-size: 1.3rem;
}

/* Swipe hint */
.joke-card__hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--ja-text-muted);
    margin-top: 0.8rem;
    opacity: 0.6;
}

/* Swipe visual feedback overlays */
.joke-card::before,
.joke-card::after {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 4rem;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 10;
}

.joke-card::before {
    content: '👍';
    right: 2rem;
}

.joke-card::after {
    content: '👎';
    left: 2rem;
}

.joke-card.hint-like::before {
    opacity: 1;
}

.joke-card.hint-dislike::after {
    opacity: 1;
}

/* ============================================
   Create Page
   ============================================ */
.joke-create-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.joke-create-container h1 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.joke-form__type-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.type-btn {
    flex: 1;
    text-align: center;
    padding: 0.8rem 0.5rem;
    border: 2px solid #ddd;
    border-radius: var(--ja-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.type-btn input[type="radio"] {
    display: none;
}

.type-btn__icon {
    font-size: 1.5rem;
}

.type-btn__label {
    font-size: 0.85rem;
}

.type-btn.active,
.type-btn:has(input:checked) {
    border-color: var(--ja-primary);
    background: var(--ja-primary);
    color: #fff;
}

/* Media sections */
.joke-form__media-section {
    margin-bottom: 1.2rem;
    border: 2px solid #e8e8e8;
    border-radius: var(--ja-radius);
    padding: 1.2rem;
    background: #fafafa;
}

.media-section__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #333;
}

.media-section__icon {
    font-size: 1.3rem;
}

/* Media tabs */
.media-tabs {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 1rem;
    background: #eee;
    border-radius: 10px;
    padding: 3px;
}

.media-tab {
    flex: 1;
    padding: 0.5rem 0.8rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    color: #666;
}

.media-tab.active {
    background: #fff;
    color: #222;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.media-tab-content .form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.media-tab-content .form-control:focus {
    outline: none;
    border-color: var(--ja-primary);
}

/* File upload zone */
.file-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed #ccc;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    min-height: 120px;
    background: #fff;
}

.file-upload-zone:hover {
    border-color: var(--ja-primary);
    background: rgba(42, 171, 179, 0.03);
}

.file-upload-zone.has-file {
    border-color: var(--ja-primary);
    border-style: solid;
    background: rgba(42, 171, 179, 0.05);
}

.file-upload-zone input[type="file"] {
    display: none;
}

.file-upload-zone__icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.file-upload-zone__text {
    color: #888;
    font-size: 0.9rem;
    line-height: 1.4;
}

.file-upload-zone__text small {
    color: #aaa;
}

.file-upload-zone__name {
    margin-top: 0.5rem;
    font-weight: 700;
    color: var(--ja-primary);
    font-size: 0.9rem;
}

.file-upload-zone__name:empty {
    display: none;
}

/* Embed preview */
.embed-preview {
    margin-top: 0.8rem;
    border-radius: 10px;
    overflow: hidden;
}

.embed-preview iframe {
    width: 100%;
    border: none;
    border-radius: 10px;
}

.embed-preview:empty {
    display: none;
}

.joke-form__field {
    margin-bottom: 1rem;
}

.joke-form__field .form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.joke-form__field .form-control:focus {
    outline: none;
    border-color: var(--ja-primary);
}

.joke-form__field textarea.form-control {
    resize: vertical;
    min-height: 150px;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--ja-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--ja-primary-dark);
}

/* ============================================
   Leaderboard
   ============================================ */
.leaderboard-container {
    max-width: 700px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.leaderboard-container h1 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.leaderboard-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.filter-group {
    display: flex;
    gap: 0.3rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #ddd;
    border-radius: 20px;
    background: transparent;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.filter-btn.active {
    border-color: var(--ja-primary);
    background: var(--ja-primary);
    color: #fff;
}

.leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.leaderboard-item__rank {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--ja-primary);
    min-width: 2.5rem;
}

.leaderboard-item__content {
    flex: 1;
}

.leaderboard-item__content strong {
    display: block;
    margin-bottom: 0.2rem;
}

.leaderboard-item__content p {
    margin: 0.3rem 0;
    color: #666;
    font-size: 0.9rem;
}

.leaderboard-item__meta {
    font-size: 0.8rem;
    color: #999;
}

.leaderboard-item__score {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--ja-like);
    min-width: 3rem;
    text-align: right;
}

/* ============================================
   Favorites
   ============================================ */
.favorites-container {
    max-width: 700px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.favorites-container h1 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.favorites-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.favorite-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: var(--ja-radius);
    padding: 1.2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.favorite-card__header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
    font-size: 0.85rem;
}

.favorite-card__author {
    font-weight: 700;
    color: var(--ja-primary);
}

.favorite-card__score {
    background: var(--ja-like);
    color: #fff;
    padding: 0.15rem 0.6rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.8rem;
}

.favorite-card__type {
    color: #999;
    text-transform: capitalize;
}

.favorite-card__body h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.favorite-card__body p {
    margin: 0;
    line-height: 1.5;
    color: #444;
}

.favorite-card__footer {
    margin-top: 0.8rem;
    color: #999;
}

/* ============================================
   Nav
   ============================================ */
.jokeapp-nav {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 100;
}

body.page-feed .jokeapp-nav {
    background: rgba(10, 10, 10, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.jokeapp-nav__logo {
    padding: 0 0.5rem 0 0 !important;
    background: none !important;
    display: flex;
    align-items: center;
    margin-right: 0.5rem;
}

.jokeapp-nav__logo:hover {
    background: none !important;
}

.jokeapp-nav__logo img {
    height: 32px;
    width: auto;
}

.jokeapp-nav a {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    color: #555;
    transition: all 0.2s;
}

body.page-feed .jokeapp-nav a {
    color: #aaa;
}

.jokeapp-nav a.active,
.jokeapp-nav a:hover {
    background: var(--ja-primary);
    color: #fff;
}

/* ============================================
   Alert
   ============================================ */
.alert {
    padding: 1rem 1.2rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* ============================================
   Auth Pages (Login / Register)
   ============================================ */
.auth-container {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #1a8a8f 0%, #e8913a 100%);
}

.auth-card {
    background: #fff;
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.auth-logo-img {
    height: 60px;
    width: auto;
    margin-bottom: 0.5rem;
}

.auth-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #222;
    margin: 0 0 0.3rem;
}

.auth-subtitle {
    color: #888;
    font-size: 0.95rem;
    margin: 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.auth-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
}

.auth-input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafafa;
}

.auth-input:focus {
    outline: none;
    border-color: var(--ja-primary);
    box-shadow: 0 0 0 3px rgba(42, 171, 179, 0.15);
    background: #fff;
}

.auth-input::placeholder {
    color: #bbb;
}

.auth-field-row {
    display: flex;
    gap: 0.8rem;
}

.auth-field-row .auth-field {
    flex: 1;
}

.auth-remember {
    display: flex;
    align-items: center;
}

.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #666;
    cursor: pointer;
}

.auth-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--ja-primary);
}

.auth-btn {
    width: 100%;
    padding: 1rem;
    background: var(--ja-primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-top: 0.5rem;
}

.auth-btn:hover {
    background: var(--ja-primary-dark);
}

.auth-btn:active {
    transform: scale(0.98);
}

.auth-btn[data-attach-loading].oc-loading {
    opacity: 0.7;
    pointer-events: none;
}

.auth-error {
    background: var(--ja-dislike);
    color: #fff;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.auth-field-hint {
    font-size: 0.78rem;
    color: #999;
    margin-top: 0.2rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.auth-footer p {
    margin: 0;
    color: #888;
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--ja-primary);
    font-weight: 700;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Flash messages */
.flash-message {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 9999;
    animation: flashIn 0.3s ease;
}

.flash-success {
    background: var(--ja-like);
    color: #fff;
}

.flash-error {
    background: var(--ja-dislike);
    color: #fff;
}

.flash-warning {
    background: #fdcb6e;
    color: #2d3436;
}

@keyframes flashIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 600px) {
    .joke-card {
        width: 95%;
        padding: 1.5rem;
        min-height: 60vh;
    }

    .joke-card__title {
        font-size: 1.2rem;
    }

    .joke-card__content {
        font-size: 1.05rem;
    }

    .leaderboard-filters {
        flex-direction: column;
    }
}
