/* Basic */

body {
    padding: 0;
    background: black;
    max-width: 800px;
    margin: 0 auto;
    font-family: sans-serif;
}

.no-margin {
    margin: 0 0;
}
.no-padding {
    padding: 0 0;
}

/* Header */

div#header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 10px;
}
img#logo {
    height: 30px;
    display:block;
    padding-right:20px;
}
form {
    display: block; 
    width: 100%;
    margin: 0 0;
    padding: 0 0;
}
input#search-input {
    width: 100%;
    height: 30px;
    display:block;
    background-color: #333;
    color: #dfdfdf;
    border: none;
    border-radius: 5px;
    padding: 5px 10px;
}

.header-icons {
    margin-left: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}
.icon-link {
    color: #666;
    text-decoration: none;
    transition: color 0.2s;
}
.icon-link:hover {
    color: #fff;
}
.dropdown-toggle {
    background-image: url('../img/icon-gender.png');
    background-size: 24px 24px;
    width: 24px;
    height: 24px;
    display: inline-block;
    filter: invert(40%);
}
.dropdown-toggle:hover {
    filter: invert(100%);
}
.dropdown:hover .dropdown-toggle {
    filter: invert(100%);
}

/* Orientation rows carry an icon. Render it in a ::before so the icon (not the
   whole row) is colour-shifted — keeps the row styled identically to the other
   filter rows. left:14px gives the icon the same inset as the row padding. */
.filter-row.category-toggle {
    position: relative;
    padding-left: 46px;
}
.category-toggle::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background-size: 24px 24px;
    background-repeat: no-repeat;
    background-position: center;
    filter: invert(72%);
}
.filter-row.category-toggle.active::before { filter: invert(100%); }
.category-toggle[data-category="straight"]::before { background-image: url('../img/icon-couple-24.png'); }
.category-toggle[data-category="gay"]::before      { background-image: url('../img/icon-homosexual-24.png'); }
.category-toggle[data-category="trans"]::before    { background-image: url('../img/icon-transgender-24.png'); }

.dropdown {
    position: relative;
    display: inline-block;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 4px;
    stroke: #5c5c5c;

}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: #1a1a1a;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 4px;
    stroke: #5c5c5c;
    padding-top: 10px;
    padding-bottom: 10px;
    margin-top: 0px;
    /* border: 1px solid #333333; */
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.3);
}

.dropdown-content a {
    color: #5c5c5c;
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 20px 15px 20px;
    margin-left: 20px
}

.dropdown-content a:not(.active):hover {
    margin-left: 40px;
    transition: margin-left 0.3s ease;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.category-toggle svg {
    width: 20px;
    height: 20px;
}

.dropdown-content .category-toggle[data-category="straight"].active,
.dropdown-content .category-toggle[data-category="gay"].active,
.dropdown-content .category-toggle[data-category="trans"].active {
    color: #000;
    filter: invert(100%);
}

/* Video Page */


div#under-video-left {
    float: left;
    display: inline;
}
div#under-video-left span {
    color: #b9b9b9;
}
div#under-video-right {
    float: right;
    color: #b9b9b9;
    display: inline;
}
span#tags {
    display: block;
    clear: both;
    padding-top: 20px;
    margin-bottom: 40px;
}
span#pornstars {
    display: block;
    clear: both;
    margin-top: 60px;
}
span#pornstars a {
    clear: both;
    color: #b9b9b9;
    margin-right: 5px;
    padding: 3px 6px;
    border-radius: 5px; 
    background-color: #373737;
    line-height: 30px;
    text-decoration: none;
    font-weight: bold;
}
span#tags a {
    color: #b9b9b9;
    margin: 5px;
    padding: 3px 6px;
    border-radius: 5px; 
    background-color: #1e1e1e;
    line-height: 30px;
    text-decoration: none;
}

span#tags a:hover, span#pornstars a:hover {
    background-color: #005582;
}

/* Video List Page */

div.intro {
    color: #fff;
    padding: 0 0 20px;
    text-align: center;
    font-weight: 100;
}

div.intro p b {
    color: #f34c4f;
    font-weight: 600;
}

div.intro p u {
    text-decoration: none;
    border-bottom: 1px solid white;
}

div.sort-options {
    padding: 10px 0 20px;
}
div.sort-options span {
    margin-right: 10px;
    color: #b9b9b9;
}
div.sort-options div.options {
    float: right;
}
div.sort-options a {
    color: #b9b9b9;
    text-decoration: none;
    margin-left: 10px;
    padding: 5px 10px;
    border-radius: 5px;
}
div.sort-options a.active {
    color: #fff;
    background-color: #005582;
}
div#video-container {
    width: 100%;
    background-color: #333;
    margin: 20px auto;
    padding: 0;
    clear: both;
}

/* Shown in place of the player when playback is impossible (geo-block,
   removed upstream, proxy failure) — see showPlayerError() in video.html. */
