/* Base overlay for all pages */
body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    pointer-events: none;
}


/* Main container used in all pages */
.container {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 32rem;
    box-sizing: border-box;
    opacity: 1;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}


/* Animation classes for page transitions */
.container.slide-left {
    transform: translateX(-100%);
    opacity: 0;
}

.container.slide-right {
    transform: translateX(100%);
    opacity: 0;
}

.container.instant {
    transition: none;
}


/* Title container with help button */
.title-container {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 0.5rem;
}


/* Title styling */
.title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0;
    color: #ef4444;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.4;
    max-width: 100%;
    box-sizing: border-box;
    flex: 1;
}


/* Help button styling */
.help-button {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background-color: #ef4444;
    color: white;
    border: none;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
    padding: 0;
    line-height: 1;
}

.help-button:hover {
    background-color: #dc2626;
    transform: scale(1.1);
}


/* Help message backdrop */
.help-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}


/* Help message modal */
.help-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    border: 2px solid #ef4444;
    border-radius: 0.5rem;
    padding: 1.5rem 2.5rem 1.5rem 2rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-width: 85%;
    width: 85%;
    max-height: 60vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.help-message-content {
    position: relative;
    padding-top: 0.5rem;
}

.help-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: auto;
    height: auto;
    background-color: transparent;
    color: #ef4444;
    border: none;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

.help-close:hover {
    color: #dc2626;
}

#help-text {
    margin: 0;
    padding-right: 1.5rem;
    color: #4a5568;
    line-height: 1.6;
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}


/* Responsive title sizing for smaller screens */
@media (max-width: 480px) {
    .title {
        font-size: 1.3rem;
    }
    
    .help-button {
        width: 1.25rem;
        height: 1.25rem;
        font-size: 0.8rem;
    }
    
    .help-message {
        padding: 1rem;
        max-width: 95%;
    }
}


/* Input group styling */
.input-group {
    margin-bottom: 1rem;
}

.input-group.w-full {
    width: 100%;
}


/* Label styling */
.label {
    display: block;
    color: #4a5568;
}


/* Input and select styling */
.input, .select {
    margin-top: 0.25rem;
    display: block;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d2d6dc;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.05);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}


/* Radio button styling */
.radio-group {
    margin-top: 0.25rem;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    margin-right: 1.5rem;
}


/* Button styling */
.button {
    width: auto;
    background-color: #ef4444;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s, transform 0.2s;
}

.button:hover {
    background-color: #dc2626;
    transform: scale(1.05);
}


/* Button row styling */
.button-row {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.button-row .button {
    flex: 1;
}

.button.w-full {
    width: 100%;
}


/* Compact page view button on pages list */
.page-view-button {
    flex: 0 0 auto;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    margin-left: auto;
}


/* Compact read button on contents list */
.link-item .compact-read-button {
    flex: 0 0 auto;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    margin-left: auto;
}


/* Link item styling */
.link-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    gap: 1.5rem;
    position: relative;
}

.link-item:last-child {
    border-bottom: none;
}

.link-item a {
    color: #2563eb;
    text-decoration: none;
    display: inline-block;
}

.link-item a:hover {
    color: #1e40af;
}


/* Button disabled state */
#article-copy-button:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
    transform: none;
}


/* Container for links */
.links-container {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.5rem;
    background-color: white;
}


/* Content container styling */
.content-container {
    max-height: 70vh;
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    background-color: white;
    font-size: 1rem;
    line-height: 1.5;
}


/* Dynamic title styling */
#topic-title, #page-title {
    color: #ef4444;
    margin-left: 0;
}


/* Page navigation styling */
.page-navigation {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.page-navigation .button-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: stretch;
}

.page-navigation .nav-button {
    padding: 0.5rem 1rem;
}


/* Arrow buttons styling */
.page-navigation #prev-page-button,
.page-navigation #next-page-button {
    flex: 0 0 auto;
    width: 50px;
    min-width: 50px;
}


/* Middle button styling */
.page-navigation #back-to-pages-button {
    flex: 1;
}


/* Spinner animation for loading.html */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #000;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}