/* === SMF Admin - Light/Dark Theme with CSS Variables === */

/* --- Light Mode (Default) --- */
:root {
	--bg-body: #f0f2f5;
	--bg-header: linear-gradient(135deg, #ffffff, #f8fafc);
	--bg-header-border: #e2e8f0;
	--bg-content: #ffffff;
	--bg-content-shadow: rgba(0,0,0,0.08);
	--bg-nav-hover: rgba(59,130,246,0.08);
	--bg-nav-active: rgba(59,130,246,0.12);
	--bg-input: #ffffff;
	--bg-input-focus-shadow: rgba(59,130,246,0.15);
	--bg-editrow: #fffbeb;
	--bg-editrow-border: #fcd34d;
	--bg-message: #f0f9ff;
	--bg-message-border: #bae6fd;
	--bg-error: #fef2f2;
	--bg-error-border: #fecaca;
	--bg-btn: #f8fafc;
	--bg-btn-hover: #e2e8f0;
	--bg-section-selected: #eff6ff;
	--bg-section-selected-border: #3b82f6;
	--border-color: #e2e8f0;
	--border-strong: #cbd5e0;
	--text-primary: #1e293b;
	--text-secondary: #475569;
	--text-muted: #94a3b8;
	--text-link: #2563eb;
	--text-link-hover: #1d4ed8;
	--text-link-visited: #7c3aed;
	--text-heading: #0f172a;
	--text-message: #0369a1;
	--text-error: #dc2626;
	--text-input: #1e293b;
	--accent: #3b82f6;
	--accent-hover: #2563eb;
	--accent-gradient: linear-gradient(135deg, #3b82f6, #2563eb);
	--danger-gradient: linear-gradient(135deg, #ef4444, #dc2626);
	--th-bg: #f8fafc;
	--th-border: #3b82f6;
	--th-color: #475569;
	--nav-border-left: transparent;
	--nav-active-border: #3b82f6;
	--fieldgroup-bg: #f8fafc;
}

/* --- Dark Mode --- */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg-body: #0f172a;
		--bg-header: linear-gradient(135deg, #1e293b, #0f172a);
		--bg-header-border: #334155;
		--bg-content: #1e293b;
		--bg-content-shadow: rgba(0,0,0,0.3);
		--bg-nav-hover: rgba(59,130,246,0.1);
		--bg-nav-active: rgba(59,130,246,0.15);
		--bg-input: #0f172a;
		--bg-input-focus-shadow: rgba(59,130,246,0.2);
		--bg-editrow: rgba(59,130,246,0.1);
		--bg-editrow-border: #3b82f6;
		--bg-message: #1e293b;
		--bg-message-border: #334155;
		--bg-error: rgba(239,68,68,0.15);
		--bg-error-border: #ef4444;
		--bg-btn: #1e293b;
		--bg-btn-hover: #334155;
		--bg-section-selected: rgba(59,130,246,0.15);
		--bg-section-selected-border: #3b82f6;
		--border-color: #334155;
		--border-strong: #475569;
		--text-primary: #e2e8f0;
		--text-secondary: #cbd5e1;
		--text-muted: #94a3b8;
		--text-link: #60a5fa;
		--text-link-hover: #38bdf8;
		--text-link-visited: #818cf8;
		--text-heading: #f1f5f9;
		--text-message: #38bdf8;
		--text-error: #f87171;
		--text-input: #e2e8f0;
		--accent: #3b82f6;
		--accent-hover: #60a5fa;
		--accent-gradient: linear-gradient(135deg, #3b82f6, #2563eb);
		--danger-gradient: linear-gradient(135deg, #ef4444, #dc2626);
		--th-bg: #1e293b;
		--th-border: #3b82f6;
		--th-color: #94a3b8;
		--nav-border-left: transparent;
		--nav-active-border: #3b82f6;
		--fieldgroup-bg: #334155;
	}
}

/* Force dark mode */
:root[data-theme="dark"] {
	--bg-body: #0f172a;
	--bg-header: linear-gradient(135deg, #1e293b, #0f172a);
	--bg-header-border: #334155;
	--bg-content: #1e293b;
	--bg-content-shadow: rgba(0,0,0,0.3);
	--bg-nav-hover: rgba(59,130,246,0.1);
	--bg-nav-active: rgba(59,130,246,0.15);
	--bg-input: #0f172a;
	--bg-input-focus-shadow: rgba(59,130,246,0.2);
	--bg-editrow: rgba(59,130,246,0.1);
	--bg-editrow-border: #3b82f6;
	--bg-message: #1e293b;
	--bg-message-border: #334155;
	--bg-error: rgba(239,68,68,0.15);
	--bg-error-border: #ef4444;
	--bg-btn: #1e293b;
	--bg-btn-hover: #334155;
	--bg-section-selected: rgba(59,130,246,0.15);
	--bg-section-selected-border: #3b82f6;
	--border-color: #334155;
	--border-strong: #475569;
	--text-primary: #e2e8f0;
	--text-secondary: #cbd5e1;
	--text-muted: #94a3b8;
	--text-link: #60a5fa;
	--text-link-hover: #38bdf8;
	--text-link-visited: #818cf8;
	--text-heading: #f1f5f9;
	--text-message: #38bdf8;
	--text-error: #f87171;
	--text-input: #e2e8f0;
	--accent: #3b82f6;
	--accent-hover: #60a5fa;
	--accent-gradient: linear-gradient(135deg, #3b82f6, #2563eb);
	--danger-gradient: linear-gradient(135deg, #ef4444, #dc2626);
	--th-bg: #1e293b;
	--th-border: #3b82f6;
	--th-color: #94a3b8;
	--nav-border-left: transparent;
	--nav-active-border: #3b82f6;
	--fieldgroup-bg: #334155;
}

/* === Base Styles === */
body {
	background: var(--bg-body);
	text-align: center;
	margin: 0;
	transition: background 0.3s, color 0.3s;
}
body, select, input, option, textarea {
	font: 13px/1.333em -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	color: var(--text-secondary);
}
a { color: var(--text-link); }
a:visited { color: var(--text-link); }
a:hover { color: var(--text-link-hover); }

#pagewrap {
	position: relative;
	min-width: 960px;
	margin: 0 auto;
	text-align: left;
}

/* === Header === */
header {
	padding: 0;
	float: left;
	width: 100%;
	background: var(--bg-header);
	border-bottom: 1px solid var(--bg-header-border);
	min-height: 80px;
	position: relative;
}
#logo {
	float: left;
	margin: 12px 15px;
}
header h1 {
	font-size: 16px;
	line-height: 20px;
	font-weight: 400;
	color: var(--text-muted);
	margin: 0;
	padding-top: 16px;
}
#sitename {
	display: block;
	font-size: 26px;
	line-height: 32px;
	color: var(--text-heading);
	font-weight: 600;
	letter-spacing: 0.5px;
}
#utility {
	position: absolute;
	top: 0;
	right: 16px;
	width: 500px;
	text-align: right;
}
#user {
	position: absolute;
	top: 33px;
	right: 0;
	line-height: 18px;
	color: var(--text-muted);
	width: 340px;
}
#username {
	color: var(--text-heading);
	font-weight: bold;
}
#signout {
	display: inline-block;
	margin-left: 10px;
	padding-left: 10px;
	border-left: 1px solid var(--border-strong);
	color: var(--text-muted);
}

