/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Scrollbar styling */
*::-webkit-scrollbar {
    width: 16px;
    height: 16px;
    background: #c0c0c0;
}

*::-webkit-scrollbar-track {
    background: #c0c0c0;
}

*::-webkit-scrollbar-thumb {
    background: #808080;
    border: 1px solid #c0c0c0;
    box-shadow: inset 1px 1px #dfdfdf, inset -1px -1px #0a0a0a;
}

*::-webkit-scrollbar-button:single-button {
    background: #c0c0c0;
    border: 1px solid #ffffff;
    border-bottom-color: #404040;
    border-right-color: #404040;
    height: 16px;
    width: 16px;
    display: block;
}

body {
    font-family: 'W95FA', 'MS Sans Serif', 'Microsoft Sans Serif', sans-serif;
    background-color: #008080;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    font-size: 12px;
    cursor: url("img/icons/magnify.png"), default;
}

/* Window styles */
.blog-window {
    background-color: #c0c0c0;
    border: 1px solid #000000;
    width: 1400px;
    height: 900px;
    display: flex;
    flex-direction: column;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* Title bar */
.title-bar {
    background: #000080;
    color: white;
    padding: 2px 3px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 18px;
    font-size: 11px;
}

.title-bar .title {
    display: flex;
    align-items: center;
    gap: 4px;
}

.title-icon {
    width: 16px;
    height: 16px;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    flex-shrink: 0;
}

.window-controls {
    display: flex;
    gap: 1px;
}

.window-controls button {
    width: 14px;
    height: 12px;
    background-color: #c0c0c0;
    border: 1px solid #ffffff;
    border-bottom-color: #404040;
    border-right-color: #404040;
    font-size: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.window-controls button:disabled {
    cursor: default;
    pointer-events: none;
}

/* Menu bar */
.menu-bar {
    display: flex;
    background-color: #c0c0c0;
    border-bottom: 1px solid #808080;
    padding: 1px 2px;
    font-size: 11px;
}

.menu-item {
    padding: 1px 6px;
    cursor: pointer;
}

.menu-item:hover {
    background-color: #000080;
    color: white;
}

/* Toolbar */
.toolbar {
    background-color: #c0c0c0;
    padding: 2px;
    border-bottom: 1px solid #808080;
    display: flex;
    justify-content: space-between;
    gap: 1px;
}

.toolbar-left {
    display: flex;
    gap: 1px;
}

.toolbar-right {
    display: flex;
    gap: 1px;
}

.tool-button {
    padding: 1px 8px 1px 24px;
    background-color: #c0c0c0;
    border: 1px solid #ffffff;
    border-bottom-color: #404040;
    border-right-color: #404040;
    cursor: pointer;
    font-size: 11px;
    height: 24px;
    position: relative;
    display: flex;
    align-items: center;
    font-family: 'W95FA', monospace;
}

.tool-button[data-action="font-increase"],
.tool-button[data-action="font-decrease"] {
    padding: 1px 8px 1px 24px;
}

.tool-button::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-size: 16px 16px;
    background-repeat: no-repeat;
    background-position: 0 0;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.tool-button[data-action="new"]::before {
    background-image: url('../img/icons/substack-click.png');
}

.tool-button[data-action="about-page"]::before {
    background-image: url('../img/icons/help16.png');
}

.tool-button[data-action="font-increase"]::before {
    background-image: url('../img/icons/font-inc.png');
}

.tool-button[data-action="font-decrease"]::before {
    background-image: url('../img/icons/font-dec.png');
}

.tool-button[data-action="home"]::before {
    background-image: url('../img/icons/home16.png');
}

.tool-button[data-action="toggle-menu"]::before {
    background-image: url('../img/icons/posts.png');
}

.tool-button:active {
    border-color: #404040;
    border-bottom-color: #ffffff;
    border-right-color: #ffffff;
}

/* Hide mobile menu toggle on desktop */
.mobile-menu-toggle {
    display: none;
}

/* Content area */
.content-area {
    display: flex;
    flex: 1;
    border-top: 1px solid #ffffff;
    min-height: 0;
    position: relative;
}

/* Post list */
.post-list {
    width: 300px;
    background-color: white;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 4px solid #c0c0c0;
    position: relative;
    min-width: 150px;
}

.post-list::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: ew-resize;
    background: #c0c0c0;
    border-left: 1px solid #808080;
    border-right: 1px solid #ffffff;
}

/* Remove the separate divider element styles */
.divider {
    display: none;
}

.post-header {
    position: sticky;
    top: 0;
    background: #c0c0c0;
    display: flex;
    border-bottom: 1px solid #808080;
    padding: 2px 4px;
    font-size: 11px;
    z-index: 1;
    gap: 8px;
    min-width: 0;
}

.header-title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-date {
    flex: 0 0 65px;
    text-align: right;
}

.post-list-container {
    flex: 1;
    overflow-y: scroll;
    background: white;
}

.post {
    display: flex;
    padding: 4px 4px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    font-size: 11px;
    height: 28px;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.post-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.post-date {
    flex: 0 0 65px;
    text-align: right;
    color: #000000;
}

.post:hover {
    background-color: #e8e8e8;
}

.post.active {
    background-color: #000080;
    color: white;
}

.post.active .post-date {
    color: white;
}

/* Post viewer */
.post-viewer {
    flex: 1;
    background-color: white;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 200px;
}

.viewer-header {
    background: #e6e6e6;
    padding: 1em;
    border-bottom: 2px groove #ffffff;
    font-family: 'W95FA', monospace;
}

.viewer-header .subject {
    font-size: 1em;
    margin-bottom: 8px;
    padding-left: 24px;
    position: relative;
}

.viewer-header .subject::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url('../img/icons/text.png');
    background-size: contain;
    background-repeat: no-repeat;
}

.viewer-header .subtitle {
    font-size: 0.9em;
    color: #666666;
    margin-bottom: 12px;
    padding-left: 24px;
    font-style: italic;
}

.viewer-header .header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.viewer-header .date {
    color: #666666;
    font-size: 1em;
    padding: 4px 8px;
    background: #f0f0f0;
    display: inline-block;
    border: 1px solid #c0c0c0;
    box-shadow: inset 1px 1px #ffffff, inset -1px -1px #808080;
}

.substack-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 24px;
    background: #c0c0c0;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    text-decoration: none;
    color: #000;
    font-family: 'W95FA', monospace;
    font-size: 11px;
    box-shadow: inset 1px 1px 0px #fff, inset -1px -1px 0px #0a0a0a;
    cursor: pointer;
    position: relative;
}

