/*
 * norithm.com
 * Main Stylesheet
 * Theme: IBM OS/2 Warp 3.0 (Default)
 */

/* --- [1] Root Variables & Global Styles --- */

:root {
    --title-bar-color: #000080;
    --window-bg: #c0c0c0;
    --title-bar-text: #ffffff;
    --text-color: #000000;
    --desktop-bg: #008080;
    --highlight: #dfdfdf;
    --shadow: #808080;
}
* {
    box-sizing: border-box;
}
body {
    background-color: var(--desktop-bg); 
    font-family: Tahoma, "MS Sans Serif", Arial, sans-serif;
    font-size: 16px;
    color: var(--text-color); 
    margin: 0;
    padding: 0;
    padding-top: 70px;
}
a {
    color: var(--title-bar-color); 
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
hr {
    border: none;
    border-top: 2px inset var(--shadow); 
    margin: 20px 0;
}

/* --- [2] Main Layout & Window Components --- */

.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--window-bg); 
    border-bottom: 2px outset var(--highlight); 
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    min-height: 54px; 
}
.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}
.main-nav .site-title {
    font-weight: bold;
    font-size: 1.2em;
}
.main-nav .site-title img {
    max-height: 32px;
    vertical-align: middle;
}
.feed-links {
    border-left: 2px inset var(--shadow);
    padding-left: 15px;
}
/* --- THIS RULE IS FIXED --- */
.feed-links a {
    font-weight: bold;
    color: var(--text-color); /* Was --title-bar-color, causing low contrast */
    text-decoration: none;
    padding: 5px;
}
.feed-links a:hover {
    background: var(--highlight);
}
.user-menu {
    padding-left: 15px;
}
.nav-icons {
    display: flex;
    gap: 10px;
    border-left: 2px inset var(--shadow); 
    padding-left: 15px; 
}

/* --- UPDATED NAV BUTTONS --- */
.nav-button {
    display: inline-flex; /* Use flex to center symbol */
    align-items: center;
    justify-content: center;
    background: var(--window-bg);
    border: 2px outset var(--highlight);
    padding: 4px 10px;
    color: var(--text-color);
    text-decoration: none;
    font-family: inherit;
    font-size: 1.1em;
    cursor: pointer;
    min-width: 40px;
    min-height: 30px; /* Ensure consistent height */
    text-align: center;
    line-height: 1; /* Center symbol vertically */
}
.nav-button:hover {
    text-decoration: none;
}
.nav-button:active {
    border-style: inset;
}

main.content {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}
footer {
    text-align: center;
    color: #fff;
    padding: 20px;
    font-size: 0.9em;
}
.window {
    background: var(--window-bg); 
    border: 2px outset var(--highlight); 
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    margin-bottom: 20px;
}
.title-bar {
    background: var(--title-bar-color); 
    color: var(--title-bar-text); 
    padding: 4px 8px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.window-body {
    padding: 15px;
    min-height: 100px;
}

/* --- [3] Forms & Tables --- */

input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
    border: 2px inset var(--shadow); 
    background: #ffffff;
    padding: 5px;
    font-family: inherit;
    font-size: 1em;
}
textarea {
    width: 100%;
}
button,
input[type="submit"],
input[type="file"]::file-selector-button {
    background: var(--window-bg); 
    border: 2px outset var(--highlight); 
    padding: 5px 15px;
    font-family: inherit;
    font-size: 1em;
    cursor: pointer;
}
button:active,
input[type="submit"]:active,
input[type="file"]::file-selector-button:active {
    border-style: inset;
}
.field-row {
    margin-bottom: 10px;
}
.field-row-stacked {
    margin-bottom: 10px;
}
.field-row-stacked label {
    display: block;
    margin-bottom: 4px;
}
.field-row-stacked input[type="text"],
.field-row-stacked input[type="password"],
.field-row-stacked input[type="email"],
.field-row-stacked textarea,
.field-row-stacked select {
    width: 100%;
}
fieldset {
    border: 2px inset var(--shadow);
    padding: 10px 15px 15px 15px;
    margin-bottom: 15px;
}
legend {
    font-weight: bold;
    padding: 0 5px;
    margin-left: 5px;
}
table {
    width: 100%;
    border-collapse: collapse;
    border: 2px inset var(--shadow); 
}
th, td {
    border: 1px inset var(--shadow); 
    padding: 8px;
    text-align: left;
}
thead th {
    background: var(--window-bg); 
    border-style: outset;
}
tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.3);
}