/* === Layout === */
#contentwrap {
	position: relative;
	height: 100%;
	clear: both;
	margin: 0;
	padding: 20px 0;
}

/* === Navigation === */
nav {
	float: left;
	width: 260px;
	margin: 0 0 0 10px;
}
nav h1 { display: none; }
nav ul {
	margin: 0; padding: 0;
	list-style-type: none;
	text-transform: uppercase;
	font-weight: 600;
	font-size: 12px;
	letter-spacing: 0.5px;
	border-top: none;
}
nav ul ul {
	margin-left: 0;
	font-weight: normal;
	text-transform: none;
	border-top: none;
	font-size: 13px;
	letter-spacing: 0;
}
nav ul li { margin: 2px 0; padding: 0; border-bottom: none; }
nav ul ul li { border-bottom: none; margin: 0; }
nav a {
	display: block;
	text-decoration: none;
	color: var(--text-muted);
	padding: 10px 14px 10px 16px;
	line-height: 1.2em;
	border-radius: 8px;
	transition: all 0.2s;
	border-left: 3px solid var(--nav-border-left);
}
nav a:visited,
nav ul a:visited,
nav ul ul a:visited {
	color: var(--text-muted) !important;
}
nav a.current:visited {
	color: var(--text-heading) !important;
}
nav a:hover {
	color: var(--text-heading);
	background: var(--bg-nav-hover);
	border-left-color: var(--nav-active-border);
}
nav a.current {
	color: var(--text-heading);
	font-weight: bold;
	background: var(--bg-nav-active);
	border-left-color: var(--nav-active-border);
}
nav ul ul a {
	padding: 8px 14px 8px 28px;
	font-size: 12px;
}

