/* ================================================
   Windows XP Luna Theme for Publii
   Recreating the iconic XP interface
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Tahoma:wght@400;700&display=swap');

:root {
  --xp-blue-dark: #0a246a;
  --xp-blue-mid: #1f4eb8;
  --xp-blue-light: #3d6dd8;
  --xp-blue-taskbar: #245edc;
  --xp-luna-start: #22a621;
  --xp-luna-start-dark: #1a8a19;
  --xp-window-title-start: #0a246a;
  --xp-window-title-end: #a6caf0;
  --xp-window-bg: #ece9d8;
  --xp-window-border: #0055ea;
  --xp-button-face: #ece9d8;
  --xp-button-highlight: #ffffff;
  --xp-button-shadow: #aca899;
  --xp-button-dark-shadow: #716f64;
  --xp-selected: #316ac5;
  --xp-selected-text: #ffffff;
  --xp-link: #0000cc;
  --xp-visited: #800080;
  --xp-text: #000000;
  --xp-gray-text: #716f64;
  --taskbar-height: 40px;
  --font: 'Tahoma', 'MS Sans Serif', Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 11px;
}

body {
  font-family: var(--font);
  font-size: 11px;
  color: var(--xp-text);
  background-color: #3a6ea5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === DESKTOP BACKGROUND (Bliss-inspired) === */
.xp-desktop {
  min-height: 100vh;
  padding-bottom: var(--taskbar-height);
  background: linear-gradient(
    180deg,
    #5b9bd5 0%,
    #7ab5e8 30%,
    #9fc9ef 50%,
    #6aa36e 50%,
    #4a8c4a 65%,
    #2d6b2d 80%,
    #1a5a1a 100%
  );
  position: relative;
}

/* === TASKBAR === */
.xp-taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--taskbar-height);
  background: linear-gradient(
    180deg,
    #245edc 0%,
    #1a4fc4 4%,
    #1a4fc4 6%,
    #2060d0 10%,
    #1f5ccc 50%,
    #1a53c0 90%,
    #1249af 100%
  );
  display: flex;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 -2px 0 #0a246a, 0 -1px 0 #5b9adf inset;
  border-top: 2px solid #0a246a;
}

