/* --- HEADER & LOGO --- */
.page-top {
    background: linear-gradient(to bottom, #1a1a1a, #141414);
    padding: 20px 0 60px 0;
    position: relative;
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    box-sizing: border-box;
}

.page-top.has-banner, .page-top.no-banner {
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border-bottom: none;
    background-color: var(--background-color-dark);
}

.page-top.has-banner::before, .page-top.no-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1;
    transition: background-color 0.5s var(--smooth);
}

body.light-mode .page-top.has-banner::before, body.light-mode .page-top.no-banner::before {
    background-color: rgba(255, 255, 255, 0.5);
}

.page-top.has-banner::after, .page-top.no-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(to top, var(--background-color-dark), transparent);
    z-index: 2;
}

.header, .main-title {
    position: relative;
    z-index: 3;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

body.light-mode .page-top:not(.has-banner) {
    background: linear-gradient(to bottom, #ffffff, #f5f5f1);
}


body.light-mode .page-top.has-banner::after, body.light-mode .page-top.no-banner::after {
    background: linear-gradient(to top, var(--background-color-light), transparent);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 50px;
}

.logo {
    font-size: 2.8em;
    font-weight: 900;
    letter-spacing: 2px;
    cursor: pointer;
    transition: transform 0.4s var(--bounce), text-shadow 0.3s;
    display: inline-block;
}

.logo:hover {
    transform: scale(1.1) rotate(-2deg);
    text-shadow: 0 0 20px var(--primary-color);
}

.logo .esl { color: var(--primary-color); }

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-switcher {
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.5s var(--bounce), background-color 0.3s;
}

.theme-switcher:hover {
    transform: rotate(180deg) scale(1.2);
    background-color: rgba(255,255,255,0.1);
}
body.light-mode .theme-switcher:hover { background-color: rgba(0,0,0,0.1); }

.theme-switcher svg { width: 24px; height: 24px; transition: fill 0.3s; }
#sun-icon, body.light-mode #moon-icon { display: none; }
body.light-mode #sun-icon { display: block; }
#moon-icon path { fill: var(--text-color-dark); }
#sun-icon path { fill: var(--text-color-light); }

.title-container {
    position: relative;
}

body.edit-mode-enabled .title-container {
    padding-right: 40px; /* Add padding to prevent overlap */
    padding-bottom: 30px; /* Add padding for the button */
}

.main-title {
    text-align: center;
    padding: 20px 20px 30px 20px;
    font-size: 2.5em;
    font-weight: 900;
    letter-spacing: 1px;
    animation: fadeIn 1s ease-out;
    border-radius: 10px;
}

.main-title.editing {
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.3);
    outline: none;
}

#edit-title-btn {
    position: absolute;
    bottom: 20px;
    right: 0;
    color: var(--text-color-dark);
    opacity: 0.7;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out;
}

#edit-title-btn:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

body.light-mode #edit-title-btn {
    color: var(--text-color-light);
}

body.light-mode #edit-title-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* --- TABS --- */
.tabs-container {
    margin: -50px 50px 0 50px;
    position: relative;
    scroll-behavior: smooth;
    z-index: 3;
}

.tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid #333;
}
body.light-mode .tabs { border-bottom-color: #ddd; }

#reading .title-container {
    margin-bottom: 20px;
    padding-bottom: 10px;
}

body.light-mode #reading .title-container {
    border-bottom-color: #ddd;
}

#reading .article-part {
    margin-bottom: 20px;
}

.tab-button {
    background: transparent;
    color: #888;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    border-bottom: 4px solid transparent;
    transition: all 0.3s var(--smooth);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.tab-button:hover {
    color: var(--text-color-dark);
    background-color: rgba(255,255,255,0.05);
    transform: translateY(-2px);
}
body.light-mode .tab-button:hover { 
    color: var(--text-color-light);
    background-color: rgba(0,0,0,0.05);
}

.tab-button.active {
    color: var(--text-color-dark);
    border-bottom-color: var(--primary-color);
}

body.light-mode .tab-button.active {
    color: var(--text-color-light);
}

/* --- CONTENT CONTAINER --- */
.content-container {
    background-color: var(--container-bg-dark);
    margin: 30px 50px;
    padding: 40px;
    border-radius: 15px;
    box-shadow: var(--shadow-dark);
    min-height: 400px; 
    transition: background-color 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden; 
}

body.light-mode .content-container {
    background-color: var(--container-bg-light);
    box-shadow: var(--shadow-light);
}
/* --- PAGE NAVIGATION --- */
.page-navigation {
    display: flex;
    justify-content: space-between;
    padding: 20px 50px;
    margin: 0 auto;
    max-width: 1100px;
}

.page-navigation button {
    background: none;
    border: none;
    color: var(--text-color-dark);
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

body.light-mode .page-navigation button {
    color: var(--text-color-light);
}

.page-navigation button:hover {
    color: var(--primary-color);
}

/* --- FOOTER --- */
.footer {
    text-align: center;
    padding: 20px 50px;
    margin: 20px auto 0;
    max-width: 1100px;
    color: #888;
    font-size: 0.9em;
}

body.light-mode .footer {
    color: #555;
}

.footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.footer .version {
    margin-top: 5px;
    font-size: 0.8em;
    color: #777;
}

.footer img {
    height: 1em; /* This makes the image height match the text's font size */
    width: auto;
    vertical-align: middle; /* Aligns the image nicely with the text */
}

.footer a {
    color: #8a2be2; /* Purple color */
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s;
}

body.light-mode .footer a {
    color: #6a0dad; /* A slightly darker purple for light mode */
}

.footer a:hover {
    color: var(--primary-color);
}

.tab-header h2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
