:root {
    --primary-bg: #f4f7f9;
    --secondary-bg: #ffffff;
    --primary-text: #333333;
    --accent-color: #007bff;
    --accent-hover: #0056b3;
    --border-color: #e0e0e0;
    --success-color: #28a745;
    --error-color: #dc3545;
}

body.dark-mode {
    --primary-bg: #1a1a1a;
    --secondary-bg: #2c2c2c;
    --primary-text: #f0f0f0;
    --accent-color: #00aaff;
    --accent-hover: #0077cc;
    --border-color: #444444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--primary-bg);
    color: var(--primary-text);
    margin: 0;
    padding: 20px;
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--secondary-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}

header {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

h1, h2{
    margin: 0;
}

h3{
    margin-bottom: 1em;
}



h1 {
    font-family: 'Pacifico';
    font-size: 1.8em;
    color: var(--accent-color);
}

#theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.5em;
    line-height: 1;
    color: var(--primary-text);
}

.transfer-box, .devices-box, .history-box {
    margin-bottom: 25px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: border 0.2s ease, background-color 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06); /* subtle boundary shadow */
}

.file-input-wrapper {
    position: relative;
    text-align: center;
}

#file-input {
    display: none;
}

.file-input-label {
    display: inline-block;
    padding: 12px 25px;
    background-color: var(--accent-color);
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

.file-input-label:hover {
    background-color: var(--accent-hover);
}

.drop-zone-text {
    font-size: 14px;
    color: #888;
    margin-top: 12px;
    text-align: center;
}

body.dark-mode .drop-zone-text {
    color: #aaa;
}

/* Drag and drop visual feedback */
.transfer-box.drag-over {
    border: 2px dashed var(--accent-color);
    background-color: var(--primary-bg);
    opacity: 0.9;
}

body.dark-mode .transfer-box.drag-over {
    background-color: rgba(44, 44, 44, 0.8);
    border-color: var(--accent-color);
}

#selected-files-list, #device-list, #history-list {
    list-style: none;
    padding: 0;
    margin-top: 15px;
}

#selected-files-list li, #device-list li, #history-list li {
    background-color: var(--primary-bg);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 8px;
    font-size: 0.9em;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;    
}

#history-list li {
    background-color: var(--primary-bg);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 8px;
    font-size: 0.9em;
    
    /* Use Flexbox to align the file name and download button */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.download-btn {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 5px;
    background-color: var(--accent-color);
    color: white;
    text-decoration: none;
    font-size: 1.1em; /* Make the icon a bit bigger */
    line-height: 1;
    flex-shrink: 0; /* Prevent the button from shrinking */
    transition: background-color 0.2s;
}

.download-btn:hover {
    background-color: var(--accent-hover);
}

.file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    /* Prevents the file size from shrinking or wrapping */
    flex-shrink: 0;
}

#device-list li {
    cursor: pointer;
    transition: background-color 0.2s;
}

#device-list li:hover {
    background-color: var(--accent-color);
    color: white;
}

#device-list li.self {
    font-style: italic;
    color: #888;
}

/* Progress Card (UI only) */
#progress-container {
    margin-top: 20px;
    margin-bottom: 18px; /* add breathing room below the card */
    padding: 14px;
    border-radius: 10px;
    background: var(--primary-bg); /* falls back; light-mode override applied below */
    border: 1px solid var(--border-color);
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

/* Bottom row: ETA left, controls right */
.progress-bottom-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

#eta-text {
    align-self: flex-start; /* bottom-left */
    color: #666;
    font-size: 0.9em;
}

.transfer-controls-wrapper {
    display: flex;
    gap: 8px;
    margin-left: auto; /* push to right */
    align-self: flex-end; /* bottom-right */
}

.transfer-control-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-text);
    width: 40px;
    height: 40px;
}

.transfer-control-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Progress text row: label on left */
#progress-row #progress-text,
#progress-text {
    margin: 0;
    font-weight: 600;
    color: var(--primary-text);
    font-size: 0.98em;
}

#eta-text {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
    text-align: right;
    display: block;
    margin-top: 6px;
}

#progress-filesize {
    margin: 0;
    color: #666;
    font-size: 0.92em;
}

/* Custom styled progress bar */
#progress-bar {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    background: linear-gradient(90deg, rgba(0,0,0,0.04), rgba(0,0,0,0.02));
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.2);
}

/* WebKit (Chrome, Safari) */
#progress-bar::-webkit-progress-bar {
    background: rgba(0,0,0,0.04);
}

