/* Peamised stiilid */

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

html {
	color-scheme: light dark;
}

body {
	min-height: 100dvh;
	width: 100vw;
	max-width: 800px;
	margin: 0 auto;
	font-family: Arial, sans-serif;
	padding: 0;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
}

header {
	width: 100%;
	position: sticky;
	top: 0;
	background: #fff;
	margin-block-end: 2rem;
	padding: 1rem;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	z-index: 997;
	box-sizing: border-box;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.main-nav {
	display: flex;
	gap: 1rem;
	flex-wrap: wrap;
	align-items: center;
}

.menu-item-wrapper {
	position: relative;
	display: flex;
	align-items: center;
	gap: 4px;
	transition: all 0.3s ease;
}

.menu-item-wrapper[draggable="true"] {
	cursor: move;
}

.menu-item-wrapper.dragging {
	opacity: 0.5;
	transform: scale(1.05);
}

.menu-item-wrapper.drag-over {
	border: 2px dashed #4CAF50;
	background: #f9fff9;
	border-radius: 8px;
	padding: 2px;
}

.menu-item-controls {
	display: flex;
	gap: 2px;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.menu-item-wrapper:hover .menu-item-controls {
	opacity: 1;
}

.menu-edit-btn,
.menu-delete-btn {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 14px;
	padding: 2px 4px;
	border-radius: 3px;
	transition: all 0.2s ease;
	line-height: 1;
}

.menu-edit-btn:hover {
	background: rgba(33, 150, 243, 0.2);
	transform: scale(1.1);
}

.menu-delete-btn:hover {
	background: rgba(244, 67, 54, 0.2);
	transform: scale(1.1);
}

.main-nav .nav-link {
	text-decoration: none;
	color: #333;
	transition: background-color 0.3s, color 0.3s;
	text-transform: uppercase;
	padding: .4rem;
}

.nav-link:hover {
	background: red;
	color: #fff;
	border-radius: 20vw;
}

.nav-link.active {
	background: red;
	color: #fff;
	border-radius: 20vw;
}

.menu-drag-info {
	width: 100%;
	background: #E3F2FD;
	color: #1565C0;
	padding: 6px 10px;
	border-radius: 4px;
	font-size: 12px;
	border: 1px solid #90CAF9;
	margin-bottom: 10px;
	text-align: center;
	box-sizing: border-box;
}

.nav-link.active {
	background: red;
	color: #fff;
	border-radius: 20vw;
}

.auth-header {
	position: fixed;
	top: 10px;
	right: 10px;
	z-index: 999;
}

.auth-status {
	margin-right: 10px;
	color: #4CAF50;
	font-weight: bold;
}

.btn {
	padding: 8px 15px;
	text-decoration: none;
	border-radius: 4px;
	display: inline-block;
}

.btn-login {
	background: #4CAF50;
	color: white;
}

.btn-login:hover {
	background: #45a049;
}

.btn-logout {
	background: #f44336;
	color: white;
}

.btn-logout:hover {
	background: #da190b;
}

.btn-add-article {
	background: #2196F3;
	color: white;
	font-size: 16px;
	padding: 12px 20px;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
	border: none;
	cursor: pointer;
}

.btn-add-article:hover {
	background: #1976D2;
	box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.drag-info {
	position: sticky;
	top: 60px;
	background: #FFF3CD;
	color: #856404;
	padding: 8px 12px;
	border-radius: 4px;
	font-size: 13px;
	z-index: 996;
	border: 1px solid #FFEAA7;
	margin-bottom: 15px;
	width: 100%;
	box-sizing: border-box;
}

body:has(.controls-footer) {
	padding-block-end: 100px; /* Jätab ruumi jaluse jaoks */
}

.controls-footer {
	width: 100vw;
	background: #f5f5f5;
	border-top: 1px solid #ddd;
	padding: 20px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 15px;
	box-sizing: border-box;
	margin-top: auto;
	position: fixed;
	bottom: 0;
	left: 0;
}

.footer-buttons {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.auth-controls {
	display: flex;
	gap: 10px;
	align-items: center;
	flex-wrap: wrap;
}

article {
	position: relative;
	width: 100%;
	margin-bottom: 30px;
	transition: all 0.3s ease;
}

article[draggable="true"] {
	cursor: move;
}

article.dragging {
	opacity: 0.6;
	background: rgba(255, 255, 255, 0.7);
	box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
	transform: rotate(2deg);
}

article.drag-over {
	border: 2px dashed #4CAF50;
	background: #f9fff9;
}

.edit-btn {
	position: absolute;
	right: 40px;
	top: -20px;	
	padding: 5px 10px;
	font-size: 14px;
	cursor: pointer;
}

h1 {
	font-size: 24px;
	margin-bottom: 10px;
}

div {
	font-size: 16px;
	line-height: 1.5;
}

a {
	color: blue;
	text-decoration: underline;
}

a:hover {
	opacity: 0.8;
}

.signup-section {
	padding: 0 1rem 3rem;
}

.signup-form {
	margin-top: 1.5rem;
	display: grid;
	gap: 1rem;
}

.form-row {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.form-row input[type="text"],
.form-row input[type="email"] {
	padding: 0.6rem 0.8rem;
	border: 1px solid #ccc;
	border-radius: 6px;
	font-size: 16px;
}

.checkbox-label {
	display: flex;
	gap: 0.6rem;
	align-items: flex-start;
}

.form-actions {
	margin-top: 0.5rem;
}

.form-message {
	border-radius: 6px;
	padding: 0.8rem 1rem;
	margin: 1rem 0;
}

.form-message.success {
	background: #e8f5e9;
	color: #1b5e20;
	border: 1px solid #c8e6c9;
}

.form-message.error {
	background: #ffebee;
	color: #b71c1c;
	border: 1px solid #ffcdd2;
}

.form-message ul {
	margin: 0;
	padding-left: 1.2rem;
}

.hidden-field {
	display: none;
}

/* Tabeli stiilid */
table {
	border-collapse: collapse;
	width: 100%;
	margin: 15px 0;
	border: 1px solid #ddd;
	box-sizing: border-box;
}

th, td {
	border: 1px solid #ddd;
	padding: 8px 12px;
	text-align: left;
}

th {
	background-color: #f2f2f2;
	font-weight: bold;
}

tr:hover {
	background-color: #f5f5f5;
}

#textEditor table {
	border-collapse: collapse;
	width: 100%;
	margin: 10px 0;
}

#textEditor th, 
#textEditor td {
	border: 1px solid #ccc;
	padding: 6px 10px;
	min-width: 50px;
}

#textEditor th {
	background-color: #e8e8e8;
}
