/* Ensure full height for the body */
html {
    scroll-behavior: smooth;
    scroll-padding-top:18px; /* helps with offset for scrolling in glossary */
}

/* General header styling */
header {
    display: flex;
    flex-direction: column; /* Stack elements in columns */
    justify-content: flex-start; /* Align elements at the top */
    align-items: center; /* Center items horizontally */
    box-shadow: 1px 1px 5px 0px var(--gray); /* Base shadow for header */
    position: sticky;
    background-color: #FFF;
    top: 0;
    z-index: 20;
    padding: 0; /* Remove extra padding for precise alignment */
    transition: box-shadow 0.3s ease; /* Smooth transition for the shadow */
}

header.scrolled {
    box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2); /* Subtle shadow on scroll */
}

/* Top row layout: logo left, journal right, text centered */
header .top-row {
    display: flex;
    flex-direction: row;
    justify-content: space-between; /* Push logo left and journal right */
    align-items: center;
    width: 100%;
    padding: 0 20px; /* optional horizontal padding */
    box-sizing: border-box;
}

/* Logo flush left */
header #ktzarLogo {
    height: 68.6px;
    margin: 0; /* Remove extra spacing */
    display: block;
}

/* Center the main header text between logo and journal */
header .top-row h2.center-text {
    flex: 1;
    text-align: center;
    margin: 0;
}

/* Journal SVG flush right */
header .top-row h2.journal {
    margin: 0;
}

header .top-row h2.journal a svg {
    width: 28px;
    height: 28px;
    display: block;
    margin: 0; /* remove extra spacing */
    vertical-align: middle;
}

/* Center the paragraph below */
header p {
    margin-top: 10px;
    line-height: 1.6;
    color: var(--gray); /* Adjust text color */
    font-size: 16px;
    text-align: center; /* Center-align paragraph */
    width: 100%; /* Ensure the paragraph spans full width */
}

header p a:hover {
    text-decoration: underline;
    color: var(--gold);
}

#reminderContainer {
    font-weight: bold;
    color: #ff0000;
    -webkit-text-stroke: 0.5px black;
}

/* Remove extra margins from wrapper for the logo */
#ktzarLogo {
    margin: 0; /* Remove margin affecting positioning */
}

.header #ktzarLogoLink {
    margin: 0; /* Ensure no extra margins */
    display: inline-block;
}

.header #ktzarLogoLink:hover #ktzarLogo {
    outline: 4px solid #FFD700; 
    outline-offset: -4px;
}

.hamb {
    margin-left: auto; /* Push the hamburger menu to the far right */
}

/* Remove default margins from header text and paragraph */
header h2, header p {
    margin: 0;
    padding: 0;
}  

wrapper {
    height: 8000px;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    height: 100vh;
    margin: 0;
    text-align: center;
    padding-top: 40px;
    visibility: hidden; /* Hides content until authorized */
}

/* Wrapper for main content */
.main-content {
    flex-grow: 1; /* Allows content to take up available space */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 20px;
}

/* Image container styles */
.image-container {
    margin: 20px 0;
}

/* Image styles */
img {
    width: auto;
    height: auto;
    max-width: 80%;
    max-height: 60vh;
}

/* Button container styles */
.button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin-top: 20px;
    padding: 0 20px;
}

/* Button styles */
.button {
    text-decoration: none;
    padding: 15px 30px;
    background-color: #007BFF;
    color: white;
    border-radius: 25px;
    transition: background-color 0.3s;
    font-size: 18px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    margin-bottom: 40px;
}

/* Adjust for two buttons */
.button-container.two-buttons {
    justify-content: space-between;
}

.button-container a + a {
    margin-left: 20px;
}

.button:hover {
    background-color: #0056b3;
}

/* Paragraph styles */
p {
    max-width: 800px;
    margin: 10px auto;
    line-height: 1.6;
    padding: 0 20px;
    text-align: justify;
}

#decision {
    font-style: italic;
    border: 2px solid black;
    padding: 10px;
    margin: 20px auto;
    max-width: 800px;
    background-color: #f9f9f9;
    border-radius: 5px;
}

/* Menu styles */
.menu a {
    display: block;
    padding: 30px;
    color: var(--white);
}
  
.menu a:hover {
    background-color: var(--gray);
    font-weight: bolder;
    text-underline-offset: 8px;
}
  
.menu p {
    display: block;
    padding: 30px;
    color: var(--white);
}

/* Menu Icon */
.hamb {
    cursor: pointer;
    float: right;
    padding: 40px 20px;
}
  
.hamb-line {
    background: var(--white);
    display: block;
    height: 2px;
    position: relative;
    width: 24px;
}
  
.hamb-line::before,
.hamb-line::after {
    background: var(--white);
    content: "";
    display: block;
    height: 100%;
    position: absolute;
    transition: all 0.2s ease-out;
    width: 100%;
}
  
.hamb-line::before {
    top: 5px;
}
  
.hamb-line::after {
    top: -5px;
}
  
.side-menu {
    display: none;
}
  
/* Toggle menu icon */
.side-menu:checked~nav {
    max-height: 100%;
    display: block;
}
  
.side-menu:checked~.hamb .hamb-line {
    background: transparent;
}
  
.side-menu:checked~.hamb .hamb-line::before {
    transform: rotate(-45deg);
    top: 0;
}
  
