* {
    box-sizing: border-box;
    font-size: inherit;
    font-family: "Ubuntu Mono", monospace;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    line-height: 1.5;
    color: #34495E;
    background-color: #F1F3F6;
    overflow-y: scroll;
    margin: 0;
    padding: 0;
}

header {
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 700px;
    margin: 0 auto;
}

nav {
    width: 100%;
    background: #F7F9FA;
    border: 1px solid #E4E5E7;
    margin-bottom: 1rem;
}

nav > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    max-width: 700px;
    margin: 0 auto;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

nav a.live {
    position: relative;
    color: #34495E;
    cursor: default;
}

nav a.live:hover {
    text-decoration: none;
}

nav a.live:after {
    content: '';
    display: block;
    position: absolute;
    left: calc(50% - 7px);
    top: 100%;
    margin-top: 9px;
    width: 14px;
    height: 14px;
    background: #F7F9FA;
    border-left: 1px solid #E4E5E7;
    border-bottom: 1px solid #E4E5E7;
    transform: rotate(-45deg);
}

footer {
    position: sticky;
    top: 100vh;
    padding: 1rem;
    max-width: 700px;
    margin: 0 auto;
}

h1 {
    font-size: 2rem;
}


h1 a {
    color: #34495E;
    text-decoration: none;
    font-size: 36px;
    font-weight: bold;
    background-image: url("/static/img/icons/unix-logo.svg");
    background-repeat: no-repeat;
    background-position: 0px 0px;
    height: 36px;
    padding-left: 60px;
    position: relative;
}

h1 a:hover {
    color: #34495E;
    text-decoration: none;
    cursor: default;
}

h2 {
    font-size: 1.5rem;
}

main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 700px;
    margin: 0 auto;
    padding: 1rem;
}

main form > div {
    margin-bottom: 1rem;
}

a {
    color: #62CB31;
    text-decoration: none;
}

a:hover {
    color: #4EB722;
    text-decoration: underline;
}

label {
    display: block;
}

input {
    padding: 0.5rem;
    font-size: 16px !important;
}

input[name="q"] {
    font-size: 16px !important;
}

button {
    height: 2rem;
    cursor: pointer;
    padding: 0 1rem;
}

table {
    background: white;
    border: 1px solid #E4E5E7;
    border-collapse: collapse;
    width: 100%;
}

td, th {
    padding: 9px 18px;
}

th:last-child, td:last-child {
    color: #6A6C6F;
}

tr {
    border-bottom: 1px solid #E4E5E7;
}

tbody tr:nth-child(odd) {
    background-color: #F7F9FA;
}


.error {
    color: red;
}

span.error {
    display: block;
}

.success {
    color: green;
}

span.success {
    display: block;
}

ul {
    padding-left: 1.5rem;
}

/* Note page styles */

.snippet {
    background-color: #FFFFFF;
    border: 1px solid #E4E5E7;
    border-radius: 3px;
}

.snippet pre {
    padding: 18px;
    border-top: 1px solid #E4E5E7;
    border-bottom: 1px solid #E4E5E7;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    overflow-x: auto;
}

.snippet .metadata {
    background-color: #F7F9FA;
    color: #6A6C6F;
    padding: 0.75em 18px;
    overflow: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.snippet .extraMetadata {
    background-color: #F7F9FA;
    color: #6A6C6F;
    padding: 0.75em 18px;
}

.snippet .metadata strong {
    color: #34495E;
}

.snippet .metadata time {
    display: inline-block;
}

.snippet .metadata time:first-child {
    float: left;
}

.snippet .metadata time:last-child {
    float: right;
}

.button-group {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
}

.metadata button {
    margin: 0;
}

.snippet-html-content {
    padding: 18px;
    border-top: 1px solid #E4E5E7;
    border-bottom: 1px solid #E4E5E7;
    line-height: 1.6;
}

.snippet-html-content h1,
.snippet-html-content h2,
.snippet-html-content h3,
.snippet-html-content h4,
.snippet-html-content h5,
.snippet-html-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: #2C3E50;
}