/* === Content === */
#content {
	min-height: 600px;
	margin-left: 290px;
	margin-right: 10px;
	background: var(--bg-content);
	border-radius: 12px;
	box-shadow: 0 4px 24px var(--bg-content-shadow);
	padding: 24px;
	border: 1px solid var(--border-color);
	transition: background 0.3s;
}
#content h1 {
	font-size: 26px;
	line-height: 32px;
	font-weight: 600;
	color: var(--text-heading);
	margin: 0 0 16px 0;
	padding: 0 0 12px 0;
	border-bottom: 1px solid var(--border-color);
}
.preamble { color: var(--text-muted); }

/* === Forms === */
fieldset { margin: 0; padding: 0; border: none; }
.formfields { margin: 0; padding: 0; list-style-type: none; }
.formfields .formfield { margin: 1.67em 0; padding: 0; position: relative; }

input {
	color: var(--text-input);
	background: var(--bg-input);
	border: 1px solid var(--border-strong);
	border-radius: 6px;
	padding: 6px 10px;
	transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--bg-input-focus-shadow);
}
input[type="text"], input[type="email"], input[type="url"], input[type="password"], select, textarea {
	width: 440px;
	color: var(--text-input);
	background: var(--bg-input);
	border: 1px solid var(--border-strong);
	border-radius: 6px;
	padding: 8px 10px;
}
select {
	color: var(--text-input);
	background: var(--bg-input);
	border: 1px solid var(--border-strong);
	border-radius: 6px;
}
#newModuleID { width: auto; }

input#adminCancel {
	background: var(--danger-gradient);
	float: right;
	color: #fff;
	border: none;
	margin-top: 3px;
	height: 36px;
	padding: 0 20px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	line-height: 36px;
	cursor: pointer;
	transition: all 0.2s;
}
input#adminCancel:hover { opacity: 0.9; transform: translateY(-1px); }

input[type="submit"] {
	float: right;
	background: var(--accent-gradient);
	color: #fff;
	border: none;
	margin-top: 3px;
	height: 36px;
	padding: 0 20px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	line-height: 36px;
	cursor: pointer;
	transition: all 0.2s;
}
input[type="submit"]:hover { opacity: 0.9; transform: translateY(-1px); }

label {
	display: inline-block;
	width: 140px;
	padding-right: 10px;
	text-align: right;
	font-size: 100%;
	line-height: 1.6em;
	font-weight: 600;
	color: var(--text-muted);
}
.helptext, .checkitem label, .tallfield textarea, .infotext, .labeltext {
	margin-left: 150px;
}
td .labeltext { margin: auto; line-height: 1.6em; }

ul.sublist { margin: 0; padding: 0; }
ul.sublist>li.formfield {
	border: 1px solid var(--border-color);
	border-top: none;
	list-style: none;
	margin: 0; padding: 0;
	min-height: 36px;
}
ul.ui-sortable li.ui-sortable-helper,
ul.sublist>li:first-child { border-top: 1px solid var(--border-color); }
ul.sublist .edithead { padding: 3px; line-height: 29px; }
ul.ui-sortable .edithead { margin-left: 38px; }
ul.sublist .handle {
	position: absolute; top: 3px; left: 3px;
	width: 29px; height: 29px;
	background: url(/common/images/handle.png) no-repeat 4px 4px;
	cursor: move;
}
ul.sublist .sectionid { display: inline-block; width: 100px; margin-right: 10px; }
ul.sublist .numeric { width: 20px; }
ul.sublist .rowbuttons { bottom: 3px; position: absolute; right: 5px; }
.infotext, .labeltext { margin-top: -18px; display: block; }

.formfields .error {
	background: var(--bg-error);
	border: 1px solid var(--bg-error-border);
	border-radius: 6px;
	padding: .5em;
	color: var(--text-error);
}
.helptext {
	display: block;
	padding: 2px 0 0 4px;
	font-size: 85%;
	line-height: 1.33em;
	color: var(--text-muted);
}
.checkitem input[type="checkbox"] { margin-left: 130px; position: relative; top: 2px; }
.checkitem label { position: absolute; padding-left: 4px; width: auto; text-align: left; }
.tallfield label { position: absolute; height: 27px; line-height: 27px; }
.fullwidth label { position: relative; text-align: left; }

