/* Base styles and theme variables */
body {
    font-family: 'Open Sans', sans-serif;
    line-height: 1.5;
    margin: 0;
    font-size: 14px;
    --main-margin: 1.5rem;
    --main-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --bg-color: #ffffff;
    --text-color: #000000;
    --border-color: #ccc;
    --button-bg: rgba(0,0,0,0.03);
    --button-hover: #e8e8e8;
    --nav-bg: white;
    --footer-bg: transparent;
    background-color: var(--bg-color);
    color: var(--text-color);
}

body.dark-mode {
    --bg-color: #1e1e1e;
    --text-color: #e0e0e0;
    --border-color: #444;
    --aside-bg: #252525;
    --button-bg: rgba(255,255,255,0.05);
    --button-hover: #333;
    --nav-bg: #2d2d2d;
    --footer-bg: transparent;
    --main-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
/* Header styles */
header {
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    min-height: 4rem;
}

.header-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    pointer-events: none;
}

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

header a {
    text-decoration: none;
}

header .logo img{
    height: 42px;
    width: 42px;
}

#buy-coffee {
    color: inherit;
}

#themeToggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    color: inherit;
}

#themeToggle:hover {
    opacity: 0.7;
}

.brand {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    color: #666;
    text-transform: lowercase;
}

.brand:hover {
    color: #333;
}

header h1 {
    font-family: 'Sofia Sans', sans-serif;
    font-weight: 700;
    margin: 0 1rem 0 0;
}

nav {
    position: relative;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

nav button {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: inherit;
}

nav ul {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--nav-bg);
    border: 1px solid var(--border-color);
    list-style: none;
    min-width: 150px;
    display: none;
}

nav ul.open {
    display: block;
}

nav ul li a {
    display: block;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: inherit;
    font-family: 'Open Sans', sans-serif;
}

nav ul li a:hover {
    background: var(--button-hover);
}
/* Sidebar styles */
aside {
    width: 300px;
    padding: 1rem;
    padding-bottom: 1.5rem;
    overflow-y: auto;
    box-sizing: border-box;
}

aside details {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
}

aside details summary {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    list-style: none;
}

aside details summary::-webkit-details-marker {
    display: none;
}

aside details summary::marker {
    content: '';
}

aside details summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform 0.2s ease;
}

aside details[open] summary::before {
    transform: rotate(90deg);
}

aside details > div {
    padding-left: 1rem;
    overflow: hidden;
}

aside label {
    display: block;
    margin-bottom: 0.25rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.label-with-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.label-with-link a {
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.accordion-section .accordion-header {
    margin-bottom: 0.5rem;
}

.accordion-section .accordion-header button {
    color: inherit;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0;
    background: none;
    border: none;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    user-select: none;
    text-align: left;
}

.accordion-section .accordion-header button:hover {
    opacity: 0.7;
}

.accordion-section .accordion-header button:focus-visible {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

.accordion-section .accordion-header svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.accordion-section .accordion-content {
    display: none;
    overflow: hidden;
}

.accordion-section.open .accordion-content {
    display: block;
}

aside input[type="text"],
aside input[type="number"],
aside input[type="email"],
aside input[type="url"],
aside input[type="range"],
aside select,
aside textarea {
    width: 100%;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    box-sizing: border-box;
    font-family: inherit;
}

aside button {
    width: 100%;
    padding: 0.5rem;
    font-family: inherit;
}

.button-group {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.button-group button {
    flex: 1;
    width: auto;
    padding: 0.5rem;
}

.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0.75rem;
}

.tab {
    flex: 1;
    width: auto;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    background: var(--button-bg);
    color: inherit;
    cursor: pointer;
}

.tab:first-child {
    border-radius: 4px 0 0 4px;
}

.tab:last-child {
    border-radius: 0 4px 4px 0;
}

.tab:not(:first-child) {
    border-left: none;
}

.tab.active {
    background: transparent;
    font-weight: 600;
    border-bottom-color: transparent;
    position: relative;
    z-index: 1;
}

.tab:hover:not(.active) {
    background: var(--button-hover);
}
/* Main content styles */
main {
    flex: 1;
    overflow-y: auto;
}

main section {
    padding: 1rem;
    margin: var(--main-margin);
}

main section:first-child {
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    box-shadow: var(--main-shadow);
}
/* Footer styles */
footer {
    padding: 1rem;
    text-align: center;
    font-size: 0.875rem;
}

footer a {
    color: inherit;
}
/* Container layout styles */
.container {
    display: flex;
    box-sizing: border-box;
}
/* Advertisement styles */
.ad-label {
    font-size: 0.7rem;
    color: #999;
    margin-bottom: 8px;
}

#ads-right {
    width: 180px;
    padding: 1rem 0;
    margin-right: 1rem;
    display: none;
    box-sizing: border-box;
    overflow-x: hidden;
}

#tablet-bottom-ad { 
    display: none; 
    text-align: center;
}

/* Show ads on larger screens */
@media (min-width: 1000px) and (max-width: 1279px) {
  #tablet-bottom-ad {
    display: block;
    margin: 0;
    padding: 12px;
  }
}

@media (min-width: 1280px) {
  #ads-right { display: block; }
}
/* Mobile portrait styles */
@media (max-width: 767px) {
    h1 {
        font-size: 1.4rem;
    }
}

/* Mobile and responsive styles */
@media (max-width: 999px) and (orientation: portrait) {
  header {
    border-bottom: 1px solid #eee;
  }

  .container {
    flex-direction: column;
    width: 100%;
    height: calc(100vh - 4rem);
  }
  
  aside {
    width: 100%;
    height: 50vh;
    border-top: 1px solid var(--border-color);
    background-color: var(--button-bg);
    order: 2;
  }
  
  main {
    width: auto;
    height: 50vh;
    order: 1;
  }
  
  footer {
    padding: 0.25rem;
    font-size: 0.75rem;
    line-height: 1.2;
  }
}
/* Button styles */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
input[type="file"]::file-selector-button {
  background: #cceeee;
  border: 1px outset #9dc8c8;
  padding: 0.5rem 1rem;
  font-family: 'Open Sans', sans-serif;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
}

input[type="file"]::file-selector-button {
  background: unset
}

button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover,
input[type="file"]::file-selector-button:hover {
  background: #bce0e0;
}

button:active,
input[type="button"]:active,
input[type="submit"]:active,
input[type="reset"]:active,
input[type="file"]::file-selector-button:active {
  background: #a8d4d4;
}

button:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled,
input[type="reset"]:disabled {
  background: #E8F7F7;
  color: #4a5555;
  cursor: not-allowed;
}

/* Spacing between buttons */
button + button,
button + input[type="button"],
button + input[type="submit"],
button + input[type="reset"],
input[type="button"] + button,
input[type="button"] + input[type="button"],
input[type="button"] + input[type="submit"],
input[type="button"] + input[type="reset"],
input[type="submit"] + button,
input[type="submit"] + input[type="button"],
input[type="submit"] + input[type="submit"],
input[type="submit"] + input[type="reset"],
input[type="reset"] + button,
input[type="reset"] + input[type="button"],
input[type="reset"] + input[type="submit"],
input[type="reset"] + input[type="reset"] {
  margin-left: 0.5rem;
}
main section {
    text-align: center;
}