/*
Theme Name: Gold Tracker
Description: Persönlicher Gold-Kauftracker
Version: 1.0.0
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 8.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: gold-tracker
*/

:root {
	--gold:        #c9a84c;
	--gold-dark:   #a8893c;
	--gold-light:  #f0e4b8;
	--bg:          #f7f3eb;
	--card:        #ffffff;
	--text:        #2c2c2c;
	--muted:       #777;
	--border:      #e0d6be;
	--success-bg:  #e8f5e9;
	--success-fg:  #2e7d32;
	--error-bg:    #fdecea;
	--error-fg:    #c0392b;
	--radius:      8px;
	--shadow:      0 2px 8px rgba(0, 0, 0, 0.08);
}

*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	background: var(--bg);
	color: var(--text);
	line-height: 1.6;
	font-size: 16px;
}

/* ── Layout ─────────────────────────────────────────────────── */

.gt-wrap {
	max-width: 960px;
	margin: 0 auto;
	padding: 2rem 1.25rem 4rem;
}

/* ── Header ─────────────────────────────────────────────────── */

.gt-header {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin-bottom: 2rem;
	padding-bottom: 1rem;
	border-bottom: 2px solid var(--gold);
}

.gt-header h1 {
	font-size: 1.6rem;
	font-weight: 700;
	color: var(--gold-dark);
}

.gt-header .gt-icon {
	font-size: 1.6rem;
	line-height: 1;
}

/* ── Notices ─────────────────────────────────────────────────── */

.gt-notice {
	padding: 0.75rem 1rem;
	border-radius: var(--radius);
	margin-bottom: 1.5rem;
	font-size: 0.9rem;
	border: 1px solid transparent;
}

.gt-notice.success {
	background: var(--success-bg);
	color: var(--success-fg);
	border-color: #a5d6a7;
}

.gt-notice.error {
	background: var(--error-bg);
	color: var(--error-fg);
	border-color: #ef9a9a;
}

/* ── Summary Cards ───────────────────────────────────────────── */

.gt-summary {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 1rem;
	margin-bottom: 2rem;
}

.gt-stat {
	background: var(--card);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 1rem 1.25rem;
	border-top: 3px solid var(--gold);
}

.gt-stat .label {
	font-size: 0.72rem;
	font-weight: 600;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-bottom: 0.25rem;
}

.gt-stat .value {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--gold-dark);
	font-variant-numeric: tabular-nums;
}

/* ── Card ────────────────────────────────────────────────────── */

.gt-card {
	background: var(--card);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 1.5rem;
	margin-bottom: 1.5rem;
}

.gt-card h2 {
	font-size: 1rem;
	font-weight: 700;
	color: var(--gold-dark);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-bottom: 1.25rem;
}

/* ── Form ────────────────────────────────────────────────────── */

.gt-form {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 1rem;
	align-items: end;
}

.gt-field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

.gt-field label {
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.gt-field input {
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--border);
	border-radius: 6px;
	font-size: 0.95rem;
	background: #faf8f3;
	color: var(--text);
	transition: border-color 0.15s, background 0.15s;
	width: 100%;
}

.gt-field input:focus {
	outline: none;
	border-color: var(--gold);
	background: #fff;
}

.gt-form-actions {
	display: flex;
	align-items: flex-end;
}

.gt-btn {
	padding: 0.65rem 1.5rem;
	background: var(--gold);
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s;
	width: 100%;
	white-space: nowrap;
}

.gt-btn:hover {
	background: var(--gold-dark);
}

/* ── Table ───────────────────────────────────────────────────── */

.gt-table-wrap {
	overflow-x: auto;
}

table.gt-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.gt-table th {
	background: var(--gold-light);
	color: var(--gold-dark);
	font-weight: 700;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 0.6rem 0.75rem;
	text-align: left;
	border-bottom: 2px solid var(--gold);
	white-space: nowrap;
}

.gt-table th.num,
.gt-table td.num {
	text-align: right;
}

.gt-table td {
	padding: 0.6rem 0.75rem;
	border-bottom: 1px solid var(--border);
	vertical-align: middle;
	font-variant-numeric: tabular-nums;
}

.gt-table tbody tr:last-child td {
	border-bottom: none;
}

.gt-table tbody tr:hover td {
	background: #faf8f3;
}

.gt-table tfoot td {
	background: #f0e8d0;
	font-weight: 700;
	border-top: 2px solid var(--gold);
	padding: 0.65rem 0.75rem;
}