#progress-bar::-webkit-progress-value {
    background: linear-gradient(90deg, var(--accent-color), var(--accent-hover));
    box-shadow: 0 4px 12px rgba(0,0,0,0.12) inset;
    border-radius: 999px;
}

/* Firefox */
#progress-bar::-moz-progress-bar {
    background: linear-gradient(90deg, var(--accent-color), var(--accent-hover));
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12) inset;
}

/* Make the card stand out in dark mode similar to article cards */
body.dark-mode #progress-container {
    /* Make the progress card visibly darker in dark mode for better contrast */
    background: #1A1A1A; /* very dark card */
    border: 1px solid #171717;
    box-shadow: 0 10px 40px rgba(0,0,0,0.7);
}

/* Stronger selector to avoid accidental overrides from container-level rules */
body.dark-mode .container #progress-container {
    background: #0d0d0e;
    border-color: #1a1a1a;
}

/* Ensure progress text is readable on the darker card */
body.dark-mode #progress-container, body.dark-mode #progress-container * {
    color: #eaeaea;
}

body.dark-mode #progress-bar::-webkit-progress-value,
body.dark-mode #progress-bar::-moz-progress-bar {
    background: linear-gradient(90deg, #00aaff, #0077cc);
}

/* Darker track/background for the progress bar in dark mode to improve contrast */
body.dark-mode #progress-bar {
    background: linear-gradient(90deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    border: 1px solid rgba(255,255,255,0.03);
}

/* Light-mode: make the progress card visually match article cards / FAQ */
body:not(.dark-mode) #progress-container {
    background: var(--primary-bg); /* same as article-card background in light mode */
    border: 1px solid var(--border-color);
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}

/* Slightly stronger accent for the progress bar in light mode to match article accents */
body:not(.dark-mode) #progress-bar::-webkit-progress-value,
body:not(.dark-mode) #progress-bar::-moz-progress-bar {
    background: linear-gradient(90deg, var(--accent-color), var(--accent-hover));
}

/* Notification Styling */
#notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

#notification.success { background-color: var(--success-color); }
#notification.error { background-color: var(--error-color); }

/* --- Room Selection UI --- */
#room-view {
    text-align: center;
    padding: 25px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 25px;
    background-color: var(--secondary-bg);
}

.room-controls {
    display: flex;
    flex-wrap: wrap; /* Allows items to wrap on smaller screens */
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

#room-id-input {
    flex-grow: 1; /* Allows the input to take up available space */
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    text-align: center;
    background-color: var(--primary-bg);
    color: var(--primary-text);
    min-width: 150px; /* Ensures it doesn't get too small */
}

/* General style for both room buttons */
#join-room-btn{
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    color: white;
    transition: opacity 0.2s ease;
}
#generate-id-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    color: white;
    background-color: var(--success-color); /* Green color */
    transition: opacity 0.2s ease;
}

#join-room-btn:hover,
#generate-id-btn:hover {
    opacity: 0.9;
}

/* Disabled state for loading */
#join-room-btn:disabled,
#generate-id-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.button-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* Specific color for the "Join Room" button */
#join-room-btn {
    background-color: var(--accent-color);
}

/* Specific color for the "Create Room" button */
#create-room-btn {
    background-color: var(--success-color);
}

/* Style for the text that displays the current room ID */
#room-display {
    text-align: center;
    font-size: 1.1em;
    color: var(--primary-text);
    background-color: var(--primary-bg);
    padding: 10px;
    border-radius: 5px;
    margin-top: 0;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.room-display-text {
    flex: 1;
}

#room-display strong {
    color: var(--accent-color);
    font-family: monospace; /* Makes the number stand out */
    font-size: 1.2em;
    margin-left: 8px;
}