.substack-button::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url('../img/icons/goto-arrow.png');
    background-size: 16px 16px;
    background-repeat: no-repeat;
    background-position: 0 0;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.substack-button:hover {
    background: #d4d0c8;
}

.substack-button:active {
    border-color: #808080 #fff #fff #808080;
    box-shadow: inset 1px 1px 0px #0a0a0a;
    padding-top: calc(4px + 1px);
    padding-left: calc(12px + 1px);
    padding-bottom: calc(4px - 1px);
    padding-right: calc(12px - 1px);
}

.viewer-content {
    flex: 1;
    overflow-y: scroll;
    padding: 16px;
}

/* Status bar */
.status-bar {
    background-color: #c0c0c0;
    border-top: 1px solid #808080;
    padding: 2px 4px;
    font-size: 11px;
    height: 20px;
    display: flex;
    align-items: center;
}

/* Markdown content styling */
.markdown-content {
    font-family: 'W95FA', monospace;
    line-height: 1.5;
    font-size: 12px;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    font-family: 'W95FA', monospace;
    margin: 16px 0 8px;
}

.markdown-content h1 {
    font-size: 1em;
    margin-top: 0;
    padding: 2px 6px;
    background: #c0c0c0;
    border-top: 1px solid #dfdfdf;
    border-left: 1px solid #dfdfdf;
    border-right: 1px solid #808080;
    border-bottom: 1px solid #808080;
}

.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    border-bottom: 1px solid #c0c0c0;
    padding-bottom: 2px;
    font-size: 1em;
}

/* Remove individual font size declarations */
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 { font-size: 1em; }

/* Handle bold and underline styles */
.markdown-content strong,
.markdown-content b {
    font-weight: normal;
    text-decoration: underline;
}

.markdown-content u {
    text-decoration: underline;
    font-style: italic;
}

/* Link styling */
.markdown-content a {
    color: #000080;
    text-decoration: underline;
}

.markdown-content a:hover {
    color: #0000ff;
}

.markdown-content a:visited {
    color: #551a8b;
}

.markdown-content p {
    margin: 8px 0;
}

.markdown-content ul,
.markdown-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.markdown-content li {
    margin: 4px 0;
}

.markdown-content code {
    font-family: 'W95FA', monospace;
    background: #f0f0f0;
    padding: 2px 4px;
    border: 1px solid #d4d0c8;
}