input.field0 { width: 130px; }
input.field1 { width: 150px; }
input.field1s { width: 120px; }
input.field2 { width: 280px; }
input.field2s { width: 260px; }
input.field3 { width: 420px; }
input.field3s { width: 400px; }

/* === Footer === */
footer {
	float: right; clear: both;
	padding: 10px 0 20px 0;
	text-align: right;
	font-size: 84.6%;
	line-height: 50px;
	color: var(--text-muted);
}
footer a { color: var(--text-muted); text-decoration: none; }
footer a:hover { color: var(--text-secondary); }
#footerlogo { border: none; float: right; padding-left: 12px; height: 50px; width: 50px; }

/* === Tables === */
table {
	width: 100%; line-height: 1.25em;
	border: none; border-collapse: collapse; border-spacing: 0;
}
table.subtable { border: 1px solid var(--border-color); border-radius: 8px; }
th, td { padding: 3px; margin: 0; border: none; min-width: 40px; }
th {
	padding: 6px 8px;
	background: var(--th-bg);
	line-height: 1.1em;
	border-bottom: 2px solid var(--th-border);
	color: var(--th-color);
	font-weight: 600;
	text-transform: uppercase;
	font-size: 11px;
	letter-spacing: 0.5px;
}
td { border-bottom: 1px solid var(--border-color); color: var(--text-secondary); }
td:first-child { min-width: 20px; }
table.subtable td:first-child { padding-left: 5px; }
table.subtable .formfields .formfield { margin: 6px 0 12px 0; }
table.subtable label { width: 120px; top: 0.25em; font-weight: normal; }
table.subtable th { border-bottom: 2px solid var(--border-strong); }
select.filePrefix { width: 100px !important; }
input.fileData { margin-left: 10px; width: 330px; }
input.timeData { width: 100px; margin-right: 10px; }

/* === Edit Rows === */
ul.sublist>li.editing { border: none; }
.editing .edithead { display: none; }
.editing .editrow { display: block; }
.editrow {
	background: var(--bg-editrow);
	border: 1px solid var(--bg-editrow-border);
	border-radius: 8px;
	color: var(--text-primary);
	padding-bottom: 6px;
	display: none;
}
.editrow input, .editrow select, .editrow .helptext, .editrow span {
	margin-left: 150px; width: 310px;
}

/* === Buttons === */
.rowbuttons { text-align: right; }
.tablebuttons { margin: 4px 0; text-align: right; }
a.textbutton {
	display: inline-block;
	text-align: center;
	min-width: 50px;
	margin: 2px;
	padding: 6px 12px;
	line-height: 1.2em;
	text-decoration: none;
	border: 1px solid var(--border-strong);
	background: var(--bg-btn);
	border-radius: 6px;
	color: var(--text-secondary);
	transition: all 0.2s;
}
a.textbutton:hover {
	color: var(--text-heading);
	background: var(--bg-btn-hover);
	border-color: var(--accent);
}
a.textbutton.save {
	color: #fff; font-weight: bold;
	background: var(--accent-gradient);
	border-color: var(--accent);
}
a.textbutton.save:hover { opacity: 0.9; }
a.textbutton.add:hover { background: rgba(59,130,246,0.12); border-color: var(--accent); color: var(--accent); }
a.textbutton.edit:hover { background: rgba(245,158,11,0.12); border-color: #f59e0b; color: #f59e0b; }
a.textbutton.delete:hover { background: rgba(239,68,68,0.12); border-color: #ef4444; color: #ef4444; }

/* === Message === */
#message {
	text-align: center;
	font-weight: 600;
	margin: 2px 2px 10px 2px;
	padding: 8px 12px;
	line-height: 20px;
	border: 1px solid var(--bg-message-border);
	background: var(--bg-message);
	border-radius: 8px;
	color: var(--text-message);
}
#message.errormessage {
	background: var(--bg-error);
	border-color: var(--bg-error-border);
	color: var(--text-error);
}

