* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    padding: 2rem 1rem;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 1rem;
    box-shadow: 0 20px 60px var(--shadow);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 1.5rem;
}

.language-toggle {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.lang-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
}

main {
    padding: 2rem;
}

section {
    margin-bottom: 2.5rem;
}

h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.category-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px var(--shadow);
}

.category-card.selected {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.category-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.category-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.category-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.match-count {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    background: #eff6ff;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    display: inline-block;
}

.search-container {
    position: relative;
    margin-top: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
    background: var(--surface);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    pointer-events: none;
    opacity: 0.5;
}

.help-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--background);
}

.item-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.item-checkbox:hover {
    border-color: var(--primary-color);
    background: #f8fafc;
}

.item-checkbox.checked {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.item-checkbox input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.item-checkbox label {
    flex: 1;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0;
}

.item-fields {
    margin-top: 0.75rem;
    margin-left: 2rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-left: 3px solid var(--primary-color);
    border-radius: 0.375rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.field-group-inline {
    display: flex;
    flex-direction: column;
}

.template-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.template-item {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-item:hover {
    border-color: var(--primary-color);
    background: #f8fafc;
}

.template-item.selected {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.template-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.template-description {
    min-height: 150px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

#customFields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.field-group {
    display: flex;
    flex-direction: column;
}

.field-group label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

#commentPreview {
    background: #f8fafc;
    font-family: 'Courier New', monospace;
    resize: vertical;
    line-height: 1.6;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.btn {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-2px);
}

.notification {
    padding: 0.75rem;
    border-radius: 0.5rem;
    text-align: center;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.notification.show {
    opacity: 1;
}

.notification.success {
    background: #d1fae5;
    color: #065f46;
}

footer {
    background: #f8fafc;
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    main {
        padding: 1.5rem;
    }
}
