/* MTCode Server Platform - Global Stylesheet */

:root {
	--primary: #1a73e8;
	--primary-dark: #1557b0;
	--secondary: #5f6368;
	--accent: #34a853;
	--warning: #fbbc04;
	--danger: #ea4335;
	--bg-dark: #1e1e2e;
	--bg-card: #2a2a3e;
	--bg-section: #f8f9fa;
	--text-light: #e0e0e0;
	--text-dark: #202124;
	--border: #dadce0;
	--shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	--shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
	--radius: 12px;
	--radius-sm: 8px;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
	line-height: 1.6;
	color: var(--text-dark);
	background: #ffffff;
}

/* Navigation */
.navbar {
	background: var(--bg-dark);
	/* Use a responsive horizontal padding so the left brand/nav group and
	   right action group move inward toward the center on wider screens,
	   while shrinking gracefully on small screens. */
	padding: 0.8rem clamp(1rem, 8vw, 8rem);
	display: flex;
	align-items: center;
	justify-content: space-between;
	position: sticky;
	top: 0;
	z-index: 100;
	box-shadow: var(--shadow);
}

.navbar-brand {
	color: #ffffff;
	font-size: 1.3rem;
	font-weight: 700;
	text-decoration: none;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.navbar-brand .brand-icon {
	width: 24px;
	height: 24px;
	vertical-align: middle;
}

.navbar-brand:hover {
	color: var(--primary);
}

.navbar-nav {
	list-style: none;
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
	margin-left: 20px;
}

.navbar-nav a {
	color: var(--text-light);
	text-decoration: none;
	padding: 0.4rem 0.8rem;
	border-radius: var(--radius-sm);
	font-size: 0.9rem;
	transition: background 0.2s, color 0.2s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
	background: var(--primary);
	color: #ffffff;
}

/* Account Dropdown */
.navbar-nav .nav-dropdown {
	position: relative;
}

.navbar-nav .nav-dropdown > a {
	cursor: pointer;
}

.navbar-nav .nav-dropdown .dropdown-menu {
	display: none;
	position: absolute;
	left: 0;
	top: 100%;
	/* No margin-top: a gap here would break the :hover bridge between
	   the toggle and the menu, causing the menu to close when the mouse
	   moves slowly across the gap. */
	margin-top: 0;
	background: var(--bg-card);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-lg);
	min-width: 140px;
	z-index: 200;
	padding: 0.3rem 0;
	list-style: none;
}

.navbar-nav .nav-dropdown:hover .dropdown-menu {
	display: block;
}

.navbar-nav .nav-dropdown .dropdown-menu a {
	display: block;
	padding: 0.5rem 1rem;
	border-radius: 0;
	font-size: 0.85rem;
	white-space: nowrap;
}

.navbar-nav .nav-dropdown .dropdown-menu a:hover {
	background: var(--primary);
	color: #ffffff;
}

/* Inside the dropdown, the current page link should not keep the
   "active" purple background — only hover should highlight an item. */
.navbar-nav .nav-dropdown .dropdown-menu a.active {
	background: transparent;
	color: var(--text-light);
	font-weight: 600;
}

.navbar-nav .nav-dropdown .dropdown-menu a.active:hover {
	background: var(--primary);
	color: #ffffff;
}

/* Nested sub-dropdown — flies out to the right of the Platform dropdown */
.navbar-nav .nav-dropdown .dropdown-menu .nav-sub-dropdown {
	position: relative;
}

.navbar-nav .nav-dropdown .dropdown-menu .nav-sub-dropdown > a::after {
	content: ' \25B8';
	font-size: 0.75rem;
}

.navbar-nav .nav-dropdown .dropdown-menu .nav-sub-dropdown .dropdown-submenu {
	display: none;
	position: absolute;
	left: 100%;
	top: 0;
	background: var(--bg-card);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-lg);
	min-width: 190px;
	z-index: 300;
	padding: 0.3rem 0;
	list-style: none;
	/* Pull left by 2px so there is no gap between the li edge and the
	   submenu — a gap would let :hover drop before the mouse arrives. */
	margin-left: -2px;
}

