/**
 * Material Design 3 Styles for Survey System
 * Based on Material Design 3 (Material You)
 * https://m3.material.io/
 */

:root {
	/* Primary Colors */
	--md-sys-color-primary: #0088cc;
	--md-sys-color-on-primary: #ffffff;
	--md-sys-color-primary-container: #c2e7ff;
	--md-sys-color-on-primary-container: #001e2f;

	/* Secondary Colors */
	--md-sys-color-secondary: #4f616e;
	--md-sys-color-on-secondary: #ffffff;
	--md-sys-color-secondary-container: #d2e5f5;
	--md-sys-color-on-secondary-container: #0b1d28;

	/* Tertiary Colors */
	--md-sys-color-tertiary: #625b71;
	--md-sys-color-on-tertiary: #ffffff;
	--md-sys-color-tertiary-container: #e8def8;
	--md-sys-color-on-tertiary-container: #1d192b;

	/* Error Colors */
	--md-sys-color-error: #ba1a1a;
	--md-sys-color-on-error: #ffffff;
	--md-sys-color-error-container: #ffdad6;
	--md-sys-color-on-error-container: #410002;

	/* Success Colors */
	--md-sys-color-success: #006e26;
	--md-sys-color-on-success: #ffffff;
	--md-sys-color-success-container: #95f991;
	--md-sys-color-on-success-container: #002106;

	/* Warning Colors */
	--md-sys-color-warning: #825500;
	--md-sys-color-on-warning: #ffffff;
	--md-sys-color-warning-container: #ffddb3;
	--md-sys-color-on-warning-container: #291800;

	/* Surface Colors */
	--md-sys-color-surface: #fafcff;
	--md-sys-color-on-surface: #191c1e;
	--md-sys-color-surface-variant: #dde3ea;
	--md-sys-color-on-surface-variant: #41474d;
	--md-sys-color-surface-container-lowest: #ffffff;
	--md-sys-color-surface-container-low: #f3f5f8;
	--md-sys-color-surface-container: #e7eaed;
	--md-sys-color-surface-container-high: #e1e4e7;
	--md-sys-color-surface-container-highest: #dce0e3;

	/* Outline */
	--md-sys-color-outline: #71787e;
	--md-sys-color-outline-variant: #c1c7ce;

	/* Shadows */
	--md-sys-elevation-shadow-1: 0 1px 2px rgba(0,0,0,0.12), 0 0 1px rgba(0,0,0,0.08);
	--md-sys-elevation-shadow-2: 0 1px 3px rgba(0,0,0,0.16), 0 1px 2px rgba(0,0,0,0.12);
	--md-sys-elevation-shadow-3: 0 3px 6px rgba(0,0,0,0.18), 0 2px 4px rgba(0,0,0,0.14);
	--md-sys-elevation-shadow-4: 0 10px 20px rgba(0,0,0,0.22), 0 6px 6px rgba(0,0,0,0.18);

	/* Shape */
	--md-sys-shape-corner-none: 0px;
	--md-sys-shape-corner-extra-small: 4px;
	--md-sys-shape-corner-small: 8px;
	--md-sys-shape-corner-medium: 12px;
	--md-sys-shape-corner-large: 16px;
	--md-sys-shape-corner-extra-large: 28px;
	--md-sys-shape-corner-full: 9999px;

	/* Typography */
	--md-sys-typescale-display-large-font: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	--md-sys-typescale-display-large-size: 57px;
	--md-sys-typescale-display-large-weight: 400;
	--md-sys-typescale-display-large-line-height: 64px;

	--md-sys-typescale-headline-large-size: 32px;
	--md-sys-typescale-headline-large-weight: 400;
	--md-sys-typescale-headline-large-line-height: 40px;

	--md-sys-typescale-headline-medium-size: 28px;
	--md-sys-typescale-headline-medium-weight: 400;
	--md-sys-typescale-headline-medium-line-height: 36px;

	--md-sys-typescale-headline-small-size: 24px;
	--md-sys-typescale-headline-small-weight: 400;
	--md-sys-typescale-headline-small-line-height: 32px;

	--md-sys-typescale-title-large-size: 22px;
	--md-sys-typescale-title-large-weight: 400;
	--md-sys-typescale-title-large-line-height: 28px;

	--md-sys-typescale-title-medium-size: 16px;
	--md-sys-typescale-title-medium-weight: 500;
	--md-sys-typescale-title-medium-line-height: 24px;

	--md-sys-typescale-body-large-size: 16px;
	--md-sys-typescale-body-large-weight: 400;
	--md-sys-typescale-body-large-line-height: 24px;

	--md-sys-typescale-body-medium-size: 14px;
	--md-sys-typescale-body-medium-weight: 400;
	--md-sys-typescale-body-medium-line-height: 20px;

	--md-sys-typescale-label-large-size: 14px;
	--md-sys-typescale-label-large-weight: 500;
	--md-sys-typescale-label-large-line-height: 20px;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	padding: 0;
	font-family: var(--md-sys-typescale-display-large-font);
	font-size: var(--md-sys-typescale-body-large-size);
	line-height: var(--md-sys-typescale-body-large-line-height);
	color: var(--md-sys-color-on-surface);
	background-color: var(--md-sys-color-surface-container-low);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Material Design 3 Components */

/* Buttons */
.md-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 24px;
	border: none;
	border-radius: var(--md-sys-shape-corner-full);
	font-size: var(--md-sys-typescale-label-large-size);
	font-weight: var(--md-sys-typescale-label-large-weight);
	line-height: var(--md-sys-typescale-label-large-line-height);
	cursor: pointer;
	transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
	text-decoration: none;
	position: relative;
	overflow: hidden;
}