.side-menu:checked~.hamb .hamb-line::after {
    transform: rotate(45deg);
    top: 0;
}
  
.side-menu:checked~.nav .subnav-content {
    display: block;
}
  
.side-menu:checked~.nav .toggle-menu-label .caret {
    transform: rotate(180deg);
    transition: none;
}
  
/* Responsiveness */
@media (min-width: 940px) {
    .nav {
        max-height: none;
        margin-left: auto;
        position: absolute;
        top: 0;
        right: 0;
        width: fit-content;
        text-align: right;
        float: right;
        background-color: transparent;
    }
  
    /* Sub nav */
    .subnav-content {
        padding: 20px 0;
        display: none;
        background-color: var(--black);
        padding-top: 2px;
        padding-bottom: 2px;
    }
  
    .subnav-content a {
        color: white;
        margin-top: 8px;
        margin-bottom: 8px;
    }
  
    .menu li {
        float: left;
    }
  
    .menu a:hover {
        background-color: transparent;
        color: #FFD700;
        font-weight: bolder;
        text-underline-offset: 8px;
    }
  
    .hamb {
        display: none;
    }
}

/* Journal Styles */
.main-content h1 {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 20px;
}

#journalControls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 800px;
    margin: 0 auto 30px auto;
}

#entryTitle, #entryContent {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 16px;
    box-sizing: border-box;
    resize: vertical;
}

#entryTitle {
    font-size: 18px;
}

#titleCountdown, #contentCountdown {
    text-align: right;
    font-size: 14px;
    color: #555;
}

#saveBtn {
    align-self: flex-start;
    padding: 12px 25px;
    background-color: #007BFF;
    color: #fff;
    font-size: 16px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#saveBtn:hover {
    background-color: #0056b3;
}

#saveStatus {
    margin-top: 5px;
    font-weight: bold;
    color: red;
}

#entryList {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
}

.journal-entry {
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #ddd;
    background-color: #f8f8f8;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.journal-entry strong {
    display: block;
    font-size: 18px;
    margin-bottom: 8px;
}

.journal-entry p {
    margin-bottom: 10px;
    white-space: pre-wrap; /* preserve line breaks */
}

.journal-entry button {
    padding: 6px 12px;
    margin-right: 10px;
    font-size: 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.journal-entry .editBtn {
    background-color: #28a745;
    color: white;
}

.journal-entry .editBtn:hover {
    background-color: #218838;
}

.journal-entry .deleteBtn {
    background-color: #dc3545;
    color: white;
}

.journal-entry .deleteBtn:hover {
    background-color: #c82333;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #journalControls {
        padding: 0 15px;
    }

    #saveBtn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    #entryTitle, #entryContent {
        font-size: 16px;
        padding: 10px;
    }

    #journalControls {
        gap: 8px;
    }

    .journal-entry {
        padding: 12px;
    }

    .journal-entry button {
        font-size: 12px;
        padding: 5px 10px;
        margin-right: 5px;
    }
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* On top of everything */
}

/* Modal Box */
.modal-box {
    background-color: #fff;
    padding: 20px 25px;
    border-radius: 10px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: modalFadeIn 0.3s ease-out;
}

/* Modal Title */
.modal-box h3 {
    margin-bottom: 15px;
    font-size: 1.5rem;
}

/* Modal Message */
.modal-box p {
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.4;
    word-break: break-word; /* ensures long titles don't overflow */
}

/* Buttons Container inside modal */
.modal-box .confirm-btn,
.modal-box .cancel-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    margin: 5px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Confirm Delete Button */
.modal-box .confirm-btn {
    background-color: #dc3545; /* Red */
    color: white;
}

.modal-box .confirm-btn:hover {
    background-color: #c82333;
}

/* Cancel Button */
.modal-box .cancel-btn {
    background-color: #6c757d; /* Gray */
    color: white;
}

.modal-box .cancel-btn:hover {
    background-color: #5a6268;
}

/* Modal animation */
@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .modal-box {
        padding: 15px 20px;
        font-size: 0.95rem;
    }

    .modal-box h3 {
        font-size: 1.3rem;
    }

    .modal-box .confirm-btn,
    .modal-box .cancel-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
        margin: 3px;
    }
}

#saveStatus {
    font-weight: bold;
    font-size: 16px; /* slightly larger for mobile */
    margin-top: 10px;
    word-wrap: break-word; /* ensures long text wraps */
}

@media (max-width: 480px) {
    #saveStatus {
        font-size: 18px; /* even larger on small devices */
    }
}

#deleteBtn {
    align-self: flex-start;
    padding: 12px 25px;
    background-color: #dc3545;
    color: white;
    font-size: 16px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#deleteBtn:hover {
    background-color: #c82333;
}

@media (max-width: 768px) {
    #deleteBtn {
        width: 100%;
        text-align: center;
        margin-top: 10px;
    }
}

/* Responsive adjustments for header on mobile */
@media (max-width: 768px) {
    header .top-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0 10px;
    }

    header .top-row h2.center-text {
        font-size: 18px;
        text-align: center;
        flex: 1;
    }

    header .top-row h2.journal a svg {
        width: 24px;
        height: 24px;
    }

    header img {
        height: 50px;
    }
}

header .top-row .beginning-text {
    margin-left: -46px;
    text-align: center;
    flex-shrink: 0;
}