.navbar-nav .nav-dropdown .dropdown-menu .nav-sub-dropdown:hover .dropdown-submenu {
	display: block;
}

.navbar-nav .nav-dropdown .dropdown-menu .nav-sub-dropdown .dropdown-submenu a {
	display: block;
	padding: 0.5rem 1rem;
	border-radius: 0;
	font-size: 0.85rem;
	white-space: nowrap;
}

.navbar-nav .nav-dropdown .dropdown-menu .nav-sub-dropdown .dropdown-submenu a:hover {
	background: var(--primary);
	color: #ffffff;
}

/* Hero Section */
.hero {
	background: linear-gradient(135deg, var(--bg-dark) 0%, #2d2d44 50%, var(--primary-dark) 100%);
	color: #ffffff;
	padding: 4rem 2rem;
	text-align: center;
	position: relative;
	margin-bottom: 2.5rem;
}

.lang-switch {
	position: absolute;
	top: 1rem;
	/* Match the navbar's responsive horizontal inset so the language
	   switch stays aligned with the right-edge nav controls. */
	right: clamp(1rem, 8vw, 8rem);
	font-size: 0.85rem;
}

/* Account dropdown below hero */
.account-switch {
	position: absolute;
	top: 100%;
	/* Match the navbar's responsive horizontal inset. */
	right: clamp(1rem, 8vw, 8rem);
	margin-top: 0.5rem;
	font-size: 0.9rem;
	z-index: 100;
}

.account-switch .account-toggle {
	color: var(--text-light);
	text-decoration: none;
	padding: 0.4rem 0.8rem;
	border-radius: var(--radius-sm);
	cursor: pointer;
	font-size: 0.9rem;
	transition: background 0.2s, color 0.2s;
}

.account-switch .account-toggle:hover {
	background: var(--primary);
	color: #ffffff;
}

.account-switch .account-menu {
	display: none;
	position: absolute;
	right: 0;
	top: 100%;
	margin-top: 0.3rem;
	background: var(--bg-card);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-lg);
	min-width: 190px;
	z-index: 200;
	padding: 0.3rem 0;
	list-style: none;
}

.account-switch .account-menu li a {
	display: block;
	padding: 0.5rem 1rem;
	color: var(--text-light);
	text-decoration: none;
	font-size: 0.85rem;
	white-space: nowrap;
	transition: background 0.2s;
}

.account-switch .account-menu li a:hover {
	background: var(--primary);
	color: #ffffff;
}

.lang-switch a {
	color: rgba(255, 255, 255, 0.7);
	text-decoration: none;
	padding: 0.2rem 0.5rem;
	border-radius: 4px;
	transition: color 0.2s, background 0.2s;
}

.lang-switch a:hover {
	color: #ffffff;
	background: rgba(255, 255, 255, 0.15);
}

.lang-switch a.active {
	color: #ffffff;
	background: rgba(255, 255, 255, 0.2);
	font-weight: 600;
}

.lang-switch .separator {
	color: rgba(255, 255, 255, 0.4);
	margin: 0 0.15rem;
}

.hero h1 {
	font-size: 2.8rem;
	margin-bottom: 1rem;
	font-weight: 800;
}

.hero p {
	font-size: 1.2rem;
	max-width: 700px;
	margin: 0 auto;
	opacity: 0.9;
}

.hero-sub {
	padding: 3rem 2rem;
}

.hero-sub h1 {
	font-size: 2.2rem;
}

/* Container */
.container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 2rem;
}

/* Sections */
.section {
	padding: 1rem 0;
}

.section-alt {
	background: var(--bg-section);
}

.section h2 {
	font-size: 1.8rem;
	margin-bottom: 1.5rem;
	color: var(--text-dark);
	text-align: center;
}

.section h3 {
	font-size: 1.3rem;
	margin-bottom: 1rem;
	color: var(--primary-dark);
}

/* Product Cards */
.product-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	gap: 1.5rem;
	padding: 1rem 0;
}

.product-card {
	background: #ffffff;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.8rem;
	transition: transform 0.2s, box-shadow 0.2s;
	text-decoration: none;
	color: inherit;
	display: block;
}