/* === Admin Sections Tabs === */
#adminSections {
	height: 30px; margin: 0;
	padding: 0 0 10px 0;
	border-bottom: 1px solid var(--border-color);
}
#adminSections li {
	text-align: center; float: left; list-style: none;
	padding: 0 10px; line-height: 28px; margin: 1px;
}
#adminSections li.selected {
	background: var(--bg-section-selected);
	border: 1px solid var(--bg-section-selected-border);
	margin: 0; border-radius: 6px;
}
#adminSections li.module a { color: var(--text-heading); font-weight: bold; }
#adminSections li a { text-decoration: none; display: block; color: var(--text-muted); }
#adminSections li.selected a { color: var(--accent); }
#adminFields li.hidden { margin: 0; visibility: hidden; }
.sectionsnone { font-weight: bold; text-align: center; color: var(--text-muted); }
table .labelfield label { font-weight: bold; top: 0; }

/* === Misc === */
dl { font-size: 85%; margin: 2em 0; }
dt { float: left; text-align: right; min-width: 120px; font-weight: bold; padding-right: 0.5em; color: var(--text-muted); }
dt:after { content: ": "; }
h1 img { vertical-align: middle; }
#moduleDescription { }
#moduleImage { margin-top: -8px; }

#homescreen_layout { float: left; }
#homescreen_layout h2 {
	font-size: 14px; margin: 0; padding: 4px;
	border-radius: 4px 4px 0 0;
	background: var(--fieldgroup-bg);
	border-bottom: 1px solid var(--border-strong);
	color: var(--text-primary);
}
.section_wrapper {
	padding: 0; border: 1px solid var(--border-strong);
	border-radius: 8px; margin: 0 0 10px 0;
}

.springboard { margin: 0; width: 100%; padding: 6px; }
.springboard div {
	cursor: move; position: relative; margin: 0; padding: 8px 5px;
	border: 0; float: left; text-align: center; vertical-align: top;
}
.springboard img { height: 50px; width: 50px; margin-bottom: 1px; }
.springboard .separator { display: block; width: 100%; height: 18px; clear: both; margin: 0; padding: 0; float: none; }
.springboard .badge img { position: absolute; right: 12px; top: 5px; width: 24px; height: 24px; }
.springboard .secured { position: absolute; z-index: 100; top: 45px; right: 4px; width: 18px; height: 22px; background: url(/common/images/secured.png) no-repeat; }
.springboard .utility .secured { top: 28px; right: 14px; }
.springboard_clear { clear: left; }
.springboard input { display: block; width: 80px; text-align: center; }

a.formbutton {
	cursor: default; text-align: center; display: inline-block;
	padding-right: 7px; margin: 0 5px; height: 36px; text-decoration: none;
	background-image: url(/common/images/button-sd-r.png); background-repeat: no-repeat; background-position: right;
}
a.formbutton div {
	display: inline-block; color: #fff; font-weight: bold; font-size: 94.12%;
	line-height: 26px; text-decoration: none; padding: 5px 5px 5px 12px;
	background-image: url(/common/images/button-sd-l.png); background-repeat: no-repeat; background-position: left;
}
fieldset { border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 1.5em; padding: 0; }
fieldset.collapsable { border: none; }
.fieldgroup-legend { padding: 4px 6px; font-weight: bold; font-size: 110%; color: var(--text-primary); }
.collapsable .fieldgroup-legend {
	cursor: pointer; display: inline-block; text-align: center; min-width: 50px;
	margin: 2px; padding: 4px 6px; line-height: 1.2em; text-decoration: none;
	border: 1px solid var(--border-strong); background: var(--bg-btn); border-radius: 6px;
	margin-left: 150px; font-size: 100%; font-weight: normal;
}
.fieldgroup-description { margin-left: 6px; display: block; padding: 2px 0 0 0; font-size: 85%; line-height: 1.33em; color: var(--text-muted); }
.collapsable .fieldgroup-description { margin-left: 150px; }
p.blurb { font-size: 20px; line-height: 26px; color: var(--text-muted); }
input.admin-button { float: left; width: 150px; margin-right: 20px; }

/* === Theme Toggle Button === */
#theme-toggle {
	cursor: pointer;
	background: var(--bg-btn);
	border: 1px solid var(--border-strong);
	border-radius: 20px;
	padding: 5px 12px;
	font-size: 16px;
	line-height: 1;
	transition: all 0.2s;
	color: var(--text-secondary);
	vertical-align: middle;
}
#theme-toggle:hover {
	background: var(--bg-btn-hover);
	border-color: var(--accent);
}