/* --- [4] UCP & Admin Tabs --- */

menu[role="tablist"] {
    display: flex;
    padding: 0;
    margin: 0;
    border-bottom: 2px solid var(--shadow); 
    flex-wrap: wrap; 
}
menu[role="tablist"] button {
    border: 2px outset transparent;
    border-bottom: none;
    border-radius: 0;
    margin-bottom: -2px; 
    padding: 8px 12px;
}
menu[role="tablist"] button[aria-selected="true"] {
    border-color: var(--highlight); 
    border-bottom-color: var(--window-bg); 
    background: var(--window-bg); 
}
menu[role="tablist"] button[aria-selected="false"] {
    background: var(--shadow); 
    border-color: var(--shadow); 
}
section[role="tabpanel"] {
    padding-top: 20px;
}

/* --- [5] UI Components (Messages, etc) --- */

.message-success {
    background: #e6ffec; border: 1px solid green;
    color: green; padding: 10px; margin-bottom: 15px;
}
.message-error {
    background: #ffebeb; border: 1px solid red;
    color: red; padding: 10px; margin-bottom: 15px;
}
.delete-button {
    background: #c00000; color: #fff;
    border-color: #ff8080 #600000 #600000 #ff8080;
}
.delete-button:active {
    border-color: #600000 #ff8080 #ff8080 #600000;
}

/* --- [6] Homepage (Image Grid & Hashtag Cloud) --- */

.responsive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}
.grid-item {
    border: 2px outset var(--highlight); 
    background: #fff;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}
.grid-item a {
    display: block;
    line-height: 0;
}
.grid-item img {
    width: 100%;
    aspect-ratio: 1 / 1; 
    object-fit: cover;
    display: block;
}
.grid-item .image-meta {
    font-size: 0.85em;
    padding: 5px 8px;
    background: var(--window-bg); 
    border-top: 1px solid var(--shadow); 
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.grid-item .hit-counter {
    font-size: 0.8em;
    padding: 0 8px 5px 8px;
    margin: 0;
    background: var(--window-bg);
}
.followed-indicator {
    color: green; font-weight: bold; font-size: 1.2em;
}
.hashtag-cloud {
    padding: 10px; text-align: center;
}
.hashtag-cloud a {
    display: inline-block; margin: 5px; line-height: 1.2;
}


/* --- [7] Lightbox --- */

#norithm-lightbox {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); z-index: 2000;
    display: none; align-items: center; justify-content: center;
}
#norithm-lightbox.active {
    display: flex;
}
.lightbox-content {
    position: relative; max-width: 90vw; max-height: 90vh;
    display: flex; flex-direction: column;
}
.lightbox-content img {
    max-width: 100%; max-height: calc(90vh - 50px);
    object-fit: contain;
    border: 3px solid var(--highlight); 
}
.lightbox-description {
    background: var(--window-bg); 
    color: var(--text-color); 
    padding: 10px; font-size: 0.9em; text-align: center;
    border: 2px outset var(--highlight); 
    border-top: none; max-width: 100%;
}
.lightbox-controls {
    display: none; 
    background: var(--window-bg);
    color: var(--text-color);
    padding: 8px 10px;
    font-size: 0.9em;
    text-align: right;
    border: 2px outset var(--highlight);
    border-top-style: inset;
}
.lightbox-controls a {
    margin-left: 15px;
    text-decoration: underline;
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: fixed; background: rgba(40,40,40,0.5); color: #fff;
    border: 2px outset #fff; font-family: 'Arial', sans-serif;
    font-weight: bold; cursor: pointer; z-index: 2001; user-select: none;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255,255,255,0.3); color: #000;
}
.lightbox-close:active,
.lightbox-prev:active,
.lightbox-next:active {
    border-style: inset;
}
.lightbox-close {
    top: 20px; right: 20px; font-size: 2.5em; padding: 0 15px;
}
.lightbox-prev,
.lightbox-next {
    top: 50%; transform: translateY(-50%);
    font-size: 3em; padding: 10px 15px;
}
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* --- [8] Admin & UCP Management --- */