.md-button::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0;
	height: 0;
	border-radius: 50%;
	background: rgba(255,255,255,0.3);
	transform: translate(-50%, -50%);
	transition: width 0.6s, height 0.6s;
}

.md-button:hover::before {
	width: 300px;
	height: 300px;
}

.md-button-filled {
	background-color: var(--md-sys-color-primary);
	color: var(--md-sys-color-on-primary);
	box-shadow: var(--md-sys-elevation-shadow-1);
}

.md-button-filled:hover {
	background-color: var(--md-sys-color-primary);
	box-shadow: var(--md-sys-elevation-shadow-2);
}

.md-button-outlined {
	background-color: transparent;
	color: var(--md-sys-color-primary);
	border: 1px solid var(--md-sys-color-outline);
}

.md-button-outlined:hover {
	background-color: rgba(0, 136, 204, 0.08);
}

.md-button-text {
	background-color: transparent;
	color: var(--md-sys-color-primary);
	padding: 10px 12px;
}

.md-button-text:hover {
	background-color: rgba(0, 136, 204, 0.08);
}

.md-button-elevated {
	background-color: var(--md-sys-color-surface-container-low);
	color: var(--md-sys-color-primary);
	box-shadow: var(--md-sys-elevation-shadow-2);
}

.md-button-elevated:hover {
	box-shadow: var(--md-sys-elevation-shadow-3);
}

.md-button-tonal {
	background-color: var(--md-sys-color-secondary-container);
	color: var(--md-sys-color-on-secondary-container);
}

.md-button-tonal:hover {
	background-color: var(--md-sys-color-secondary-container);
	box-shadow: var(--md-sys-elevation-shadow-1);
}

.md-button-large {
	padding: 14px 32px;
	font-size: 16px;
}

.md-button-small {
	padding: 6px 16px;
	font-size: 12px;
}

.md-button:disabled {
	opacity: 0.38;
	cursor: not-allowed;
	box-shadow: none;
}

/* Error/Success/Warning Buttons */
.md-button-error {
	background-color: var(--md-sys-color-error);
	color: var(--md-sys-color-on-error);
}

.md-button-success {
	background-color: var(--md-sys-color-success);
	color: var(--md-sys-color-on-success);
}

.md-button-warning {
	background-color: var(--md-sys-color-warning);
	color: var(--md-sys-color-on-warning);
}