.product-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--shadow-lg);
}

.product-card .card-icon {
	font-size: 2.5rem;
	margin-bottom: 0.8rem;
}

.product-card h3 {
	font-size: 1.2rem;
	margin-bottom: 0.6rem;
	color: var(--text-dark);
}

.product-card p {
	color: var(--secondary);
	font-size: 0.95rem;
}

/* Tag/Badge */
.tag {
	display: inline-block;
	padding: 0.2rem 0.6rem;
	border-radius: 20px;
	font-size: 0.75rem;
	font-weight: 600;
	margin: 0.2rem;
}

.tag-blue { background: #e8f0fe; color: var(--primary); }
.tag-green { background: #e6f4ea; color: var(--accent); }
.tag-orange { background: #fef7e0; color: #e37400; }
.tag-red { background: #fce8e6; color: var(--danger); }
.tag-purple { background: #f3e8fd; color: #7b1fa2; }
.tag-gray { background: #f1f3f4; color: var(--secondary); }

/* Feature List */
.feature-list {
	list-style: none;
	padding: 0;
}

.feature-list li {
	padding: 0.5rem 0;
	padding-left: 1.8rem;
	position: relative;
	border-bottom: 1px solid #f0f0f0;
}

.feature-list li::before {
	content: '✓';
	position: absolute;
	left: 0;
	color: var(--accent);
	font-weight: 700;
}

/* Diagram Container */
.diagram-container {
	background: #ffffff;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 0.5rem 0.5rem 1rem;
	margin: 1.5rem 0;
	overflow-x: auto;
	box-shadow: var(--shadow);
}

.diagram-container .mermaid {
	display: flex;
	justify-content: center;
}

.diagram-caption {
	text-align: center;
	font-size: 0.9rem;
	color: var(--secondary);
	margin-top: 1rem;
	font-style: italic;
}

/* Two-column layout */
.two-col {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 2rem;
	align-items: start;
}

/* Tech stack table */
.tech-table {
	width: 100%;
	border-collapse: collapse;
	margin: 1rem 0;
}

.tech-table th,
.tech-table td {
	padding: 0.7rem 1rem;
	text-align: left;
	border-bottom: 1px solid var(--border);
}

.tech-table th {
	background: var(--bg-section);
	font-weight: 600;
	color: var(--primary-dark);
}

.tech-table tr:hover td {
	background: #f8f9fa;
}

/* Info boxes */
.info-box {
	border-left: 4px solid var(--primary);
	background: #f0f4ff;
	padding: 1rem 1.2rem;
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	margin: 1rem 0;
}

.info-box.warn {
	border-left-color: var(--warning);
	background: #fffde7;
}

.info-box.success {
	border-left-color: var(--accent);
	background: #e8f5e9;
}

/* Footer */
.footer {
	background: var(--bg-dark);
	color: var(--text-light);
	text-align: center;
	padding: 1.5rem 2rem;
	font-size: 0.85rem;
}

.footer a {
	color: var(--primary);
	text-decoration: none;
}

/* Hero Actions (Download + Account) — inside navbar */
.hero-actions {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin-left: auto;
	padding-left: 1rem;
}

.hero-actions .account-switch {
	position: relative;
	top: auto;
	right: auto;
	margin-top: 0;
}

.download-btn {
	color: var(--text-light);
	text-decoration: none;
	padding: 0.4rem 0.8rem;
	border-radius: var(--radius-sm);
	font-size: 0.9rem;
	white-space: nowrap;
	transition: background 0.2s, color 0.2s;
}

.download-btn:hover {
	background: var(--primary);
	color: #ffffff;
}

/* Responsive */
@media (max-width: 768px) {
	.hero h1 { font-size: 2rem; }
	.hero-sub h1 { font-size: 1.6rem; }
	.two-col { grid-template-columns: 1fr; }
	.navbar { flex-direction: column; gap: 0.5rem; }
	.navbar-nav { justify-content: center; }
	.product-grid { grid-template-columns: 1fr; }
	.hero-actions { padding-left: 0.5rem; gap: 0.4rem; }
}