.user-management-list {
    display: flex; flex-direction: column; gap: 10px;
}
.user-row {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(255,255,255,0.3); padding: 10px;
    border: 1px inset var(--shadow); flex-wrap: wrap; 
}
.user-info {
    line-height: 1.4; margin-right: 10px;
}
.user-info small {
    color: #333;
}
.user-actions {
    display: flex; gap: 10px; align-items: center;
}
.admin-form {
    display: inline-block; margin: 0;
}
.current-admin-tag {
    font-weight: bold;
    color: var(--title-bar-color); 
    padding: 5px 10px;
    background: var(--highlight); 
    border: 1px outset var(--highlight); 
}
.facet-manage-list {
    display: flex; flex-direction: column; gap: 10px;
}
.facet-row {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(255,255,255,0.3); padding: 10px;
    border: 1px inset var(--shadow); gap: 15px;
}
.facet-info {
    line-height: 1.4; flex-grow: 1; 
}
.facet-info p {
    margin: 0;
}
.manage-thumbnail {
    width: 80px; height: 80px; object-fit: cover;
    border: 2px outset var(--highlight); 
}
.button-link {
    background: var(--window-bg); 
    border: 2px outset var(--highlight); 
    padding: 5px 15px; cursor: pointer;
    text-decoration: none;
    color: var(--text-color); 
    white-space: nowrap; 
}
.button-link:hover {
    text-decoration: none;
}
.button-link:active {
    border-style: inset;
}
.edit-image-layout {
    display: flex; gap: 20px; flex-wrap: wrap; 
}
.edit-image-preview {
    flex-basis: 300px; flex-grow: 1;
}
.edit-image-preview img {
    width: 100%;
    border: 2px outset var(--highlight); 
}
.edit-image-form {
    flex-basis: 300px; flex-grow: 2;
}

/* --- [9] New Styles --- */

.clipboard-button {
    background: var(--window-bg);
    border: 2px outset var(--highlight);
    padding: 2px 8px;
    font-size: 0.9em;
    cursor: pointer;
    margin-left: 10px;
}
.clipboard-button:active {
    border-style: inset;
}
.hit-counter {
    font-size: 0.9em;
    color: var(--text-color);
    opacity: 0.7;
    margin-top: 10px;
}
.grid-item .hit-counter {
    font-size: 0.8em;
    padding: 0 8px 5px 8px;
    margin: 0;
    background: var(--window-bg);
}
.ucp-invites-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}
.ucp-invites-header h3 {
    margin: 0;
}
.topic-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}
.topic-details {
    flex-grow: 1;
}
.topic-follow-action {
    flex-shrink: 0;
    margin-top: 10px;
}
.lightbox-content img {
    cursor: pointer;
}

/* ... [all existing styles] ... */

/* --- [9] New Styles (Continued) --- */

/* Guest Theme Switcher */
.guest-theme-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
    margin-right: 15px;
}
.guest-theme-form label {
    margin-right: 5px;
    font-size: 0.9em;
    font-weight: bold;
    color: var(--text-color);
}
.guest-theme-form select {
    font-size: 0.9em;
    padding: 2px;
}
