/*
 * Автоконкурсы для IP.Board 3.4 — стили публичного раздела.
 * Все правила ограничены контейнером #contests-page,
 * поэтому стили не конфликтуют с оформлением форума.
 */

#contests-page {
	max-width: 1100px;
	margin: 0 auto;
	color: #2b2b2b;
	font-size: 14px;
	line-height: 1.5;
}

#contests-page a { text-decoration: none; }

/* Заголовки */
#contests-page .contests-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 2px solid #e9e9e9;
	margin-bottom: 14px;
	padding-bottom: 8px;
}

#contests-page .contests-title {
	font-size: 24px;
	font-weight: 700;
	margin: 0;
	color: #1e1e1e;
}

#contests-page .contests-head-actions { white-space: nowrap; }

/* Дерево категорий */
#contests-page .contests-tree { margin-bottom: 16px; }

#contests-page .contests-tree-root > a {
	font-size: 16px;
	font-weight: 700;
	color: #1e1e1e;
}

#contests-page .contests-tree-branches,
#contests-page .contests-tree-sub {
	list-style: none;
	margin: 8px 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

#contests-page .contests-tree-sub { margin-left: 18px; }

#contests-page .contests-tree-branches li > a {
	display: inline-block;
	padding: 6px 12px;
	border: 1px solid #dcdcdc;
	border-radius: 16px;
	background: #fafafa;
	color: #333;
}

#contests-page .contests-tree-branches li > a:hover { background: #f0f0f0; }

#contests-page .contests-tree-active > a {
	border-color: #3b7ddd;
	background: #eaf2ff;
	color: #23527c;
	font-weight: 600;
}

#contests-page .contests-count {
	display: inline-block;
	min-width: 18px;
	padding: 0 5px;
	margin-left: 4px;
	border-radius: 9px;
	background: #e6e6e6;
	color: #555;
	font-size: 11px;
	text-align: center;
}

/* Панель поиска */
#contests-page .contests-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 14px;
}

#contests-page .contests-search input[type="text"] {
	padding: 6px 10px;
	border: 1px solid #cfcfcf;
	border-radius: 4px;
	min-width: 220px;
}

#contests-page .contests-total { color: #777; font-size: 13px; }

/* Карточки конкурсов */
#contests-page .contests-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 16px;
}

#contests-page .contests-card {
	border: 1px solid #e3e3e3;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0,0,0,.05);
	display: flex;
	flex-direction: column;
}

#contests-page .contests-card-image img {
	display: block;
	width: 100%;
	height: 150px;
	object-fit: cover;
}

#contests-page .contests-card-body { padding: 12px; flex: 1; display: flex; flex-direction: column; }

#contests-page .contests-card-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
#contests-page .contests-card-title a { color: #23527c; }
#contests-page .contests-card-meta { margin-bottom: 8px; font-size: 12px; color: #777; }
#contests-page .contests-card-desc { color: #555; font-size: 13px; flex: 1; }

#contests-page .contests-card-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid #f0f0f0;
	font-size: 12px;
	color: #666;
}

#contests-page .contests-card-prize { color: #a05a00; font-weight: 600; }

/* Значки статуса */
#contests-page .contests-badge,
.contests-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 600;
	background: #eee;
	color: #555;
}

#contests-page .contests-badge-active { background: #e3f6e5; color: #1d7a2c; }
#contests-page .contests-badge-done { background: #e8eefc; color: #29539b; }
#contests-page .contests-badge-wait { background: #fdf3d8; color: #8a6100; }
#contests-page .contests-badge-cancel { background: #fbe6e6; color: #9c2b2b; }
#contests-page .contests-badge-draft { background: #ececec; color: #666; }

/* Кнопки */
#contests-page .contests-btn,
#contests-page .contests-btn:visited {
	display: inline-block;
	padding: 8px 16px;
	border: 1px solid #3b7ddd;
	border-radius: 4px;
	background: #3b7ddd;
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}

#contests-page .contests-btn:hover { background: #2f6ac0; }

#contests-page .contests-btn-small { padding: 5px 10px; font-size: 12px; }

#contests-page .contests-btn-ghost {
	background: #fff;
	color: #23527c;
	border-color: #cfd8e3;
}

#contests-page .contests-btn-ghost:hover { background: #f4f7fb; }

/* Страница конкурса */
#contests-page .contests-contest-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	border-bottom: 2px solid #e9e9e9;
	padding-bottom: 8px;
	margin-bottom: 14px;
}

#contests-page .contests-contest-image img {
	max-width: 100%;
	border-radius: 6px;
	margin-bottom: 14px;
}