.markdown-content pre {
    background: #f0f0f0;
    padding: 8px;
    border: 1px solid #d4d0c8;
    margin: 8px 0;
}

.markdown-content pre code {
    background: none;
    border: none;
    padding: 0;
}

.markdown-content blockquote {
    margin: 8px 0;
    padding: 8px 16px;
    border-left: 4px solid #d4d0c8;
    background: #f0f0f0;
}

.markdown-content table {
    border-collapse: collapse;
    margin: 8px 0;
    width: 100%;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid #d4d0c8;
    padding: 4px 8px;
    text-align: left;
}

.markdown-content th {
    background: #e6e6e6;
}

.markdown-content tr:nth-child(even) {
    background: #f0f0f0;
}

/* Hide date columns when post list gets too narrow */
@media (max-width: 200px) {
    .post-list .header-date,
    .post-list .post-date {
        display: none;
    }
    
    .post-header,
    .post {
        gap: 0;
    }
}

/* Mobile styles */
@media (max-width: 768px) {
    body {
        padding: 0;
        align-items: flex-start;
    }

    .blog-window {
        width: 100%;
        height: 100vh;
        max-width: 100%;
        border: none;
        border-radius: 0;
    }

    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex !important;
    }

    /* Mobile overlay */
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .mobile-overlay.active {
        display: block;
    }

    /* Hide post list by default on mobile */
    .post-list {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        width: 80%;
        max-width: 300px;
        z-index: 1000;
        transition: left 0.3s ease;
        border-right: 4px solid #c0c0c0;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
    }

    /* Show post list when toggled */
    .post-list.mobile-open {
        left: 0;
    }

    /* Make post viewer full width on mobile */
    .post-viewer {
        width: 100%;
    }

    /* Adjust content area for mobile */
    .content-area {
        position: relative;
    }

    /* Hide divider on mobile */
    .divider {
        display: none;
    }

    /* Adjust toolbar for mobile */
    .toolbar {
        flex-wrap: wrap;
        gap: 2px;
    }

    .toolbar-left,
    .toolbar-right {
        flex-wrap: wrap;
    }

    .tool-button {
        font-size: 10px;
        padding: 6px 8px 6px 20px;
        height: 32px;
        min-height: 32px;
    }

    .tool-button[data-action="font-increase"],
    .tool-button[data-action="font-decrease"] {
        padding: 6px 8px 6px 24px;
    }

    /* Make post titles taller on mobile for better touchability */
    .post {
        height: 44px;
        min-height: 44px;
        padding: 8px 4px;
    }

    .post-title,
    .post-date {
        font-size: 12px;
    }
}

/* Confirmation Dialog */
.confirm-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.dialog-window {
    background: #c0c0c0;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    min-width: 300px;
    max-width: 400px;
}

.dialog-title-bar {
    background: #000080;
    color: white;
    padding: 2px 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 18px;
    font-size: 11px;
    font-family: 'W95FA', monospace;
}

.dialog-title {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dialog-title-icon {
    width: 16px;
    height: 16px;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    flex-shrink: 0;
}

.dialog-close {
    width: 14px;
    height: 12px;
    background-color: #c0c0c0;
    border: 1px solid #ffffff;
    border-bottom-color: #404040;
    border-right-color: #404040;
    font-size: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    color: #000;
}

.dialog-close:active {
    border-color: #404040;
    border-bottom-color: #ffffff;
    border-right-color: #ffffff;
}

.dialog-content {
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-family: 'W95FA', monospace;
}

.dialog-icon {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog-icon img {
    width: 32px;
    height: 32px;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.dialog-message {
    flex: 1;
    font-size: 11px;
    line-height: 1.4;
    padding-top: 4px;
}

.dialog-buttons {
    padding: 8px 16px 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.dialog-button {
    min-width: 75px;
    height: 23px;
    padding: 0 12px;
    background-color: #c0c0c0;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    font-family: 'W95FA', monospace;
    font-size: 11px;
    cursor: pointer;
    box-shadow: inset 1px 1px 0px #fff, inset -1px -1px 0px #0a0a0a;
}

.dialog-button:active {
    border-color: #808080 #fff #fff #808080;
    box-shadow: inset 1px 1px 0px #0a0a0a;
    padding-top: 1px;
    padding-left: calc(12px + 1px);
    padding-bottom: calc(0px - 1px);
    padding-right: calc(12px - 1px);
}

.dialog-button-primary {
    font-weight: bold;
} 