:root {
    --header-height: 3rem;
    --color-white: #fff;
    --color-blue: #1e90ff;
    --color-foam: #f5fffa;
    --color-green: #85fb85;
    --color-red: #FF0000;
    --controls-height: 2rem;
    --preview-fullsize: 1400px;
    --preview-scale: 0.2;
}

* {
    font-family: monospace;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    padding-top: var(--header-height);
}

destinations {
    display: block;
}

destination {
    display: block;
    border-bottom: 2px dashed #ddd;
    padding-bottom: 1rem;
    padding-top: 0.25rem;
}

destination cols {
    display: flex;
}

destination preview {
    display: inline-block;
    width: calc(var(--preview-fullsize) * var(--preview-scale));
    height: calc(var(--preview-fullsize) * var(--preview-scale));
    overflow: hidden;
    border: 0.25rem solid var(--color-foam);
    margin: 0.5rem;
    flex-shrink: 0;
    margin-top: -6.25rem;
}

destination preview iframe {
    border: none;
    width: var(--preview-fullsize);
    height: var(--preview-fullsize);
    transform: scale(var(--preview-scale));
    transform-origin: top left;
}

destinations h2, 
destinations h3 {
    padding-left: 2rem;
}

form {
    width: 100%;
    margin: 0 auto;
}

form input {
    display: block;
}

form label[for=title] {
    font-size: 1rem;
    display: block;
}

form input[name=title] {
    font-size: 1.5rem;
    display: block;
    width: 100%;
    margin: 0.5rem 0;
    margin-top: 0;
}

button {
    border: none;
    border-radius: 0.25rem;
    background-color: var(--color-blue);
    padding: 1rem 1.5rem;
    font-size: 1.5rem;
    color: #fff;
    font-weight: bold;
}

form button[type=submit] {
    margin: 1rem 0;
}

controls {
    display: flex;
    position: fixed;
    padding: 0;
    margin: 0;
    height: var(--controls-height);
    top: 0;
    left: 0;
    width: 100%;
    background-color: #ffffe0;
    background-color: var(--color-foam);
    justify-content: center;
    align-items: center;
    z-index: 100;
}

controls span {
    font-size: 1rem;
    color: var(--color-blue);
}

controls a, sidebar nav a {
    color: var(--color-blue);
    font-weight: bold;
}

controls a, controls em {
    font-size: 1rem;
    padding: 0 0.5rem;
}

#page {
    border: none;
    position: absolute;
    top: var(--controls-height);
    left: 40vw;
    width: 60vw;
    height: 100vh;
    z-index: 0;
}

pages {
    display: block;
    width: 100%;
}

pages ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

pages ul li {
    margin: 1rem;
    display: flex;
}

pages ul li a {
    display: block;
    padding: 1rem;
    font-size: 1.5rem;
    background: var(--color-foam);
}

pages ul li a.page-link {
    width: 100%;
    margin-right: 0.25rem;
    position: relative;
}

pages ul li form {
    width: fit-content;
    flex-grow: 0;
    text-transform: uppercase;
    display: block;
    padding: 0 0.25rem;
}

pages ul li form button[type=submit] {
    background: var(--color-foam);
    color: var(--color-blue);
    display: block;
    width: 100%;
    margin: 0;
    border-radius: 0;
}

pages ul li form button[type=submit]:hover {
    background: var(--color-blue);
    color: var(--color-white);
    text-decoration: underline;
    cursor: pointer;
}

pages ul li form.delete-link button[type=submit]:hover {
    background: var(--color-red);
}

pages ul li a.page-link:hover:after {
    content: 'EDIT';
    position: absolute;
    text-decoration: underline;
    right: 1rem;
    color: var(--color-white);
}

pages ul li a.published {
    background: var(--color-green);
}

pages ul li a:hover {
    background: var(--color-blue);
    color: white;
}

sidebar {
    position: absolute;
    left: 0;
    top: var(--controls-height);
    width: 40vw;
    height: 100%;
    display: block;
    padding: 1rem;
    background-color: var(--color-foam);
    overflow-x: hidden;
    overflow-y: auto;
}

sidebar .tab {
    display: none;
}

sidebar .tab.active {
    display: block;
}

sidebar nav {
    margin-bottom: 1rem;
}

sidebar nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: space-between;
}

sidebar nav ul li {
    padding: 0;
    margin: 0;
}

sidebar nav ul li a {
    padding: 0.5rem 1rem;
    text-transform: uppercase;
}

sidebar nav ul li a.active {
    text-decoration: none;
    font-weight: bold;
    color: black;
}

pageeditor form  {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.25rem;
}

pageeditor div.row  {
    width: 100%;
    display: flex;
}

pageeditor fieldset {
    border: none;
}

pageeditor label input[type=checkbox] {
    display: inline;
}

pageeditor div.row fieldset.title {
    width: 55%;
    flex-shrink: 0;
}

pageeditor div.row fieldset.destination select {
    width: 100%;
}