#contests-page .contests-info-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 16px;
	background: #fafafa;
	border: 1px solid #eee;
}

#contests-page .contests-info-table td {
	padding: 8px 12px;
	border-bottom: 1px solid #eee;
	vertical-align: top;
}

#contests-page .contests-info-table td:first-child {
	width: 200px;
	color: #777;
	font-weight: 600;
}

#contests-page .contests-block {
	margin: 0 0 18px;
	border: 1px solid #ececec;
	border-radius: 6px;
	padding: 14px;
	background: #fff;
}

#contests-page .contests-block h2 {
	margin: 0 0 10px;
	font-size: 17px;
	color: #1e1e1e;
	border-left: 3px solid #3b7ddd;
	padding-left: 8px;
}

#contests-page .contests-text { color: #444; }
#contests-page .contests-muted { color: #888; font-size: 12px; }

/* Условия участия */
#contests-page .contests-requirements {
	list-style: none;
	margin: 0 0 10px;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

#contests-page .contests-requirements li {
	background: #f4f7fb;
	border: 1px solid #dde6f2;
	border-radius: 4px;
	padding: 6px 10px;
	font-size: 13px;
}

#contests-page .contests-requirements span { color: #666; margin-right: 6px; }

/* Таблицы */
#contests-page .contests-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

#contests-page .contests-table th,
#contests-page .contests-table td {
	border: 1px solid #e6e6e6;
	padding: 7px 9px;
	text-align: left;
	vertical-align: top;
}

#contests-page .contests-table th { background: #f5f5f5; }

#contests-page .contests-ok td { color: #1d7a2c; }
#contests-page .contests-fail td { color: #9c2b2b; background: #fdf6f6; }

/* Форма участия */
#contests-page .contests-form { margin-top: 10px; }

#contests-page .contests-field { display: block; margin-bottom: 12px; }
#contests-page .contests-field > span { display: block; font-weight: 600; margin-bottom: 4px; }

#contests-page .contests-field input[type="text"],
#contests-page .contests-field input[type="date"],
#contests-page .contests-field input[type="number"],
#contests-page .contests-field select,
#contests-page .contests-field textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
	border: 1px solid #cfcfcf;
	border-radius: 4px;
	font-size: 14px;
	font-family: inherit;
}

/* Создание конкурса */
#contests-page .contests-form-wide { max-width: 900px; }

#contests-page .contests-form-row {
	display: flex;
	gap: 14px;
	flex-wrap: wrap;
}

#contests-page .contests-form-row .contests-field { flex: 1 1 180px; }

#contests-page .contests-fieldset {
	border: 1px solid #e3e8ef;
	border-radius: 6px;
	padding: 12px 14px 4px;
	margin: 0 0 14px;
}

#contests-page .contests-fieldset legend {
	font-weight: 700;
	padding: 0 6px;
}

#contests-page .contests-check {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
}

#contests-page .contests-form-foot {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

/* Заявки */
#contests-page .contests-entry {
	border: 1px solid #eee;
	border-radius: 6px;
	padding: 10px 12px;
	margin-bottom: 10px;
	background: #fcfcfc;
}

#contests-page .contests-entry-winner {
	border-color: #ffd88a;
	background: #fffaf0;
}

#contests-page .contests-entry-head {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: baseline;
	margin-bottom: 6px;
}

#contests-page .contests-entry-title { font-weight: 700; }
#contests-page .contests-entry-author { color: #23527c; }
#contests-page .contests-entry-date { color: #999; font-size: 12px; margin-left: auto; }
#contests-page .contests-entry-win { color: #a05a00; font-weight: 700; font-size: 12px; margin-bottom: 4px; }
#contests-page .contests-entry-image img { max-width: 320px; border-radius: 4px; margin-top: 8px; }

/* Мои конкурсы */
#contests-page .contests-my-entry {
	border: 1px solid #e3e3e3;
	border-radius: 6px;
	padding: 12px;
	background: #fafafa;
}

#contests-page .contests-my-entry-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
#contests-page .contests-my-entry-status { color: #666; font-size: 13px; margin-bottom: 8px; }
#contests-page .contests-my-entry-image img { max-width: 320px; border-radius: 4px; margin-top: 8px; }

/* Победители */
#contests-page .contests-winners-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 12px;
}

#contests-page .contests-winner-card {
	border: 1px solid #ffd88a;
	border-radius: 6px;
	background: #fffaf0;
	padding: 12px;
}