.share-room-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    color: var(--primary-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.share-room-btn:hover {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.share-room-btn svg {
    display: block;
}

.device-list-disabled {
    pointer-events: none;
    opacity: 0.5;
    cursor: not-allowed;
}

/* Utility classes */
.hidden { display: none !important; }

/* Responsive Design for Mobiles */
@media (max-width: 600px) {
    body { padding: 10px; }
    .container { padding: 15px; }
    h1 { font-size: 1.5em; }
    .file-input-label { padding: 10px 20px; }
    .footer-bottom { flex-direction: column; align-items: flex-start; gap: 10px; }
    .footer-bottom p:first-child { margin-right: 0; }
    .footer-bottom p:last-child { margin-left: 0; text-align: left; flex: none; }
    .carousel-container { max-width: 100%; }
    .carousel-image-placeholder { height: 30px; font-size: 0.9em; padding: 10px;  box-sizing: border-box;}
    .carousel-btn { width: 40px; height: 40px; font-size: 20px; }
    .carousel-prev { left: 10px; }
    .carousel-next { right: 10px; }

    .room-display-text {
        flex: 1;
        margin-right: 12px;
    }
}

/* --- User Setup Screen --- */
#user-setup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#user-setup-modal {
    background-color: var(--secondary-bg);
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

#user-setup-modal h2 {
    margin-bottom: 10px;
}

#user-setup-modal p {
    margin-bottom: 20px;
    color: var(--primary-text);
    opacity: 0.8;
}

#username-setup-input,
#username-setup-btn {
    display: block;
    width: 100%;
    box-sizing: border-box; 
    border-radius: 5px;
    font-size: 1em;
}
#username-setup-input {
    padding: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    text-align: center;
}

#username-setup-btn {
    padding: 12px 25px;
    border: none;
    background-color: var(--accent-color);
    color: white;
    font-weight: bold;
    cursor: pointer;
}

#username-setup-btn:hover {
    background-color: var(--accent-hover);
}

/* Consent row */
.consent-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
    margin-bottom: 12px;
    font-size: 0.9em;
}
.consent-row a { color: var(--accent-color); text-decoration: none; }
.consent-row a:hover { text-decoration: underline; }

/* Disabled button state */
#username-setup-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- Header Controls & Profile Icon --- */
.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

#user-profile-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border-color);
}

#profile-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* --- Profile Editing Panel --- */
#profile-panel {
    position: absolute;
    top: 75px;
    right: 20px;
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 20px;
    z-index: 100;
    width: 250px;
}

#profile-panel h3 {
    text-align: center;
    margin-bottom: 15px;
}

#avatar-upload-input {
    display: none;
}

.avatar-label {
    text-align: center;
    margin-bottom: 15px;
    font-size: 0.9em;
}

#username-edit-input {
    width: 100%;
    box-sizing: border-box; /* Ensures padding doesn't add to the width */
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin-bottom: 10px; /* Add some space below the input */
}

.profile-buttons {
    display: flex;
    gap: 10px; /* Creates space between the buttons */
}

.profile-buttons > .avatar-label,
.profile-buttons > #profile-save-btn {
    flex: 1; 
    width: auto; 
    margin-bottom: 0; 
    padding: 10px; 
    text-align: center; 
    font-size: 0.8em;
}

#profile-save-btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 5px;
    background-color: var(--success-color);
    color: white;
    cursor: pointer;
    font-weight: bold;
}

/* --- Session Conflict Screen --- */
#session-conflict-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); /* Darker overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* Highest z-index */
}

#session-conflict-modal {
    background-color: var(--secondary-bg);
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    border: 1px solid var(--error-color);
}

#session-conflict-modal h2 {
    margin-bottom: 10px;
    color: var(--error-color);
}

#app-logo {
    cursor: pointer;
}

/* Add these styles to the end of your style.css */
#file-request-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* Join approval overlay (host) */
#join-approval-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1200;
}

#join-approval-modal {
    background-color: var(--secondary-bg);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    max-width: 90%;
    width: 380px;
}

/* Prevent background interaction when overlays open */
body.modal-open {
    overflow: hidden;
}

/* Footer */
.site-footer {
    position: relative; /* Needed for the pseudo-element line */
    margin-top: 60px;   /* More space above the footer */
    padding: 40px 20px; /* Increased padding for a less cramped feel */
    /* background-color: #e5e5e5; A distinct, lighter background for day mode */
    background-color: var(--primary-bg);
    border-top: none;       /* Remove the old, harsh border */
    text-align: center;
    border-radius: 20px;
    overflow: hidden;
}

/* The glowing separator line for day mode */
.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--accent-color), transparent);
    opacity: 0.3;
}