.xp-start-button {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 10px 0 6px;
  margin: 0 2px 0 2px;
  background: linear-gradient(180deg, #3dae3d 0%, #22a621 40%, #1a9a1a 60%, #16841c 100%);
  border: 1px solid #1a6b1a;
  border-radius: 0 12px 12px 0;
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  font-weight: bold;
  font-style: italic;
  cursor: pointer;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
  box-shadow: 1px 0 3px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
  text-decoration: none;
  letter-spacing: 0.5px;
  transition: filter 0.1s;
}

.xp-start-button:hover {
  filter: brightness(1.1);
}

.xp-start-icon {
  width: 22px;
  height: 22px;
  display: inline-block;
  background: radial-gradient(circle, #ff6600 20%, #ff3300 50%, #cc0000 80%);
  border-radius: 50%;
  flex-shrink: 0;
}

.xp-taskbar-clock {
  margin-left: auto;
  padding: 0 10px;
  color: #fff;
  font-size: 11px;
  text-align: center;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
  background: rgba(0, 0, 50, 0.2);
  height: 100%;
  display: flex;
  align-items: center;
  border-left: 1px solid rgba(255,255,255,0.2);
  min-width: 55px;
}

.xp-taskbar-items {
  display: flex;
  gap: 2px;
  padding: 0 4px;
  flex: 1;
  overflow: hidden;
}

.xp-taskbar-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  height: 28px;
  background: linear-gradient(180deg, #1a53c0 0%, #1249af 100%);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 2px;
  color: #fff;
  font-size: 11px;
  font-family: var(--font);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
}

/* === MAIN WINDOW CONTAINER === */
.xp-window {
  background: var(--xp-window-bg);
  border: 3px solid #0055ea;
  border-radius: 8px 8px 0 0;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.8);
  margin: 20px auto;
  max-width: 960px;
  min-height: calc(100vh - var(--taskbar-height) - 40px);
  overflow: hidden;
}

/* Window Title Bar */
.xp-window-titlebar {
  background: linear-gradient(
    180deg,
    #4a90d0 0%,
    #2060c0 8%,
    #1a55b8 15%,
    #1c58bc 50%,
    #1a53b5 70%,
    #1249a8 90%,
    #1040a0 100%
  );
  padding: 5px 6px 5px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  border-radius: 5px 5px 0 0;
}

.xp-window-icon {
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #ff9900, #ff6600);
  border-radius: 2px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.xp-window-title {
  color: #fff;
  font-weight: bold;
  font-size: 12px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xp-window-controls {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.xp-btn-minimize,
.xp-btn-maximize,
.xp-btn-close {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  border: 1px solid;
  font-size: 10px;
  font-family: 'Marlett', var(--font);
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
  transition: filter 0.1s;
}

.xp-btn-minimize, .xp-btn-maximize {
  background: linear-gradient(180deg, #6ba0d8 0%, #4a80c0 50%, #2060a8 100%);
  border-color: #0040a0 #0040a0 #0060c0 #4080d0;
}

.xp-btn-close {
  background: linear-gradient(180deg, #e88070 0%, #d83020 50%, #c02010 100%);
  border-color: #a01010 #a01010 #c03030 #d06060;
}

.xp-btn-minimize:hover, .xp-btn-maximize:hover, .xp-btn-close:hover {
  filter: brightness(1.2);
}

/* Window Menu Bar */
.xp-menubar {
  background: var(--xp-window-bg);
  padding: 2px 4px;
  display: flex;
  gap: 2px;
  border-bottom: 1px solid #aca899;
}

.xp-menubar a {
  padding: 2px 8px;
  text-decoration: none;
  color: var(--xp-text);
  font-size: 11px;
  border-radius: 2px;
}

.xp-menubar a:hover {
  background: var(--xp-selected);
  color: var(--xp-selected-text);
}

/* Window Toolbar */
.xp-toolbar {
  background: linear-gradient(180deg, #f8f7f3 0%, #ece9d8 100%);
  border-bottom: 1px solid #aca899;
  padding: 3px 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.xp-toolbar-btn {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  background: linear-gradient(180deg, #f8f7f3 0%, #ece9d8 100%);
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: 11px;
  cursor: pointer;
  border-radius: 2px;
  text-decoration: none;
  color: var(--xp-text);
}

.xp-toolbar-btn:hover {
  border-color: #0055ea;
  background: linear-gradient(180deg, #e0ecff 0%, #c8dcff 100%);
}

.xp-toolbar-sep {
  width: 1px;
  height: 22px;
  background: #aca899;
  margin: 0 2px;
  border-right: 1px solid #fff;
}

/* Address bar */
.xp-addressbar {
  background: #ece9d8;
  padding: 3px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #aca899;
  font-size: 11px;
}

.xp-addressbar-label {
  color: var(--xp-gray-text);
  white-space: nowrap;
}

.xp-addressbar-input {
  flex: 1;
  padding: 2px 5px;
  background: #fff;
  border: 2px inset #ccc;
  font-family: var(--font);
  font-size: 11px;
  color: var(--xp-link);
}

/* === CONTENT AREA === */
.xp-content-area {
  display: flex;
  min-height: 400px;
}

/* Left Sidebar */
.xp-sidebar {
  width: 180px;
  background: linear-gradient(180deg, #578dd4 0%, #3a76c4 20%, #c4d8f0 100%);
  flex-shrink: 0;
  border-right: 1px solid #7aa8dc;
}

.xp-sidebar-section {
  margin-bottom: 4px;
}

.xp-sidebar-title {
  background: linear-gradient(90deg, #1f4eb8, #3d6dd8);
  color: #fff;
  font-weight: bold;
  font-size: 11px;
  padding: 5px 10px;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}

.xp-sidebar ul {
  list-style: none;
  padding: 4px 0;
}

.xp-sidebar ul li a {
  display: block;
  padding: 4px 10px 4px 22px;
  color: #00008b;
  text-decoration: none;
  font-size: 11px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpolygon points='0,0 8,4 0,8' fill='%230055cc'/%3E%3C/svg%3E") no-repeat 10px center;
}

.xp-sidebar ul li a:hover {
  text-decoration: underline;
  color: #0000ff;
}

/* Main Content */
.xp-main {
  flex: 1;
  padding: 12px;
  background: var(--xp-window-bg);
  overflow: hidden;
}

/* === POST LIST (Icon View) === */
.xp-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  padding: 4px;
}

.xp-post-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 6px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 3px;
  text-decoration: none;
  color: var(--xp-text);
  transition: background 0.1s, border-color 0.1s;
}

.xp-post-icon:hover {
  background: rgba(49, 106, 197, 0.15);
  border-color: #316ac5;
}

.xp-post-icon:focus, .xp-post-icon.selected {
  background: var(--xp-selected);
  border-color: var(--xp-selected);
  color: var(--xp-selected-text);
}

.xp-post-thumbnail {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border: 1px solid #aca899;
  margin-bottom: 5px;
}

.xp-post-thumbnail-default {
  width: 80px;
  height: 60px;
  background: linear-gradient(135deg, #c8d8ff 0%, #9ab8f0 100%);
  border: 1px solid #aca899;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}

.xp-post-icon-name {
  font-size: 11px;
  text-align: center;
  word-break: break-word;
  line-height: 1.3;
  max-width: 130px;
}

/* === POST LIST (Details View) === */
.xp-posts-list {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.xp-posts-list thead tr {
  background: linear-gradient(180deg, #f8f7f3 0%, #ece9d8 100%);
  border-bottom: 2px solid #aca899;
}

.xp-posts-list thead th {
  padding: 4px 8px;
  text-align: left;
  font-weight: bold;
  border-right: 1px solid #d4d0c8;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.xp-posts-list thead th:hover {
  background: linear-gradient(180deg, #e0ecff 0%, #c8dcff 100%);
}

.xp-posts-list tbody tr {
  border-bottom: 1px solid #f0ece0;
}

.xp-posts-list tbody tr:hover {
  background: rgba(49, 106, 197, 0.1);
}

.xp-posts-list tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.4);
}

.xp-posts-list tbody tr:nth-child(even):hover {
  background: rgba(49, 106, 197, 0.1);
}

.xp-posts-list td {
  padding: 3px 8px;
  vertical-align: middle;
}

.xp-posts-list td a {
  color: var(--xp-link);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
}

.xp-posts-list td a:hover {
  text-decoration: underline;
}

.xp-file-icon {
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #ffffc0, #ffff80, #e0e000);
  border: 1px solid #a08000;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
  box-shadow: 1px 1px 0 #604000;
  position: relative;
}

.xp-file-icon::before {
  content: '';
  position: absolute;
  top: -1px;
  right: -1px;
  width: 5px;
  height: 5px;
  background: #ece9d8;
  border-bottom: 1px solid #a08000;
  border-left: 1px solid #a08000;
}

/* === SINGLE POST VIEW === */
.xp-post-header {
  border-bottom: 1px solid #aca899;
  margin-bottom: 12px;
  padding-bottom: 8px;
}

.xp-post-title {
  font-size: 16px;
  font-weight: bold;
  color: #0a246a;
  margin-bottom: 4px;
}

.xp-post-meta {
  font-size: 10px;
  color: var(--xp-gray-text);
  display: flex;
  gap: 12px;
}

.xp-post-meta span {
  display: flex;
  align-items: center;
  gap: 3px;
}

.xp-post-featured-image {
  float: right;
  margin: 0 0 10px 12px;
  border: 2px inset #d4d0c8;
  max-width: 250px;
}

.xp-post-content {
  font-size: 12px;
  line-height: 1.6;
  color: #000;
}

.xp-post-content h1,
.xp-post-content h2,
.xp-post-content h3 {
  color: #0a246a;
  margin: 16px 0 6px;
}

.xp-post-content h2 {
  font-size: 14px;
  border-bottom: 1px solid #aca899;
  padding-bottom: 3px;
}

.xp-post-content p {
  margin-bottom: 10px;
}

.xp-post-content a {
  color: var(--xp-link);
}

.xp-post-content a:visited {
  color: var(--xp-visited);
}

.xp-post-content a:hover {
  text-decoration: none;
}

.xp-post-content blockquote {
  border-left: 3px solid #316ac5;
  padding-left: 10px;
  color: #555;
  font-style: italic;
  margin: 10px 0;
}

.xp-post-content code {
  font-family: 'Courier New', monospace;
  background: #f0ece0;
  padding: 1px 4px;
  border: 1px solid #d4d0c8;
  font-size: 11px;
}

.xp-post-content pre {
  background: #f0ece0;
  border: 1px inset #d4d0c8;
  padding: 8px;
  overflow-x: auto;
  font-size: 11px;
}

.xp-post-content img {
  max-width: 100%;
  border: 2px inset #d4d0c8;
}

.xp-post-content ul,
.xp-post-content ol {
  padding-left: 20px;
  margin-bottom: 10px;
}

/* === XP BUTTONS === */
.xp-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 12px;
  background: linear-gradient(180deg, #f8f7f3 0%, #ece9d8 100%);
  border: 2px outset #aca899;
  border-top-color: #fff;
  border-left-color: #fff;
  font-family: var(--font);
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
  color: var(--xp-text);
  border-radius: 3px;
}

.xp-button:hover {
  background: linear-gradient(180deg, #e0ecff 0%, #c8dcff 100%);
  border-color: #316ac5;
}

.xp-button:active {
  border-style: inset;
}

.xp-button-primary {
  background: linear-gradient(180deg, #4080e0 0%, #1a55c0 100%);
  color: #fff;
  border-top-color: #7aabf0;
  border-left-color: #7aabf0;
  border-bottom-color: #0040a0;
  border-right-color: #0040a0;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
}

.xp-button-primary:hover {
  background: linear-gradient(180deg, #5090f0 0%, #2060d0 100%);
  border-color: #5090f0;
  color: #fff;
}

/* === STATUS BAR === */
.xp-statusbar {
  background: var(--xp-window-bg);
  border-top: 1px solid #aca899;
  padding: 3px 6px;
  font-size: 10px;
  color: var(--xp-gray-text);
  display: flex;
  gap: 12px;
}

.xp-statusbar-pane {
  padding: 0 8px;
  border: 1px solid;
  border-top-color: #aca899;
  border-left-color: #aca899;
  border-bottom-color: #fff;
  border-right-color: #fff;
}

/* === PAGINATION === */
.xp-pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 12px 0;
  margin-top: 12px;
  border-top: 1px solid #d4d0c8;
}

.xp-page-btn {
  padding: 3px 9px;
  background: linear-gradient(180deg, #f8f7f3 0%, #ece9d8 100%);
  border: 2px outset #aca899;
  border-top-color: #fff;
  border-left-color: #fff;
  text-decoration: none;
  color: var(--xp-text);
  font-family: var(--font);
  font-size: 11px;
  border-radius: 3px;
}

.xp-page-btn:hover {
  background: linear-gradient(180deg, #e0ecff 0%, #c8dcff 100%);
  border-color: #316ac5;
}

.xp-page-btn.active {
  background: var(--xp-selected);
  color: var(--xp-selected-text);
  border-style: inset;
}

/* === TAG CHIPS === */
.xp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}

.xp-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: linear-gradient(180deg, #e8f0ff 0%, #c8d8ff 100%);
  border: 1px solid #7090c0;
  border-radius: 10px;
  font-size: 10px;
  color: var(--xp-link);
  text-decoration: none;
}

.xp-tag:hover {
  background: linear-gradient(180deg, #c8d8ff 0%, #a0c0ff 100%);
}

/* === SEARCH BOX === */
.xp-search-box {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 8px;
  background: #f0ece0;
  border: 1px inset #d4d0c8;
  margin-bottom: 10px;
}

.xp-search-input {
  flex: 1;
  padding: 3px 5px;
  font-family: var(--font);
  font-size: 11px;
  border: 2px inset #aca899;
  background: #fff;
}

/* === 404 / ERROR === */
.xp-error-dialog {
  background: var(--xp-window-bg);
  border: 3px solid #0055ea;
  border-radius: 8px 8px 0 0;
  max-width: 450px;
  margin: 60px auto;
  box-shadow: 4px 4px 12px rgba(0,0,0,0.5);
}

.xp-error-body {
  padding: 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.xp-error-icon {
  font-size: 36px;
  flex-shrink: 0;
}

.xp-error-text h2 {
  font-size: 13px;
  margin-bottom: 8px;
  color: #000;
}

.xp-error-text p {
  font-size: 11px;
  color: var(--xp-gray-text);
  line-height: 1.5;
}

.xp-error-footer {
  padding: 8px 16px 12px;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  border-top: 1px solid #d4d0c8;
}

/* === VIEW TOGGLE === */
.xp-view-toggle {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.xp-view-btn {
  padding: 3px 6px;
  background: linear-gradient(180deg, #f8f7f3 0%, #ece9d8 100%);
  border: 1px solid #aca899;
  cursor: pointer;
  font-size: 11px;
  border-radius: 2px;
}

.xp-view-btn.active {
  background: linear-gradient(180deg, #c8d8ff 0%, #a0c0ff 100%);
  border-color: #316ac5;
}

/* === XP LOGO in title === */
.xp-os-logo {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  font-weight: bold;
  font-style: italic;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.xp-os-logo span.windows {
  color: #fff;
}

.xp-os-logo span.xp {
  color: #ffcc00;
}

/* === Responsive basics === */
@media (max-width: 640px) {
  .xp-window {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    min-height: calc(100vh - var(--taskbar-height));
  }

  .xp-sidebar {
    display: none;
  }

  .xp-posts-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .xp-taskbar-items {
    display: none;
  }
}

/* === Scrollbar styling === */
::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

::-webkit-scrollbar-track {
  background: #ece9d8;
  border: 1px solid #aca899;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #f0ece0 0%, #d4d0c8 40%, #c0bdb0 60%, #d4d0c8 100%);
  border: 1px solid #aca899;
  border-top-color: #fff;
  border-left-color: #fff;
}

::-webkit-scrollbar-button {
  background: linear-gradient(180deg, #f8f7f3 0%, #ece9d8 100%);
  border: 1px outset #aca899;
  display: block;
  height: 16px;
  width: 16px;
}

/* === Animations === */
@keyframes xp-fadein {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.xp-window {
  animation: xp-fadein 0.2s ease-out;
}