/* Cards */
.md-card {
	background-color: var(--md-sys-color-surface-container-lowest);
	border-radius: var(--md-sys-shape-corner-medium);
	padding: 24px;
	box-shadow: var(--md-sys-elevation-shadow-1);
	transition: box-shadow 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.md-card-elevated {
	box-shadow: var(--md-sys-elevation-shadow-2);
}

.md-card-filled {
	background-color: var(--md-sys-color-surface-container-highest);
	box-shadow: none;
}

.md-card-outlined {
	border: 1px solid var(--md-sys-color-outline-variant);
	box-shadow: none;
}

.md-card:hover {
	box-shadow: var(--md-sys-elevation-shadow-2);
}

/* Text Fields */
.md-textfield {
	position: relative;
	margin-bottom: 16px;
}

.md-textfield-input {
	width: 100%;
	padding: 16px;
	border: 1px solid var(--md-sys-color-outline);
	border-radius: var(--md-sys-shape-corner-extra-small);
	background-color: var(--md-sys-color-surface-container-highest);
	color: var(--md-sys-color-on-surface);
	font-size: var(--md-sys-typescale-body-large-size);
	transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
	outline: none;
}

.md-textfield-input:focus {
	border-color: var(--md-sys-color-primary);
	border-width: 2px;
	padding: 15px;
}

.md-textfield-label {
	display: block;
	margin-bottom: 8px;
	font-size: var(--md-sys-typescale-body-medium-size);
	font-weight: var(--md-sys-typescale-title-medium-weight);
	color: var(--md-sys-color-on-surface);
}

.md-textfield-supporting {
	margin-top: 4px;
	font-size: 12px;
	color: var(--md-sys-color-on-surface-variant);
}

/* Select */
.md-select {
	position: relative;
	margin-bottom: 16px;
}

.md-select-input {
	width: 100%;
	padding: 16px;
	border: 1px solid var(--md-sys-color-outline);
	border-radius: var(--md-sys-shape-corner-extra-small);
	background-color: var(--md-sys-color-surface-container-highest);
	color: var(--md-sys-color-on-surface);
	font-size: var(--md-sys-typescale-body-large-size);
	cursor: pointer;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%2341474d' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 40px;
}

.md-select-input:focus {
	border-color: var(--md-sys-color-primary);
	border-width: 2px;
	padding: 15px 39px 15px 15px;
	outline: none;
}

/* Checkboxes & Radio Buttons */
.md-checkbox,
.md-radio {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 12px;
	cursor: pointer;
	user-select: none;
}

.md-checkbox-input,
.md-radio-input {
	width: 20px;
	height: 20px;
	margin: 0;
	cursor: pointer;
	accent-color: var(--md-sys-color-primary);
}

.md-checkbox-label,
.md-radio-label {
	font-size: var(--md-sys-typescale-body-large-size);
	color: var(--md-sys-color-on-surface);
	cursor: pointer;
}

/* Progress Indicators */
.md-progress-linear {
	width: 100%;
	height: 4px;
	background-color: var(--md-sys-color-surface-container-highest);
	border-radius: var(--md-sys-shape-corner-full);
	overflow: hidden;
}

.md-progress-bar {
	height: 100%;
	background-color: var(--md-sys-color-primary);
	border-radius: var(--md-sys-shape-corner-full);
	transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.md-progress-thick {
	height: 8px;
}

/* Chips */
.md-chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 16px;
	border-radius: var(--md-sys-shape-corner-small);
	font-size: var(--md-sys-typescale-label-large-size);
	font-weight: var(--md-sys-typescale-label-large-weight);
	background-color: var(--md-sys-color-surface-container-low);
	color: var(--md-sys-color-on-surface-variant);
	border: 1px solid var(--md-sys-color-outline);
	transition: background-color 0.2s;
}

.md-chip:hover {
	background-color: var(--md-sys-color-surface-container);
}

.md-chip-filled {
	background-color: var(--md-sys-color-secondary-container);
	color: var(--md-sys-color-on-secondary-container);
	border: none;
}

/* Alerts / Snackbars */
.md-alert {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px;
	border-radius: var(--md-sys-shape-corner-small);
	margin-bottom: 16px;
	background-color: var(--md-sys-color-surface-container-high);
	color: var(--md-sys-color-on-surface);
	border-left: 4px solid var(--md-sys-color-primary);
}

.md-alert-error {
	background-color: var(--md-sys-color-error-container);
	color: var(--md-sys-color-on-error-container);
	border-left-color: var(--md-sys-color-error);
}

.md-alert-success {
	background-color: var(--md-sys-color-success-container);
	color: var(--md-sys-color-on-success-container);
	border-left-color: var(--md-sys-color-success);
}

.md-alert-warning {
	background-color: var(--md-sys-color-warning-container);
	color: var(--md-sys-color-on-warning-container);
	border-left-color: var(--md-sys-color-warning);
}

.md-alert-info {
	background-color: var(--md-sys-color-primary-container);
	color: var(--md-sys-color-on-primary-container);
	border-left-color: var(--md-sys-color-primary);
}

/* Top App Bar */
.md-top-app-bar {
	background-color: var(--md-sys-color-primary);
	color: var(--md-sys-color-on-primary);
	padding: 16px 24px;
	box-shadow: var(--md-sys-elevation-shadow-2);
}

.md-top-app-bar-title {
	font-size: var(--md-sys-typescale-title-large-size);
	font-weight: var(--md-sys-typescale-title-medium-weight);
	margin: 0;
}

/* Tables */
.md-table {
	width: 100%;
	border-collapse: collapse;
	background-color: var(--md-sys-color-surface-container-lowest);
	border-radius: var(--md-sys-shape-corner-medium);
	overflow: hidden;
	box-shadow: var(--md-sys-elevation-shadow-1);
}

.md-table th {
	background-color: var(--md-sys-color-surface-container-high);
	color: var(--md-sys-color-on-surface);
	font-weight: var(--md-sys-typescale-title-medium-weight);
	text-align: left;
	padding: 16px;
	border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.md-table td {
	padding: 16px;
	border-bottom: 1px solid var(--md-sys-color-outline-variant);
	color: var(--md-sys-color-on-surface);
}

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

.md-table tr:hover {
	background-color: var(--md-sys-color-surface-container-low);
}

/* Dividers */
.md-divider {
	height: 1px;
	background-color: var(--md-sys-color-outline-variant);
	border: none;
	margin: 16px 0;
}

/* Container & Layout */
.md-container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 16px;
}

.md-container-fluid {
	width: 100%;
	padding: 0 24px;
}

/* Grid System */
.md-row {
	display: flex;
	flex-wrap: wrap;
	margin: 0 -8px;
}

.md-col {
	flex: 1;
	padding: 0 8px;
}

.md-col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.md-col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.md-col-3 { flex: 0 0 25%; max-width: 25%; }
.md-col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.md-col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.md-col-6 { flex: 0 0 50%; max-width: 50%; }
.md-col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.md-col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.md-col-9 { flex: 0 0 75%; max-width: 75%; }
.md-col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.md-col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.md-col-12 { flex: 0 0 100%; max-width: 100%; }

/* Typography */
.md-display-large {
	font-size: var(--md-sys-typescale-display-large-size);
	line-height: var(--md-sys-typescale-display-large-line-height);
	font-weight: var(--md-sys-typescale-display-large-weight);
}

.md-headline-large {
	font-size: var(--md-sys-typescale-headline-large-size);
	line-height: var(--md-sys-typescale-headline-large-line-height);
	font-weight: var(--md-sys-typescale-headline-large-weight);
}

.md-headline-medium {
	font-size: var(--md-sys-typescale-headline-medium-size);
	line-height: var(--md-sys-typescale-headline-medium-line-height);
	font-weight: var(--md-sys-typescale-headline-medium-weight);
}

.md-headline-small {
	font-size: var(--md-sys-typescale-headline-small-size);
	line-height: var(--md-sys-typescale-headline-small-line-height);
	font-weight: var(--md-sys-typescale-headline-small-weight);
}

.md-title-large {
	font-size: var(--md-sys-typescale-title-large-size);
	line-height: var(--md-sys-typescale-title-large-line-height);
	font-weight: var(--md-sys-typescale-title-large-weight);
}

.md-title-medium {
	font-size: var(--md-sys-typescale-title-medium-size);
	line-height: var(--md-sys-typescale-title-medium-line-height);
	font-weight: var(--md-sys-typescale-title-medium-weight);
}

.md-body-large {
	font-size: var(--md-sys-typescale-body-large-size);
	line-height: var(--md-sys-typescale-body-large-line-height);
	font-weight: var(--md-sys-typescale-body-large-weight);
}

.md-body-medium {
	font-size: var(--md-sys-typescale-body-medium-size);
	line-height: var(--md-sys-typescale-body-medium-line-height);
	font-weight: var(--md-sys-typescale-body-medium-weight);
}

/* Spacing Utilities */
.md-mb-1 { margin-bottom: 8px; }
.md-mb-2 { margin-bottom: 16px; }
.md-mb-3 { margin-bottom: 24px; }
.md-mb-4 { margin-bottom: 32px; }
.md-mb-5 { margin-bottom: 40px; }

.md-mt-1 { margin-top: 8px; }
.md-mt-2 { margin-top: 16px; }
.md-mt-3 { margin-top: 24px; }
.md-mt-4 { margin-top: 32px; }
.md-mt-5 { margin-top: 40px; }

.md-p-1 { padding: 8px; }
.md-p-2 { padding: 16px; }
.md-p-3 { padding: 24px; }
.md-p-4 { padding: 32px; }

/* Text Alignment */
.md-text-center { text-align: center; }
.md-text-left { text-align: left; }
.md-text-right { text-align: right; }

/* Flex Utilities */
.md-flex { display: flex; }
.md-flex-row { flex-direction: row; }
.md-flex-column { flex-direction: column; }
.md-flex-wrap { flex-wrap: wrap; }
.md-justify-center { justify-content: center; }
.md-justify-between { justify-content: space-between; }
.md-justify-around { justify-content: space-around; }
.md-align-center { align-items: center; }
.md-align-start { align-items: flex-start; }
.md-align-end { align-items: flex-end; }
.md-gap-1 { gap: 8px; }
.md-gap-2 { gap: 16px; }
.md-gap-3 { gap: 24px; }

/* Responsive */
@media (max-width: 768px) {
	.md-col-1, .md-col-2, .md-col-3, .md-col-4,
	.md-col-5, .md-col-6, .md-col-7, .md-col-8,
	.md-col-9, .md-col-10, .md-col-11, .md-col-12 {
		flex: 0 0 100%;
		max-width: 100%;
	}
}