.footer-top {
    justify-content: center;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.footer-nav a {
    color: #555; 
    margin: 0 15px; 
    text-decoration: none;
    transition: color 0.2s ease;
}
.footer-nav a:hover { 
    color: var(--accent-color); 
    text-decoration: none;
}
.footer-bottom p {
    color: #666; /* Softer color for less important text */
    margin: 4px 0;
    font-size: 0.9em;
}
.footer-bottom p:first-child { 
    text-align: center; 
    margin-bottom: 0;
}
.footer-bottom p:last-child { 
    text-align: center;
}


/* Content sections */
.content-section { margin: 30px 0; }
.articles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 20px; }
.article-card { 
    border: 1px solid var(--border-color); 
    border-radius: 12px; 
    padding: 20px; 
    /*background: #e8eef2;  Darker than light mode background (#f4f7f9) */
    background: var(--primary-bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}
.article-card:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.article-card h4 { 
    margin: 0 0 12px 0; 
    color: var(--primary-text); 
    font-size: 1.1em;
    line-height: 1.3;
}
.article-card p { 
    margin: 0 0 16px 0; 
    color: var(--primary-text); 
    opacity: 0.8; 
    font-size: 0.95em;
    line-height: 1.5;
}
.article-card a { 
    color: var(--accent-color); 
    text-decoration: none; 
    font-weight: 600;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s ease;
}
.article-card a:hover { 
    color: var(--accent-hover);
    text-decoration: none;
}
.article-card a::after {
    content: '→';
    transition: transform 0.2s ease;
}
.article-card a:hover::after {
    transform: translateX(2px);
}

/* How to use carousel */
#how-to-use {
    margin: 40px 0;
}

.carousel-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.carousel-wrapper {
    overflow: hidden;
    border-radius: 12px;
}

.carousel-track {
    display: flex;
    transition: transform 0.3s ease;
}

.carousel-slide {
    min-width: 100%;
    flex-shrink: 0;
}

.carousel-image-placeholder {
    height: 150px;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2em;
    font-weight: 600;
    text-align: center;
    padding: 20px;
}

/* Related Articles Component */
.related-articles {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}
.related-articles h3 {
    margin: 0 0 12px 0;
    color: var(--primary-text);
    font-size: 1.1em;
}
.related-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
.related-card {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
    display: flex;
    flex-direction: column; /* thumbnail on top, content below */
}
.related-card:focus-within, .related-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.related-link { display: block; text-decoration: none; color: inherit; }
.related-thumb { width: 100%; height: 220px; object-fit: cover; border-radius: 12px; display: block; }
.related-meta { display: block; padding: 12px; }
.related-title { font-size: 1em; margin: 0 0 8px 0; }
.related-excerpt { font-size: 0.92em; margin: 0 0 12px 0; color: #666; max-height: 3.6em; overflow: hidden; text-overflow: ellipsis; }
.related-more { font-size: 0.95em; color: var(--accent-color); font-weight: 600; }

/* Remove the decorative arrow that article-card links show globally for related cards */
.related-card a::after { content: ''; }
.related-card a:hover::after { transform: none; }

/* Small screens: use horizontal scroll with snap */
@media (max-width: 760px) {
    .related-list {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        gap: 12px;
        padding-bottom: 6px;
    }
    .related-card { min-width: 80%; scroll-snap-align: start; }
    /* thumbnails will scale; a dedicated mobile breakpoint caps height to 200px */
}

/* Mobile breakpoint: cap thumbnail height to 200px and keep rounded corners */
@media (max-width: 600px) {
    .related-thumb {
        height: auto; /* allow natural scaling */
        max-height: 200px; /* mobile maximum */
        border-radius: 12px; /* round upper and lower corners */
    }
}

@media (min-width: 761px) and (max-width: 1100px) {
    .related-list { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1101px) {
    .related-list { grid-template-columns: repeat(2, 1fr); }
}

/* Accessibility: make images non-focusable */
.related-thumb { pointer-events: none; }

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--secondary-bg);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.carousel-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.carousel-prev {
    left: 15px;
}

.carousel-next {
    right: 15px;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color);
    cursor: pointer;
    transition: background 0.2s ease;
}

.dot.active {
    background: var(--accent-color);
}

.dot:hover {
    background: var(--accent-hover);
}


#file-request-modal {
    background-color: var(--secondary-bg);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    max-width: 90%;
    width: 400px;
}

/* Limit recent transfers list to ~4 items and enable scroll */
#history-list {
    max-height: 220px;
    overflow-y: auto;
}

#file-request-list {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    max-height: 150px;
    overflow-y: auto;
    background-color: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    text-align: left;
    padding: 10px;
}

#file-request-list li {
    padding: 5px;
    font-size: 0.9em;
}

.warning-note {
    font-size: 0.8em;
    opacity: 0.8;
    margin-top: 15px;
}

.modal-buttons {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 20px;
}

.modal-buttons button {
    flex-grow: 1;
    padding: 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
}