.gt-delete {
	color: #ccc;
	font-size: 0.8rem;
	text-decoration: none;
	transition: color 0.15s;
	padding: 0.2rem 0.4rem;
}

.gt-delete:hover {
	color: var(--error-fg);
}

.gt-empty {
	text-align: center;
	color: var(--muted);
	padding: 2rem;
	font-size: 0.9rem;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 600px) {
	.gt-stat .value {
		font-size: 1.2rem;
	}
}

/* ── Goldpreis-Card ──────────────────────────────────────────────── */

.gt-price-card {
	border-top-color: var(--gold-dark);
}

.gt-price-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	margin-bottom: 1rem;
}

.gt-price-header h2 {
	margin-bottom: 0;
}

.gt-price-form-wrap {
	margin-top: 1.25rem;
	padding-top: 1rem;
	border-top: 1px solid var(--border);
}

.gt-price-inputs {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.6rem;
}

.gt-price-or {
	font-size: 0.82rem;
	color: var(--muted);
	white-space: nowrap;
}

.gt-price-manual {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}

.gt-input-manual {
	padding: 0.4rem 0.65rem;
	border: 1px solid var(--border);
	border-radius: 6px;
	font-size: 0.9rem;
	width: 130px;
	background: #faf8f3;
	color: var(--text);
}

.gt-input-manual:focus {
	outline: none;
	border-color: var(--gold);
	background: #fff;
}

.gt-btn-secondary {
	background: #fff;
	color: var(--gold-dark);
	border: 1px solid var(--gold);
}

.gt-btn-secondary:hover {
	background: var(--gold-light);
}

.gt-manual-badge {
	display: inline-block;
	margin-left: 0.4rem;
	padding: 0.1rem 0.45rem;
	background: var(--gold-light);
	color: var(--gold-dark);
	font-size: 0.7rem;
	font-weight: 600;
	border-radius: 3px;
	vertical-align: middle;
}

.gt-price-form {
	margin: 0;
}

.gt-btn-sm {
	padding: 0.4rem 1rem;
	font-size: 0.85rem;
	width: auto;
}

.gt-price-stats {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 1.5rem 2.5rem;
}

.gt-price-val {
	display: flex;
	align-items: baseline;
	gap: 0.4rem;
}

.gt-price-num {
	font-size: 1.8rem;
	font-weight: 700;
	color: var(--gold-dark);
	font-variant-numeric: tabular-nums;
}

.gt-price-unit {
	font-size: 0.8rem;
	color: var(--muted);
	font-weight: 500;
}

.gt-price-meta {
	font-size: 0.78rem;
	color: var(--muted);
	width: 100%;
	margin-top: 0.25rem;
}

/* ── G/V Stat-Card ───────────────────────────────────────────────── */

.gt-stat-gv.positive {
	border-top-color: #2e7d32;
}

.gt-stat-gv.positive .value {
	color: #2e7d32;
}

.gt-stat-gv.negative {
	border-top-color: var(--error-fg);
}

.gt-stat-gv.negative .value {
	color: var(--error-fg);
}

.gt-gv-pct {
	font-size: 0.85rem;
	font-weight: 600;
	margin-top: 0.1rem;
	color: inherit;
}

/* ── Tabelle: G/V Zellen ─────────────────────────────────────────── */

.gt-pos {
	color: #2e7d32;
}

.gt-neg {
	color: var(--error-fg);
}

.gt-bold {
	font-weight: 700;
}

/* ── Import-Card ─────────────────────────────────────────────────── */

.gt-import-card {
	border-top-color: #888;
}

.gt-import-card h2 {
	color: #555;
}

.gt-import-desc {
	font-size: 0.85rem;
	color: var(--muted);
	margin-bottom: 1rem;
}

.gt-import-form {
	margin: 0;
}

.gt-import-row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.gt-import-row label {
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--muted);
	white-space: nowrap;
}

.gt-import-row input[type="date"] {
	padding: 0.4rem 0.65rem;
	border: 1px solid var(--border);
	border-radius: 6px;
	font-size: 0.9rem;
	background: #faf8f3;
	color: var(--text);
}

.gt-import-row input[type="date"]:focus {
	outline: none;
	border-color: var(--gold);
	background: #fff;
}

/* ── Chart ───────────────────────────────────────────────────────── */

.gt-chart-wrap {
	position: relative;
	height: 280px;
}

@media (max-width: 600px) {
	.gt-chart-wrap {
		height: 220px;
	}

	.gt-price-num {
		font-size: 1.4rem;
	}
}
