:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --ad-bg: #e5e7eb;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.main-header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    margin-bottom: 1rem;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-img {
    height: 80px;
    width: auto;
}

nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-color);
    padding: 0.25rem;
    border-radius: 8px;
}

.lang-switcher a {
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}

.lang-switcher a:hover {
    background: var(--card-bg);
    color: var(--text-color);
}

.lang-switcher a.active {
    background: var(--primary-color);
    color: white;
}

/* Footer */
.main-footer {
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    margin-top: auto;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0;
    /* Fixed margin */
}

.main-footer nav {
    justify-content: center;
    margin-top: 0.5rem;
    gap: 0.5rem;
}

/* Breadcrumbs */
.breadcrumbs {
    background-color: var(--bg-color);
    padding: 0.75rem 0;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.breadcrumbs .container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumbs a {
    color: var(--primary-color);
    transition: color 0.2s;
}

.breadcrumbs a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.breadcrumbs .separator {
    color: var(--text-muted);
}

.breadcrumbs .current {
    color: var(--text-color);
    font-weight: 500;
}

/* Yandex Ads */
.ad-container {
    width: 100%;
    max-width: 800px;
    margin: 1.5rem auto;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.page-header h1 {
    margin-bottom: 0.5rem;
}

.page-header .subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* Search Bar */
.search-container {
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

#templateSearch {
    width: 100%;
    padding: 0.8rem 1.2rem;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    font-size: 1rem;
    transition: all 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.2rem center;
    background-size: 1.2rem;
}

#templateSearch:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

/* Category Sections */
.category-section {
    margin-bottom: 3rem;
}

.category-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

/* Forms & Cards */
h1,
h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.template-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.template-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.template-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.template-card p,
.template-card .template-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 500;
    text-align: center;
    border: none;
    cursor: pointer;
    width: 100%;
}

.btn:hover {
    background-color: var(--primary-hover);
}

/* Form Styles */
form {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form-container {
    max-width: 600px;
    margin: 0 auto;
}

.form-container .subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
}

input,
textarea,
select {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.back-link {
    margin-top: 1.5rem;
    text-align: center;
}

.back-link a {
    color: var(--primary-color);
    font-weight: 500;
}

.back-link a:hover {
    text-decoration: underline;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.alert.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

/* Responsive */
@media (max-width: 600px) {
    form {
        padding: 1.5rem;
    }

    .container {
        padding: 0 1rem;
    }

    nav {
        gap: 0.75rem;
    }

    .lang-switcher a {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }

    .breadcrumbs {
        font-size: 0.85rem;
    }

    .category-title {
        font-size: 1.25rem;
    }
}