/* style.css */
:root {
	--bg-color: #f4f4f9;
	--text-color: #333;
	--heading-color: #4a90e2;
	--border-color: #ccc;
	--card-bg: #fff;
	--button-bg: #4a90e2;
	--button-hover: #357ab8;
	--link-color: #4a90e2;
	--note-border: #ffcc00;
	--note-bg: #fff8e1;
	--note-text: #333;
	--toast-bg: #333;
	--toast-text: #fff;
	--modal-backdrop: rgba(0, 0, 0, 0.5);
	--intro-text: darkgrey;
	--input-bg: #fff;
	--input-text: #333;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg-color: #1a1a1a;
		--text-color: #e0e0e0;
		--heading-color: #5ba3f5;
		--border-color: #444;
		--card-bg: #2a2a2a;
		--button-bg: #5ba3f5;
		--button-hover: #4a90e2;
		--link-color: #5ba3f5;
		--note-border: #d4a800;
		--note-bg: #3a3420;
		--note-text: #e0e0e0;
		--toast-bg: #444;
		--toast-text: #e0e0e0;
		--modal-backdrop: rgba(0, 0, 0, 0.7);
		--intro-text: #999;
		--input-bg: #2a2a2a;
		--input-text: #e0e0e0;
	}
}

body.light-mode {
	--bg-color: #f4f4f9;
	--text-color: #333;
	--heading-color: #4a90e2;
	--border-color: #ccc;
	--card-bg: #fff;
	--button-bg: #4a90e2;
	--button-hover: #357ab8;
	--link-color: #4a90e2;
	--note-border: #ffcc00;
	--note-bg: #fff8e1;
	--note-text: #333;
	--toast-bg: #333;
	--toast-text: #fff;
	--modal-backdrop: rgba(0, 0, 0, 0.5);
	--intro-text: darkgrey;
	--input-bg: #fff;
	--input-text: #333;
}

body.dark-mode {
	--bg-color: #1a1a1a;
	--text-color: #e0e0e0;
	--heading-color: #5ba3f5;
	--border-color: #444;
	--card-bg: #2a2a2a;
	--button-bg: #5ba3f5;
	--button-hover: #4a90e2;
	--link-color: #5ba3f5;
	--note-border: #d4a800;
	--note-bg: #3a3420;
	--note-text: #e0e0e0;
	--toast-bg: #444;
	--toast-text: #e0e0e0;
	--modal-backdrop: rgba(0, 0, 0, 0.7);
	--intro-text: #999;
	--input-bg: #2a2a2a;
	--input-text: #e0e0e0;
}

body {
	font-family: Arial, sans-serif;
	background-color: var(--bg-color);
	color: var(--text-color);
	margin: 0;
	padding: 0;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	height: 100vh;
	transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
	text-align: center;
	padding: 0 20px;
}

.content {
	text-align: justify;
	max-width: 1024px;
	width: 100%;
	padding: 20px;
	box-sizing: border-box;
}


h1 {
	color: var(--heading-color);
	margin-bottom: 20px;
}

h2 {
	margin-top: 20px;
}

input[type="file"] {
	margin-bottom: 2px;
	padding: 10px;
	border: 2px solid var(--button-bg);
	border-radius: 5px;
	font-size: 16px;
	margin-right: 20px;
	margin-left: 20px;
	background-color: var(--input-bg);
	color: var(--input-text);
}

textarea {
	margin-bottom: 10px;
	padding: 10px;
	border: 2px solid var(--button-bg);
	border-radius: 5px;
	font-size: 14px;
	font-family: Arial, sans-serif;
	resize: vertical;
	width: 90%;
	max-width: 500px;
	background-color: var(--input-bg);
	color: var(--input-text);
}


button,
.button {
	border: none;
	padding: 10px 20px;
	border-radius: 5px;
	cursor: pointer;
	font-size: 16px;
	margin: 5px;
	text-decoration: none;
	background-color: var(--button-bg);
	color: white;
	border: none;
	padding: 10px 20px;
	cursor: pointer;
	border-radius: 5px;
	/* Ensure links styled as buttons have no underline */
}

button:hover,
.button:hover {
	background-color: var(--button-hover);
}

button#theme-toggle {
    background-color: transparent;
}

/* Outline button styles */
.button-outline {
    background-color: transparent;
    color: var(--button-bg);
    border: 2px solid var(--button-bg);
}

.button-outline:hover {
    background-color: var(--button-bg);
    color: white;
}

#linkContainer {
	margin-top: 20px;
}

#linkContainer a {
	color: var(--link-color);
	text-decoration: none;
}

#linkContainer a:hover {
	text-decoration: underline;
}

.link-preview p.link-preview-scrollable {
	border: 1px solid var(--border-color);
	padding: 10px;
	margin: 0 auto;
	margin-top: 20px;
	border-radius: 5px;
	background-color: var(--card-bg);
	max-width: 300px;
	/* Set a maximum width */
	overflow-x: auto;
	/* Enable horizontal scrolling */
	word-break: break-all;
	margin-bottom: 10px;
	white-space: nowrap;
}