pageeditor button[type=submit] {
    font-size: 1rem;    
    padding: 0.5rem 0.75rem;
    flex-grow: 0;
    transform: translateY(0.25rem);
}

blockeditor {
    height: 100%;
    width: 100%;
    display: block;
}

csseditor, htmleditor {
    display: none;
    background-color: rgba(255, 255, 255, 0.5);
    padding: 0 1rem;
    bottom: 0;
    height: 100%;
}

csseditor form, htmleditor form {
    width: 100%;
}

csseditor pre, htmleditor pre {
    width: 100%;
    height: 42rem;
}

imageeditor {
    height: 100%;
}

imageeditor iframe {
    border: none;
    height: 100%;
    width: 100%;
    display: block;
}

themeeditor ol {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

themeeditor ol li {
    font-size: 6rem;
    line-height: 6rem;
    color: var(--color-blue);
}

themeeditor ol input[type=color] {
    height: 6rem;
    width: 10rem;
    margin: 0.5rem 0;
    margin-right: 1rem;
}

image-list {
    width: 100vw;
    height: 100vh;
    display: block;
    overflow-y: scroll;
}

month {
    display: block;
    padding: 0;
    padding-bottom: 1.5rem;
    margin: 0;
    border-top: 0.125rem solid #eee;
}

month:nth-child(odd) {
    background-color: #ffffe0;
    background-color: #f5fffa;
    background-color: #f0f8ff;
    border-top: 0.25rem solid #87cefa;
    border-bottom: 0.5rem solid #87cefa;
}

month h3 {
    text-align: center;
    margin: 0;
    padding: 0.5rem 0;
    font-size: 1.35rem;
    line-height: 1;
    font-weight: normal;
    position: sticky;
    top: 0;
    background-color: #fff;
}

month:nth-child(odd) h3 {
    background-color: #f0f8ff;
}

month ul {
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

month ul li {
    list-style-type: none;
    margin: 0;
    padding: 0;
    height: 100px;
}

month ul li img {
    height: 100%;
}

modal {
    display: none;
}

msgs {
    display: block;
    position: fixed;
    top: 20rem;
    right: 0;
    left: 0;
    margin: auto;
    width: 20rem;
}

msgs msg {
    display: block;
    background: var(--color-blue);
    color: var(--color-foam);
    padding: 1rem;
    margin: 1rem;
    cursor: pointer;
}

msgs msg .msg {
    margin: 0;
    font-size: 2rem;
}

msgs msg button {
    margin-top: 1rem;
    color: var(--color-blue);
    background: var(--color-foam);
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}

controls form {
    display: inline;
    width: auto;
    margin: 0;
}

controls form button {
    background: none;
    border: none;
    color: var(--color-blue);
    font-weight: bold;
    font-size: 1rem;
    padding: 0 0.5rem;
    cursor: pointer;
    text-decoration: underline;
}

controls form button:hover {
    text-decoration: none;
}

/* Media Upload Modal Styles */
.pom-media-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100000;
}

.pom-media-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    width: 80%;
    max-width: 900px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    z-index: 100001;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.pom-media-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #ddd;
}

.pom-media-modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.pom-media-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: #666;
}

.pom-media-modal-close:hover {
    color: #000;
}

.pom-media-modal-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
}

.pom-media-modal-tabs button {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    color: #666;
}

.pom-media-modal-tabs button:hover {
    color: #333;
}

.pom-media-modal-tabs button.active {
    border-bottom-color: var(--color-blue);
    color: var(--color-blue);
}

.pom-media-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    min-height: 300px;
}

.pom-media-upload-zone {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pom-media-upload-dropzone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 60px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.pom-media-upload-dropzone:hover {
    border-color: var(--color-blue);
}

.pom-media-upload-dropzone.dragging {
    border-color: var(--color-blue);
    background-color: rgba(30, 144, 255, 0.05);
}

.pom-media-upload-dropzone p {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.pom-media-upload-hint {
    color: #666 !important;
    font-size: 12px !important;
    margin-top: 8px !important;
}

.pom-media-library {
    min-height: 200px;
}

.pom-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.pom-media-item {
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s;
    background: #f0f0f0;
}

.pom-media-item:hover {
    border-color: var(--color-blue);
}

.pom-media-item.selected {
    border-color: var(--color-blue);
    box-shadow: 0 0 0 2px rgba(30, 144, 255, 0.3);
}

.pom-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pom-media-item-placeholder {
    width: 100%;
    height: 100%;
    background: #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    text-align: center;
}

.pom-media-item-type {
    font-weight: bold;
    text-transform: uppercase;
    font-size: 12px;
    color: #666;
}

.pom-media-item-filename {
    font-size: 10px;
    color: #999;
    word-break: break-all;
    margin-top: 4px;
}

.pom-media-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid #ddd;
    background: #f9f9f9;
}

.pom-media-modal-confirm {
    background: var(--color-blue);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.pom-media-modal-confirm:hover {
    background: #1a7ad9;
}
