:root {
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #17191c;
    --text-secondary: #737d8c;
    --primary-color: #0ebd66;
    --primary-hover: #0ca659;
    --danger-color: #e53e3e;
    --danger-bg: #fff5f5;
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.2s ease-in-out;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #15191e;
        --card-bg: #22262b;
        --text-primary: #f2f5f8;
        --text-secondary: #8b949e;
        --border-color: #30363d;
        --danger-bg: #3c1e1e;
    }
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

h2 {
    font-size: 18px;
    font-weight: 500;
}

.form-group, .field-col, .field-full {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

select, input[type="text"] {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
    -webkit-appearance: none;
}

select:focus, input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(14, 189, 102, 0.2);
}

input.error {
    border-color: var(--danger-color);
    background-color: var(--danger-bg);
}

.btn {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
    margin-top: 20px;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.btn-primary:disabled {
    background-color: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    font-size: 13px;
}

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

.btn-remove {
    background: transparent;
    color: var(--danger-color);
    border: none;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

#items-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.item-row {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.item-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.item-fields {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.field-col {
    flex: 1;
}

.error-notification {
    background-color: var(--danger-bg);
    color: var(--danger-color);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(229, 62, 62, 0.2);
}

.hidden {
    display: none !important;
}

#loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
    font-weight: 600;
}

.loader {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