#contests-page .contests-winner-place { color: #a05a00; font-weight: 700; margin-bottom: 4px; }
#contests-page .contests-winner-title { font-weight: 700; margin-bottom: 4px; }
#contests-page .contests-winner-author { color: #23527c; font-size: 13px; margin-bottom: 6px; }
#contests-page .contests-winner-text { color: #555; font-size: 13px; }
#contests-page .contests-win-label { color: #a05a00; font-weight: 700; }

/* Сообщения */
#contests-page .contests-alert {
	border-radius: 5px;
	padding: 10px 12px;
	margin-bottom: 14px;
	border: 1px solid transparent;
	font-size: 13px;
}

#contests-page .contests-alert-info { background: #eef4fd; border-color: #d3e2f7; color: #23527c; }
#contests-page .contests-alert-success { background: #eaf8ec; border-color: #cfe9d4; color: #1d7a2c; }
#contests-page .contests-alert-error { background: #fdf0f0; border-color: #f3d4d4; color: #9c2b2b; }

/* Пагинация */
#contests-page .contests-pagination {
	margin: 16px 0;
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

#contests-page .contests-pagination a {
	display: inline-block;
	min-width: 28px;
	padding: 5px 8px;
	text-align: center;
	border: 1px solid #ddd;
	border-radius: 4px;
	color: #23527c;
	background: #fff;
}

#contests-page .contests-pagination a:hover { background: #f2f6fc; }

#contests-page .contests-page-current {
	background: #3b7ddd !important;
	border-color: #3b7ddd !important;
	color: #fff !important;
	font-weight: 700;
}

@media (max-width: 640px) {
	#contests-page .contests-head,
	#contests-page .contests-contest-head { flex-direction: column; align-items: flex-start; }
	#contests-page .contests-toolbar { flex-direction: column; align-items: stretch; }
	#contests-page .contests-info-table td:first-child { width: auto; }
}

/* ================= Панель конкурса на странице темы ================= */

.contests-panel {
	background: transparent;
	border: 0;
	padding: 0;
	margin: 0 0 18px;
	font-size: 14px;
	line-height: 1.4;
	color: inherit;
}

.contests-giveaway-head {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 10px;
	margin: 0 0 12px;
}

.contests-giveaway-title {
	font-size: 16px;
	font-weight: 700;
	margin: 0;
	color: #1d3652;
}

.contests-giveaway-alert {
	background: #f4fcff;
	border: 1px solid #cae9f5;
	border-radius: 4px;
	padding: 10px 12px;
	margin: 0 0 12px;
	color: #1d3652;
}

.contests-giveaway-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 10px;
}

.contests-giveaway-card {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	background: #fff;
	border: 1px solid #d6e2eb;
	border-radius: 4px;
	padding: 12px 14px;
	min-width: 0;
	text-align: left;
}

.contests-giveaway-icon {
	display: block;
	width: 28px;
	height: 28px;
	flex: 0 0 28px;
	margin: 0;
	background-color: #708c96;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
}

.contests-giveaway-label {
	color: #708c96;
	font-size: 13px;
}

.contests-giveaway-value {
	color: #1d3652;
	font-size: 15px;
	font-weight: 700;
	margin-top: 2px;
	word-break: break-word;
}

.contests-giveaway-actions {
	flex: 0 0 auto;
}

@media (max-width: 900px) {
	.contests-giveaway-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
	.contests-giveaway-grid { grid-template-columns: 1fr; }
}

.contests-panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 8px;
}

.contests-panel-t {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 1px;
	color: #3b7ddd;
	font-weight: 700;
}

.contests-panel-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 22px;
}

.contests-panel-meta span { white-space: nowrap; }
.contests-panel-meta em { color: #a04; font-style: normal; font-weight: 600; }

.contests-panel-prizes { margin-top: 8px; }
.contests-panel-prizes ol { margin: 4px 0 0 22px; padding: 0; }

.contests-panel-join {
	border: 1px solid #4faded;
	border-radius: 3px;
	background: #4faded;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	padding: 6px 14px;
	cursor: pointer;
	white-space: nowrap;
}

a.contests-panel-join { text-decoration: none; display: inline-block; }

.contests-panel-join:hover { background: #3d9ad4; border-color: #3d9ad4; color: #fff; }

.contests-panel-you { color: #2e8b2e; font-weight: 700; }
.contests-panel-winner { color: #b8860b; }
.contests-panel-lock { color: #a04040; }

.contests-panel-req { margin-top: 8px; color: #555; }

.contests-panel-needmore {
	margin-top: 8px;
	background: #fdeeee;
	border: 1px solid #f2c4c4;
	border-radius: 4px;
	padding: 8px 12px;
	color: #a04040;
	font-weight: 600;
}

.contests-panel-form { display: inline-block; margin: 0; }