.player-error {
    aspect-ratio: 16 / 9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: #111;
    color: #b9b9b9;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}
.player-error p { margin: 0; font-size: 15px; }
.player-error a {
    color: #fff;
    background: #f34c4f;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
}
.player-error a:hover { background: #d83b3e; }

h1 {
    color: #b9b9b9;
    margin: 0 0;
    font-weight: 500;
}

h3 {
    color: #b9b9b9;
}

div#video-page-container {
    padding: 40px 0;
}

/* Text content gets the standard 10px gutter; the player (#video-container)
   and the related-videos grid stay full-bleed. */
div#video-page-container h1,
div#under-video-left,
div#under-video-right,
span#pornstars,
span#tags,
div#related-videos h3 {
    padding-left: 10px;
    padding-right: 10px;
}

div.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #fff;
    font-size: 14px;
    font-family: sans-serif;
    content: "Loading...";
}

.grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: black;
    padding: 0;
    width: 100% !important; /* max-width is set on the body element 
    This is only needed due to an iOS/Safari mobile quirk. */

}

.video-container {
    position: relative;
    background: #333;
    width: 100%;
}

.video-container::before {
    content: "";
    display: block;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
}

.video-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.video-js {
    width: 100%;
    height: 100%;
}


/* Likes Page */

.likes-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.likes-header {
    margin-bottom: 20px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.video-card a {
    text-decoration: none;
}
.video-card {
    position: relative;
    overflow: hidden;
}

.video-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.video-info {
    padding: 10px 0;
}

.video-title {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    max-height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.liked-at {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.no-likes {
    text-align: center;
    padding: 50px;
    color: #666;
}

/* Auth Page */

.auth-container {
    background: #131313;
    padding: 30px;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    margin: 40px auto;
}

.tabs {
    display: flex;
    margin-bottom: 40px;
    border-bottom: 2px solid #333;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 16px;
    color: #666;
}

.tab.active {
    color: #b9b9b9;
    border-bottom: 2px solid #b9b9b9;
    margin-bottom: -2px;
}

.form-group {
    margin-bottom: 15px;
}

.auth-container label {
    display: block;
    margin-bottom: 5px;
    color: #666;
}

.auth-container input {
    width: 100%;
    padding: 8px;
    background-color: #333;
    color: #dfdfdf;
    border: 1px solid #444;
    border-radius: 4px;
}

.auth-container button {
    width: 100%;
    padding: 10px;
    color: #b9b9b9;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.auth-container button[type="submit"] {
    width: 100%;
    padding: 10px;
    margin-top: 40px;
    background-color: #005582;
    color: #b9b9b9;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
}

.auth-container button:hover {
    background-color: #444;
}

.error {
    color: #ff4444;
    margin-top: 20px;
    text-align: center;
}

.success {
    color: #44ff44;
    margin-top: 20px;
    text-align: center;
}
/* Server-rendered grid tiles: crawlable link that doesn't affect layout */
.video-permalink {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.video-permalink .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Daily-visit streak pill in the header */
.streak-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 13px;
    font-weight: 600;
    color: #b9b9b9;
    white-space: nowrap;
    cursor: default;
    vertical-align: middle;
}

.streak-pill.complete {
    background: rgba(255, 120, 0, 0.18);
    border-color: rgba(255, 120, 0, 0.5);
    color: #ffb066;
}

/* --- Grid pages: search moves out of the header, above the filters --- */

.grid-page #search-form {
    display: none; /* header search is replaced by .search-form-main below */
}

.grid-page div#header {
    justify-content: space-between; /* logo left, icons right, no squeezed search */
}

.search-form-main {
    display: block;
    padding: 0 10px 10px;
}

.search-form-main input[type="search"] {
    width: 100%;
    box-sizing: border-box;
    background-color: #333;
    color: #dfdfdf;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 16px; /* >=16px stops iOS zooming the page on focus */
    -webkit-appearance: none;
}

.search-form-main input[type="search"]:focus {
    outline: 1px solid #005582;
}

/* Sort options: flexbox instead of floats so it wraps cleanly on mobile */
div.sort-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 10px 15px;
}

div.sort-options span {
    margin-right: 4px;
}