.snippet-html-content h1:first-child,
.snippet-html-content h2:first-child,
.snippet-html-content h3:first-child,
.snippet-html-content h4:first-child,
.snippet-html-content h5:first-child,
.snippet-html-content h6:first-child {
    margin-top: 0;
}

.snippet-html-content h1 { font-size: 2rem; }
.snippet-html-content h2 { font-size: 1.5rem; }
.snippet-html-content h3 { font-size: 1.25rem; }
.snippet-html-content h4 { font-size: 1.125rem; }
.snippet-html-content h5 { font-size: 1rem; }
.snippet-html-content h6 { font-size: 0.875rem; }

.snippet-html-content p {
    margin-bottom: 1rem;
}

.snippet-html-content ul,
.snippet-html-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.snippet-html-content li {
    margin-bottom: 0.5rem;
}

.snippet-html-content blockquote {
    margin: 1rem 0;
    padding-left: 1rem;
    border-left: 4px solid #E4E5E7;
    color: #7F8C8D;
}

.snippet-html-content code {
    background-color: #F1F3F6;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: "Ubuntu Mono", monospace;
}

.snippet-html-content pre {
    background-color: #F1F3F6;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1rem 0;
}

.snippet-html-content pre code {
    background-color: transparent;
    padding: 0;
}

.snippet img {
    max-width: 100%;
    height: auto;
}

.snippet-html-content img {
    max-width: 100%;
    height: auto;
}

/* Table of Contents styling */
.snippet-html-content > ul:first-child {
    /* background-color: #F7F9FA;
    border: 1px solid #E4E5E7; */
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 2rem;
}

.snippet-html-content > ul:first-child:before {
    content: "Table of Contents";
    display: block;
    font-weight: bold;
    color: #2C3E50;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.snippet-html-content > ul:first-child li {
    margin-bottom: 0.25rem;
}

.snippet-html-content > ul:first-child a {
    color: #34495E;
    text-decoration: none;
}

.snippet-html-content > ul:first-child a:hover {
    color: #62CB31;
    text-decoration: underline;
}

/* Tag styling */
.tag {
    background-color: #e0e7ff;
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 4px;
    display: inline-block;
}

/* Toggle switch styling - Eye icon as background */
.public-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.public-toggle img {
    display: none; /* Hide the external eye icon */
}

.public-toggle input[type="checkbox"] {
    appearance: none;
    width: 60px;
    height: 32px;
    background-color: #E4E5E7;
    background-image: url('/static/img/lock.svg');
    background-size: 18px 18px;
    background-repeat: no-repeat;
    background-position: right 10px center; /* Lock on right side when OFF (private) */
    border-radius: 16px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease, background-position 0.2s ease, background-image 0.2s ease;
    opacity: 0.6;
}

.public-toggle input[type="checkbox"]:checked {
    background-color: #ffb3ba;
    background-image: url('/static/img/eye.svg');
    background-position: left 10px center; /* Eye on left side when ON (public) */
    opacity: 1;
}

.public-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.public-toggle input[type="checkbox"]:checked::before {
    transform: translateX(28px);
}

/* Responsive design for snippet metadata on smaller screens */
/* This media query applies styles only when screen width is 768px or smaller */
@media (max-width: 768px) {
    .snippet .metadata {
        /* Change flex direction from row (default) to column-reverse */
        /* column-reverse stacks items vertically with button-group on top, h2 below */
        flex-direction: column-reverse;

        /* Change alignment from center to flex-start (left-aligned) */
        /* This prevents items from being centered when stacked vertically */
        align-items: flex-start;

        /* Add space between the stacked items */
        /* Without this, the h2 and button-group would touch each other */
        gap: 1.5rem;
    }

    .snippet .metadata .button-group {
        /* Align the button group to the right side of the container */
        /* align-self overrides the parent's align-items for this specific item */
        align-self: flex-end;
    }
}