.link-preview a {
	color: var(--link-color);
	text-decoration: none;
}

.link-preview a:hover {
	text-decoration: underline;
}

.file-info {
	border: 1px solid var(--border-color);
	padding: 20px;
	margin-bottom: 20px;
	border-radius: 5px;
	background-color: var(--card-bg);
	text-align: left;
	display: inline-block;
}

.file-info p {
	margin: 10px 0;
}

.file-info b {
	display: block;
}


footer {
	margin-top: 60px;
	text-align: center;
	padding: 10px 0;
	border-top: 1px solid var(--border-color);

}

.footer-links {
	display: flex;
	justify-content: center;
	gap: 20px;
	font-size: 12px;
	font-weight: 400;
    flex-wrap: wrap;
}

footer a,
.small-link {
	color: var(--link-color);
	text-decoration: none;
	font-size: 12px;
	font-weight: 400;
}

footer a:hover,
.small-link:hover {
	text-decoration: underline;
}

p.small-link-wrap {
	margin-top: 20px;
	color: #ccc;
}

p.warning {
	font-weight: 400;
	margin-top: 30px;
	color: purple;
	max-width: 450px;
	text-align: justify;
	margin: 10px auto 20px;
	line-height: 24px;
}

p.introtext {
	font-size: 14px;
	color: var(--intro-text);
	margin-bottom: 20px;
	max-width: 450px;
	text-align: center;
	margin: 10px auto 20px;
	line-height: 24px;
}


/* Toast notification styles */
#toast {
	visibility: hidden;
	min-width: 250px;
	width: 300px;
	margin-left: -150px; /* Adjusted to center horizontally */
	background-color: var(--toast-bg);
	color: var(--toast-text);
	text-align: center;
	border-radius: 2px;
	padding: 16px;
	position: fixed;
	z-index: 1;
	left: 50%;
	bottom: 30px;
	font-size: 14px;
	line-height: 1.5em;
}

#toast.show {
	visibility: visible;
	-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
	animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@-webkit-keyframes fadein {
	from {
		bottom: 0;
		opacity: 0;
	}

	to {
		bottom: 30px;
		opacity: 1;
	}
}

@keyframes fadein {
	from {
		bottom: 0;
		opacity: 0;
	}

	to {
		bottom: 30px;
		opacity: 1;
	}
}

@-webkit-keyframes fadeout {
	from {
		bottom: 30px;
		opacity: 1;
	}

	to {
		bottom: 0;
		opacity: 0;
	}
}

@keyframes fadeout {
	from {
		bottom: 30px;
		opacity: 1;
	}

	to {
		bottom: 0;
		opacity: 0;
	}
}

#filePreview, 
#fileContent {
	text-align: center;
	margin-top: 20px;
	margin-bottom: 20px;
}

.note {
	border: 2px solid var(--note-border);
	background-color: var(--note-bg);
	padding: 12px;
	margin: 20px 0;
	border-radius: 5px;
	color: var(--note-text);
	font-size: 14px;
	line-height: 1.5;
	max-width: 300px;
	width: 300px;
	margin: 10px auto 20px;
}

.note h3 {
	margin-top: 0;
	color: #ff9900;
}

.note p {
	margin: 10px 0;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow: auto;
	font-size: 14px;
}

.modal-content {
    background-color: var(--card-bg);
    margin: 10% auto;
    padding: 20px;
    border: 1px solid var(--border-color);
    width: 80%;
    max-height: 90%;
    overflow-y: auto;
    border-radius: 5px;
}

.modal-buttons {
    text-align: center;
    margin-top: 20px;
    gap: 10px;
    display: flex;
    justify-content: center;
}

dialog {
    width: 80%;
	max-width: 600px;
    max-height: 90%;
    border: none;
    border-radius: 5px;
    padding: 20px;
    background-color: var(--card-bg);
    color: var(--text-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

dialog::backdrop {
    background-color: var(--modal-backdrop);
}

dialog a {
	color: var(--link-color);
}

div#loading {
	display: none;
	width: 100%;
	height: 4px;
	background: linear-gradient(to right, #3498db 0%, #3498db 50%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.1) 100%);
	background-size: 200% 100%;
	animation: loading 2s linear infinite;
	position: fixed;
	top: 0;
	left: 0;
	z-index: 1000;
}

.modal-body {
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .modal-content {
        width: 90%;
        margin: 5% auto;
        padding: 10px;
    }
}

@keyframes loading {
	0% {
		background-position: 100% 0;
	}

	100% {
		background-position: 0 0;
	}
}

p em {
	font-size: 14px;
}

/* Dark mode toggle button */
#theme-toggle {
	position: fixed;
	top: 20px;
	right: 20px;
	cursor: pointer;
	font-size: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}

#theme-toggle:hover {
	background-color: var(--button-hover);
	transform: scale(1.1);
}

#theme-toggle:active {
	transform: scale(0.95);
}