div.sort-options div.options {
    float: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

div.sort-options a {
    margin-left: 0;
    white-space: nowrap;
}

/* Search row: input + (on mobile) the sort dropdown share one row */
.search-form-main {
    display: flex;
    gap: 8px;
    align-items: stretch;
    /* the global `form { width: 100% }` rule + our 10px side padding
       otherwise renders 20px wider than the viewport (horizontal scroll) */
    box-sizing: border-box;
}

.search-form-main input[type="search"] {
    width: 100%;
}

/* Tiny field captions above the controls */
.search-form-main .field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.search-form-main .search-field {
    flex: 1 1 auto;
    min-width: 0;
}

.search-form-main .sort-field {
    max-width: 45%;
}

.field-label {
    font-size: 9px;
    line-height: 1;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #8a8a8a;
    padding-left: 4px;
    user-select: none;
}

.sort-select {
    width: 100%;
    box-sizing: border-box;
    flex: 1 1 auto; /* match the input's height under equal labels */
    background-color: #333;
    color: #dfdfdf;
    border: none;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 16px; /* >=16px stops iOS zoom-on-focus */
}

/* Desktop: button row; mobile: dropdown in the search row */
@media (min-width: 640px) {
    /* .search-form-main .field's display:flex outranks a bare .sort-field
       (0,2,0 vs 0,1,0 — media queries add no specificity), so match it and
       add the third class to win regardless of rule order. */
    .search-form-main .field.sort-field { display: none; }
}
@media (max-width: 639.98px) {
    div.sort-options { display: none; }
}

/* Amateur / HD toggles in the categories dropdown */
.dropdown-divider {
    border-top: 1px solid #333;
    margin: 6px 16px;
}

.dropdown-content .pref-toggle.active,
.dropdown-content .source-toggle.active {
    color: #fff;
    font-weight: 600;
}

.dropdown-content .pref-toggle.active::after,
.dropdown-content .source-toggle.active::after {
    content: "\2713";
    margin-left: auto;
    color: #f34c4f;
}

/* Condensed top-of-page: hide the intro copy and the header streak pill so the
   nav bar sits directly above the quick-filters row. (!important beats the
   inline display streak.js sets.) */
div.intro { display: none; }
#streak-pill { display: none !important; }

/* Grid pages open the filters modal from the quick-filters row, so the header
   icon is redundant there. Kept in the DOM — the row's JS .click()s it — and
   still visible on video/likes pages, which have no quick-filters row. */
.grid-page #filters-open { display: none; }

/* Hide the login/logout icon; /auth and /auth/logout still work by URL. */
.header-icons a[title="Login"],
.header-icons a[title="Logout"] { display: none; }

/* Tagline fills the space the streak pill used to occupy. Grid pages only —
   elsewhere the header search form needs the middle of the bar. */
.header-tagline { display: none; }
.grid-page .header-tagline {
    display: block;
    color: #8a8a8a;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* --- Quick filters: read-only snapshot of the modal state as one row above
   search. Clicking anywhere on the row opens the filters modal. --- */
.quick-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 10px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.qf-icon,
.qf-letter {
    width: 24px;
    height: 24px;
    padding: 4px;
    box-sizing: content-box;
}

.qf-icon {
    background-size: 24px 24px;
    background-repeat: no-repeat;
    background-position: center;
    filter: invert(35%);
}
.qf-icon.active { filter: invert(100%); }
.qf-icon[data-value="straight"] { background-image: url('../img/icon-couple-24.png'); }
.qf-icon[data-value="gay"]      { background-image: url('../img/icon-homosexual-24.png'); }

/* Trans is a plain letter; colours track the icons' invert() greys. */
.qf-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #595959;
    font-size: 17px;
    font-weight: 400;
    line-height: 1;
}
.qf-letter.active { color: #fff; }

.qf-divider {
    width: 1px;
    align-self: stretch;
    background: #333;
    margin: 2px 4px;
}

.qf-pill {
    padding: 5px 12px;
    border-radius: 999px;
    background: #262626;
    border: 1px solid transparent;
    color: #8a8a8a;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}
.qf-pill.active {
    background: #2b3a44;
    border-color: #005582;
    color: #fff;
}

/* --- Filters modal (replaces the hover dropdown; works on touch) --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-panel {
    background: #1a1a1a;
    border-radius: 12px;
    width: 100%;
    max-width: 380px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 4px 20px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: #1a1a1a;
    padding: 16px 0 8px;
}

.modal-head h2 {
    margin: 0;
    font-size: 18px;
    color: #fff;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.modal-close:hover { color: #fff; }

.filter-group { margin-top: 18px; }

.filter-group-title {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #f34c4f;
    font-weight: 700;
    margin-bottom: 2px;
}

.filter-group-desc {
    font-size: 12px;
    color: #777;
    margin-bottom: 8px;
}

.filter-row {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 12px 14px;
    margin: 6px 0;
    border-radius: 8px;
    background: #262626;
    color: #cfcfcf;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
}

.filter-row .filter-name { font-weight: 600; }
.filter-row .filter-note { font-size: 12px; color: #888; }

.filter-row.active {
    background: #2b3a44;
    border-color: #005582;
    color: #fff;
}
.filter-row.active .filter-name::after {
    content: "\2713";
    color: #f34c4f;
    float: right;
    font-weight: 700;
}

/* Apply bar — changes are staged until this is clicked (or the modal dismissed). */
.modal-actions {
    position: sticky;
    bottom: 0;
    background: #1a1a1a;
    padding: 14px 0 4px;
    margin-top: 18px;
}
.filter-apply {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #f34c4f;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.filter-apply:hover { background: #d83b3e; }