#allow-transfer-btn {
    background-color: var(--success-color);
    color: white;
}

#deny-transfer-btn {
    background-color: var(--error-color);
    color: white;
}

/* --- Modern Article Card --- */
body.dark-mode .article-card {
    /*background: linear-gradient(145deg, #303030, #252525); /* Darker gradient background */
    background: #1e1e1e; /* Darker than dark mode background (#1a1a1a) */
    border: 1px solid #444; 
    box-shadow: 0 4px 25px rgba(65, 40, 40, 0.3); 
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    z-index: 1; 
}

/* Position card content above the glow effect */
body.dark-mode .article-card > * {
    position: relative;
    z-index: 3;
}

/* The 'aurora' glow effect using a pseudo-element */
body.dark-mode .article-card::before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
    opacity: 0; /* Hidden by default */
    filter: blur(60px);
    z-index: 2; 
    transition: opacity 0.4s ease;
}

/* Enhanced hover effect */
body.dark-mode .article-card:hover {
    transform: translateY(-5px) scale(1.02); 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); 
    border-color: var(--accent-hover); /* Border glows with the accent color */
}

/* Make the glow visible on hover */
body.dark-mode .article-card:hover::before {
    opacity: 0.15;
}

/* --- Enhanced Footer --- */
body.dark-mode .site-footer {
    position: relative; /* Needed for the pseudo-element line */
    margin-top: 60px;   /* More space above the footer */
    padding: 40px 20px; /* Increased padding for a less cramped feel */
    background-color: #111; /* A distinct, very dark background */
    border-top: none;       /* Remove the old, harsh border */
    text-align: center;
    border-radius: 20px;
    overflow: hidden;

}

/* The glowing separator line */
body.dark-mode .site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--accent-color), transparent);
    opacity: 0.3;
}

/* Center footer elements and improve spacing */
body.dark-mode .footer-top {
    justify-content: center;
    margin-bottom: 20px;
}

body.dark-mode .footer-nav a {
    color: #bbb; 
    margin: 0 15px; 
    transition: color 0.2s ease;
}

body.dark-mode .footer-nav a:hover {
    color: var(--accent-color); 
    text-decoration: none;
}

body.dark-mode .footer-bottom p {
    color: #777; /* Softer color for less important text */
    margin: 4px 0;
    font-size: 0.9em;
}

/* --- Interactive FAQ Accordion (Corrected for Light & Dark Mode) --- */
.faq-item {
    background-color: var(--primary-bg);
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color); /* Base border for all sides */
    transition: all 0.2s ease;
}

.faq-item:hover,
.faq-item:has(.faq-question[aria-expanded="true"]) {
    border-color: var(--accent-color); /* Blue border on hover/open */
}

.faq-question {
    background-color: transparent;
    border: none;
    width: 100%;
    cursor: pointer;
    padding: 15px 20px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--primary-text);
    font-size: 1em;
}

.faq-answer {
    padding: 0 20px 20px 20px;
    color: var(--primary-text);
    opacity: 0.85;
    border-top: 1px solid var(--border-color);
    margin: 0 20px;
}

.faq-question::after {
    content: '+';
    font-size: 1.8em;
    font-weight: 300;
    color: var(--accent-color);
    transition: transform 0.3s ease;
}

.faq-question[aria-expanded="true"]::after {
    content: '−';
    transform: rotate(180deg);
}


/* --- Dark Mode Overrides --- */

body.dark-mode .faq-item {
    background-color: #2c2c2c;
    border: 1px solid #444;
}

body.dark-mode .faq-item:hover {
    background-color: #333; }

body.dark-mode .faq-answer {
    color: #ccc;
    border-top: 1px solid #444;
}

/* --- Share Popup Styles --- */
#share-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#share-popup-modal {
    background-color: var(--secondary-bg);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    max-width: 90%;
    width: 320px;
}

#share-popup-modal h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--primary-text);
}

.share-buttons-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background-color: var(--primary-bg);
    color: var(--primary-text);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.share-btn:hover {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-2px) scale(1.1);
}

.share-icon {
    font-size: 1.5em;
    line-height: 1;
}

.share-close-btn {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--primary-bg);
    color: var(--primary-text);
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s ease;
}

.share-close-btn:hover {
    background-color: var(--border-color);
}

/* Toast Notification */
#toast-notification {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    border-radius: 8px;
    font-size: 0.9em;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    max-width: 90%;
    text-align: center;
}
