:root {
    --mfa-bg: #121212;
    --mfa-surface: #1e1e1e;
    --mfa-accent: #bb86fc;
    --mfa-text: #e0e0e0;
    --video-width: 65%; /* Default Width for Side Mode */
}

/* Main Wrapper */
#mfa-wrapper {
    background-color: var(--mfa-bg);
    color: var(--mfa-text);
    font-family: 'Helvetica Neue', sans-serif;
    width: 100%;
    margin: 0 auto;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    /* Full height of viewport minus WP admin bar roughly */
    height: 85vh; 
    overflow: hidden;
}

/* Header Area */
.mfa-header {
    background: #000;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    flex: 0 0 auto;
}

.mfa-select-group label { margin-right: 5px; font-weight: bold; color: var(--mfa-accent); }
.mfa-select-group select { background: #333; color: #fff; border: 1px solid #444; padding: 5px; border-radius: 4px; }

.mfa-ui-toggles { display: flex; gap: 15px; align-items: center; }
.mfa-btn-small { background: #333; border: 1px solid #555; color: #fff; padding: 4px 8px; cursor: pointer; border-radius: 4px; font-size: 12px; }
.mfa-btn-small:hover { background: #444; }

.mfa-size-control { display: flex; align-items: center; gap: 5px; font-size: 12px; }

/* Main Content Area */
#mfa-main-area {
    flex: 1 1 auto;
    display: flex;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

/* --- STACKED MODE (Mobile / Default) --- */
.mfa-layout-stacked {
    flex-direction: column;
}
.mfa-layout-stacked .mfa-col-video {
    width: 100%;
    flex: 0 0 auto; /* Height determined by content */
}
.mfa-layout-stacked .mfa-col-feed {
    width: 100%;
    flex: 1 1 auto; /* Takes remaining height */
    display: flex;
    flex-direction: column;
    border-top: 1px solid #333;
}

/* --- SIDE MODE (Desktop Toggle) --- */
.mfa-layout-side {
    flex-direction: row;
}
.mfa-layout-side .mfa-col-video {
    /* Dynamic width based on slider */
    flex: 0 0 var(--video-width); 
    height: 100%;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
}
.mfa-layout-side .mfa-col-feed {
    flex: 1 1 auto; /* Fills remaining space */
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Video Components */
.mfa-video-container {
    width: 100%;
    background: #000;
    position: relative;
    /* In stacked mode, we usually want aspect ratio. In side mode, we want it to fill the column height or fit. */
    flex: 1; /* Grow to fill column in Side Mode */
    display: flex;
    align-items: center; /* Vertically center the video */
    justify-content: center;
}

/* Aspect Ratio Hack for Stacked Mode only usually, 
   but for simplicity, we let JS/Flex handle height in side mode */
#youtube-player-placeholder {
    width: 100%;
    height: 100%; 
    min-height: 240px; /* Minimum for mobile */
}

/* Controls Bar */
.mfa-controls {
    padding: 10px;
    background: var(--mfa-surface);
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid #333;
    flex: 0 0 auto;
}
.mfa-btn { background: var(--mfa-accent); border: none; color: #000; font-weight: bold; padding: 8px 16px; border-radius: 4px; cursor: pointer; }
.mfa-volume-wrapper { display: flex; align-items: center; gap: 5px; font-size: 12px; margin-left: auto; }

/* Feed Components */
.mfa-feed {
    flex: 1 1 auto; /* Take up all available space in the feed column */
    overflow-y: auto;
    padding: 15px;
    background: linear-gradient(to bottom, var(--mfa-bg), #000);
}
.mfa-feed-spacer { height: 150px; } /* Pushes early comments up */

.mfa-comment { margin-bottom: 10px; font-size: 14px; line-height: 1.4; word-wrap: break-word; }
.mfa-comment.mfa-mine { text-align: right; color: var(--mfa-accent); }
.mfa-ts { font-size: 0.8em; color: #666; font-family: monospace; margin-right: 5px; }

/* Input Area */
.mfa-input-area {
    flex: 0 0 auto;
    padding: 10px;
    background: var(--mfa-surface);
    border-top: 1px solid #333;
    padding-bottom: 50px;
}
.mfa-emojis { display: flex; gap: 5px; margin-bottom: 5px; justify-content: center; }
.mfa-emoji-btn { background: transparent; border: 1px solid #444; font-size: 18px; padding: 2px; border-radius: 50%; cursor: pointer; }
.mfa-emoji-btn:hover { background: #333; transform: scale(1.1); }
#mfa-form { display: flex; gap: 5px; }
#mfa-comment-input { flex: 1; padding: 8px; background: #111; border: 1px solid #444; color: #fff; border-radius: 4px; }
#mfa-form button { background: var(--mfa-accent); border: none; padding: 0 15px; border-radius: 4px; font-weight: bold; cursor: pointer; }
.mfa-now-playing {
    margin-left: auto; /* Pushes to the right */
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 40%;
    /*white-space: nowrap;*/
    overflow: hidden;
    text-overflow: ellipsis;
}
#mfa-feed {
    height:120px;
    overflow:scroll;
    overflow-x:hidden;
}
/* --- NEW: Custom Scrollbar --- */
#mfa-feed::-webkit-scrollbar {
    width: 10px; /* Width of the scrollbar */
}

#mfa-feed::-webkit-scrollbar-track {
    background: #000; /* Color of the tracking area */
}

#mfa-feed::-webkit-scrollbar-thumb {
    background-color: #444; /* Color of the scroll thumb */
    border-radius: 5px; /* Roundness of the scroll thumb */
    border: 2px solid #000; /* Creates padding around thumb */
}

#mfa-feed::-webkit-scrollbar-thumb:hover {
    background-color: var(--mfa-accent); /* Color when hovering */
}

/* --- NEW: Clickable Timestamps --- */
.mfa-ts-link {
    cursor: pointer;
    color: var(--mfa-accent);
    text-decoration: underline;
    transition: color 0.2s;
}

.mfa-ts-link:hover {
    color: #fff;
    text-shadow: 0 0 5px var(--mfa-accent);
}

/* Optional: visual cue if locked and cannot skip */
.mfa-ts-link.locked {
    cursor: not-allowed;
    opacity: 0.5;
    text-decoration: none;
    color: #666;
}